I am using Spring Boot and Spring Batch and JPA to load data from One database into another. In a single batch Job I've created 10 steps to run steps in sequence and each step reads almost 1 millions records (I can't run in parallel, because data that I've doesn't load in parallel).
I've used GenerationType.IDENTITY and look like because of this batch job taking hell lot of time. If I say to load 100 records it takes 2 min. The target Postgres database has sequences implemented by DBA and we must need to follow those, but its eating up all the performance.
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "EMP_ID", nullable = false, updatable = false, insertable = false)
private Long id;
How can I improve the performance of this batch job ?
I kept spring.jpa.properties.hibernate.jdbc.batch_size=1000 and chunkSize=1000 as well.