GenerationType.IDENTITY
will disable insert batching. The (BIG)SERIAL
is acting 'almost' like MySQL, AUTO_INCREMENT
. In this application, we use the GenerationType.SEQUENCE
which permits insert batching, and we optimize it via the hi/lo
optimization algorithm.GenerationType.SEQUENCE
instead of GenerationType.IDENTITY
hi/lo
algorithm to fetch a hi value in a database roundtrip (the hi value is useful for generating a certain/given number of identifiers in-memory; until you haven't exhausted all in-memory identifiers there is no need to fetch another hi)pooled
and pooled-lo
identifier generators (these are optimizations of hi/lo
that allows external services to use the database without causing duplication keys errors)spring.datasource.hikari.data-source-properties.reWriteBatchedInserts=true
If you need a deep dive into the performance recipes exposed in this repository then I am sure that you will love my book 'Spring Boot Persistence Best Practices' | If you need a hand of tips and illustrations of 100+ Java persistence performance issues then 'Java Persistence Performance Illustrated Guide' is for you. |