Multithreaded Data Insertion into a DB: From Speed to Atomicity — Spring + PostgreSQL
summary
Shows how to speed up database inserts in a Spring + PostgreSQL stack by parallelizing the insert work while still preserving atomicity of the overall operation. Covers Spring batch updates and PostgreSQL behavior, explains why updates/inserts are costly, demonstrates techniques to accelerate them in that stack, and compares different atomicity-preserving approaches with benchmark results.
AI-written summary · about
chapters (29)
- 0:00Introduction
- 1:10Talk overview
- 2:14Multithreaded insertion basics
- 3:16Spring JDBC batch settings
- 4:40Atomic single-threaded insertion
- 5:01Making insertion async
- 6:03Making parallel insertion atomic
- 7:05Why updates are expensive
- 8:29Hibernate merge and caching
- 10:16Stateless session for updates
- 10:57Direct JDBC updates
- 11:58Transaction ID approach
- 12:42PostgreSQL MVCC explained
- 15:09Heap updates optimization
- 16:52FILLFACTOR tuning
- 19:23Final atomic multithreaded insertion
- 20:49Atomicity in separate table
- 22:36Active transaction entity
- 23:43PostgreSQL delete performance
- 24:23Lightweight transaction table
- 25:29Reading actual data options
- 28:32Fixing Hibernate query issues
- 30:19Benchmarking read ops
- 31:43Impact of uncommitted data
- 33:08Summary of transaction ID methods
- 34:10Hibernate fetch type problems
- 36:43PostgreSQL two-phase commit
- 39:54Final recommendations
- 40:59Q&A
