Making Postgres inserts faster on Azure
summary
Practical recipes and numbers: using unlogged tables gives about 5× faster inserts and 10× faster COPY for staging loads; switch heavy imports to the COPY command or micro-batch multi-row INSERTs (send 10–100s of rows per transaction instead of 100K single commits); drop or disable indexes, unique/foreign constraints and triggers for bulk loads; delay HA/read-replica creation until after load; tune wal_buffers (e.g. up to 128MB), shared_buffers (~40% RAM), max_wal_size (up to 64GB) and turn off autovacuum during the load.
AI-written summary · about
chapters (9)
- 0:00Intro
- 2:02Key Scenarios
- 2:28Creating unclogged tables
- 5:15Using COPY command
- 6:48Batch inserts vs Single commits
- 8:27Removing/Disabling contraints, triggers, & indexes
- 10:26Partitioning the table
- 11:42HA & Read Replica
- 13:08Tuning server parameters
related talks
53mOptimizing your Azure SQL Database workloads
57mPostgreSQL When It's Not Your Job
34mData modeling for those who want to save time and money!
32mLoading at Hyperscale: Advanced Data Import Techniques for Citus
52mBulk data processing and PostgreSQL thingy
48mOptimal Data Loads
37mPostgres at Any Scale
30mOvercoming Performance Hurdles in Postgres Partitioned Tables
