Tuning PostgreSQL to work even better
summary
PostgreSQL defaults are conservative but a handful of concrete changes usually help: inspect values with SHOW and the pg_settings view and edit postgresql.conf or use ALTER SYSTEM, then RELOAD or restart as required. Key levers include shared_buffers (default ~128MB — try 25–40% of RAM), work_mem (default 4MB — try 10MB for big sorts), max_connections (default 100 — use pooling like PgBouncer if you need hundreds), checkpoint_timeout (default 5min — 10–30min common), max_wal_size (default 1GB), effective_cache_size (50–70%), random_page_cost (~1.1 for SSD), plus logging via log_min_duration_statement. Leave fsync and autovacuum enabled.
AI-written summary · about
chapters (10)
- 0:00Introduction and overview
- 3:19PostgreSQL configuration basics
- 11:36Key parameters by category
- 17:18Memory-related settings
- 21:31Logging for debugging
- 23:57WAL and checkpoint tuning
- 27:49Query tuning parameters
- 29:57Parameters to leave alone
- 33:18Top parameters to start with
- 33:59Conclusion and takeaways
related talks
33mTuning PostgreSQL to work even better
45mProper PostgreSQL Parameters to Prevent Poor Performance
52mPostgreSQL Configuration for Humans
57mPostgreSQL When It's Not Your Job
43mPostgres Performance: From Slow to Pro
25mScaling PostgreSQL Beyond Query Optimization
48mPractical Memory Tuning for PostgreSQL
58mScaling Postgres
