PostgreSQL guides

Short, practical deep dives into the parts of PostgreSQL that bite in production. No fluff, real commands, honest trade-offs.

Performance

How to read EXPLAIN ANALYZE

What the costs mean, why actual times and rows are per-loop averages, what BUFFERS tells you, and the traps that make plans misleading at first glance.

Performance

Choosing the right index

B-tree covers most cases — but GIN, GiST, BRIN, partial and expression indexes each have a moment where they win by an order of magnitude.

Operations

VACUUM, autovacuum and table bloat

MVCC never updates a row in place. Where the dead versions go, how autovacuum decides when to clean up, and how to tell when it's falling behind.

Concurrency

Transaction isolation levels

What Read Committed actually guarantees (less than you think), when Repeatable Read and Serializable throw errors, and how to retry correctly.

Cheat sheet

Show running queries

The pg_stat_activity query to paste, what state and wait_event mean, and how to find who is blocking whom.

Cheat sheet

Kill a query safely

pg_cancel_backend vs pg_terminate_backend, bulk cleanup of idle transactions — and why kill -9 turns one query into an outage.

Cheat sheet

Table & index sizes

The biggest-tables query, the three size functions disambiguated, and why size on disk is not the same as live data.

Reference

PostgreSQL cheat sheet

The everyday commands on one printable sheet: psql, activity & locks, kill, sizes, vacuum, EXPLAIN, backup, privileges, SQLSTATEs.

How these guides are written

Each guide is based on how PostgreSQL actually behaves in production, verified against the official documentation. They focus on the questions that come up when something is slow or blocked at 4pm on a weekday — not on completeness for its own sake. Where a topic has a matching interactive tool on this site, the guide links to it.