Free PDF — Production Reference

The Postgres Performance Cheatsheet

For Engineers Who Read EXPLAIN Plans for Fun

Every Postgres performance lever in one reference. Index design, EXPLAIN ANALYZE reading, query tuning, connection pooling, vacuum strategy, partitioning, pgvector for AI workloads.

🔍
EXPLAIN Decoded Read any EXPLAIN ANALYZE plan in 30 seconds. Spot the seq scan, the hash join blowup, the bad estimate.
📒
Index Design Tree B-tree, GIN, GiST, BRIN, hash, partial, covering, expression — decision tree by workload pattern.
Connection Pooling Math pgbouncer vs pgcat sizing, max_connections math, transaction vs session pooling tradeoffs.
🧬
pgvector for AI HNSW vs IVFFlat parameter tuning, hybrid search with tsvector, scaling to 100M+ embeddings.

No spam. Unsubscribe anytime. You'll also get my weekly posts on AI & engineering.

What's Inside

Reading the Plan

  • EXPLAIN ANALYZE — what every line means
  • Seq scan vs index scan vs index-only scan
  • Hash join, merge join, nested loop — when each wins
  • Estimate-vs-actual rows: the planner's lies

Indexes

  • B-tree, GIN, GiST, BRIN, hash — decision tree
  • Partial, expression, covering indexes
  • Multi-column index column order rules
  • When indexes hurt more than help

Tuning

  • shared_buffers, work_mem, effective_cache_size
  • autovacuum strategy + bloat monitoring
  • Connection pooling: pgbouncer, pgcat sizing
  • Partitioning: range, list, hash patterns

AI Workloads

  • pgvector: HNSW vs IVFFlat tuning
  • Hybrid search: pgvector + tsvector + trgm
  • Scaling embedding tables to 100M+ rows
  • Backup and replication for vector data