Performance & optimization
Master PostgreSQL performance optimization with practical guides covering query tuning, indexing strategies, and system optimization.
Guides by Category
Query Tuning
Learn how to analyze and optimize slow queries using EXPLAIN, pg_stat_statements, and other powerful tools.
- EXPLAIN ANALYZE or EXPLAIN (ANALYZE, BUFFERS)? - 5 min (intermediate)
- How to find query examples for problematic pg_stat_statements records - 6 min (beginner)
- How to decide when a query is too slow and needs optimization - 5 min (intermediate)
- How to make the non-production Postgres planner behave like in production - 5 min (intermediate)
Indexing
Discover best practices for creating and maintaining efficient indexes, including B-tree, GiST, and other index types.
- How to monitor CREATE INDEX / REINDEX progress in Postgres 12+ - 5 min (advanced)
- Over-indexing - 5 min (beginner)
- Index maintenance - 5 min (beginner)
- How to find unused indexes - 7 min (beginner)
- How to find redundant indexes - 6 min (beginner)
- How to rebuild many indexes using many backends avoiding deadlocks - 5 min (intermediate)
Monitoring
Understand how to monitor system performance and use database statistics for optimal query planning.
- How to work with pg_stat_statements, part 1 - 8 min (beginner)
- Ad-hoc monitoring - 7 min (beginner)
- How to monitor transaction ID wraparound risks - 5 min (advanced)
- How to monitor xmin horizon to prevent XID/MultiXID wraparound and high bloat - 6 min (intermediate)
- How to analyze heavyweight locks, part 1 - 5 min (beginner)
- How to reduce WAL generation rates - 5 min (intermediate)
Benchmarks
Learn how to properly benchmark PostgreSQL performance.
- How to benchmark - 7 min (beginner)
- Pre- and post-steps for benchmark iterations - 5 min (intermediate)