Guides

Database performance guides grounded in workload decisions.

Use these guides to frame the evidence and trade-offs behind a production change. Each one ends with the checks to run on your own system.

PostgreSQL performance and locking

Diagnose blocking, indexing and physical-design problems from production evidence before changing the schema. Related: PostgreSQL performance investigation.

Method · New

How to profile slow PostgreSQL queries

pg_stat_statements to rank, auto_explain to capture the real plan, EXPLAIN ANALYZE to measure, then validate.

Lab-tested · New

PostgreSQL 18 async I/O: does io_method help?

worker cut a cold sequential scan by a third; io_uring won on a bitmap scan. How to measure it on your storage.

Lab-tested

Find slow queries with pg_stat_statements

Rank statements by total time, diff snapshots and read buffer and temp signals before changing anything.

Lab-tested · New

Autovacuum not removing dead tuples

Autovacuum ran four times and removed nothing while one session sat idle in transaction. Find the xmin blocker.

Lab-tested · New

work_mem and temp file spills

Raising work_mem 64 times removed every spill and saved at most 8%. Measure the spill cost before changing memory.

Lab-tested · New

Transaction ID wraparound: warning, shutdown, recovery

The real warning and stop error, why VACUUM FREEZE did not help, and the recovery steps that did.

Locking

PostgreSQL concurrency and locking

Lock modes, advisory locks and deadlocks, plus how to find the session at the head of a blocking chain.

Indexing

When BRIN beats B-tree

Compare physical correlation, lossy rechecks and ordered access on the real query.

Partitioning

Scaling with partitioning

Range, list and hash partitioning; pruning, retention and key constraints before migrating a table.

Physical design

CLUSTER and query performance

Measure heap locality against rewrite time, disk space and the ACCESS EXCLUSIVE lock.

Architecture

Sharding PostgreSQL

FDW and Citus approaches, shard keys, rebalancing and cross-shard work.

Diagnosis

What AI misses in production diagnosis

Why a plausible query recommendation can still be unsafe without workload context.