Search the archive or browse every post grouped by topic. For the chronological feed, see
the home page or the RSS feed.
Search the archivePress Enter to search all posts, pages and TIL notes.
Fastest MS SQL Inserts (series)
A measured deep-dive into how to insert data into SQL Server from Java — 8 parts, 4,222
benchmark runs, 50 takeaways. Start with Part 1 if you're new; Part 8 contains the
executive summary and final ranking of 33 strategies.
| # | Post | Key finding |
|---|
| 1 | Hibernate Batching | Batched persist() is 6.6× faster than default saveAll() |
| 2 | JDBC Strategies | Bulk API wins at 492 ms vs 2,423 ms for JDBC PreparedStatement |
| 3 | Multi-Value INSERT | 200 values per statement is the sweet spot (4-5× faster than single-row) |
| 4 | Bulk Copy Flag | One connection-string flag — useBulkCopyForBatchInsert=true — gives 2-2.5× speedup |
| 5 | Hibernate Tuning | Persistable + StatelessSession close 80% of the gap to raw JDBC |
| 6 | Parallel Threads | 4 threads × Bulk API = 330 ms — the Java-client ceiling |
| 7 | Index Impact | 5 non-clustered indexes slow inserts 11× regardless of strategy |
| 8 | TVP, JDBC, Full Ranking | INSERT…SELECT = 319 ms — the absolute fastest overall path |
Java fundamentals
Learning & career