10,000 inserts: IDENTITY vs SEQUENCE vs UUID, hibernate.jdbc.batch_size=50, flush+clear every 50 rows

######## H2 ########
database: H2Dialect / H2 2.4.240 (2025-09-22)
timings are wall-clock milliseconds on one developer machine, one run each after a warm-up pass: indicative, not a benchmark

IDENTITY                          331 ms   prepared=10000 (insert=10000, sequence=0) addBatch=0 executeBatch=0 executeSingle=10000
SEQUENCE allocationSize=1         226 ms   prepared=10200 (insert=200, sequence=10000) addBatch=10000 executeBatch=200 executeSingle=10000
SEQUENCE allocationSize=50         46 ms   prepared=400 (insert=200, sequence=200) addBatch=10000 executeBatch=200 executeSingle=200
UUID v4 (GenerationType.UUID)      98 ms   prepared=200 (insert=200, sequence=0) addBatch=10000 executeBatch=200 executeSingle=0
UUID v7 (Style.VERSION_7)          64 ms   prepared=200 (insert=200, sequence=0) addBatch=10000 executeBatch=200 executeSingle=0

Hibernate Statistics for the whole session factory (all rows above, including the warm-up): entityInsertCount=55000 prepareStatementCount=23101

Same SEQUENCE allocationSize=50 entity, hibernate.jdbc.batch_size NOT set:
SEQUENCE allocationSize=50         68 ms   prepared=10201 (insert=10000, sequence=201) addBatch=0 executeBatch=0 executeSingle=10201

######## POSTGRES ########
SKIPPED: no Docker daemon was reachable when this transcript was generated, so PostgreSQL was not run.
