The PostgreSQL Cookbook
Full-incident runbooks for the failures single error pages can't cover — replication lag, autovacuum bloat, lock storms, failovers. Each one a complete diagnose → fix → verify playbook.
★ Recently added
PostgreSQL Crash Due to OOM Kill
⚠️ Symptoms All active connections drop simultaneously with no individual query error — clients see disconnect errors (connection reset, FATAL:…
Advisory Lock Leakage — Dangling Locks
⚠️ Symptoms One or more application threads hang at the point where they call pg_advisory_lock — not on a database…
Unused Indexes Consuming Space
Disk usage on a table is far larger than the data warrants; write throughput is lower than expected on a…
Not Null Constraint Add Column Contains Null Values
ALTER TABLE ... ALTER COLUMN ... SET NOT NULL fails with SQLSTATE 23502 and the message "column ... of relation ... contains…
Schema & ConstraintsForeign Key Violation Adding Constraint With Orphans
A schema migration or ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY statement fails with SQLSTATE 23503 and the message "violates foreign…
Schema & ConstraintsRelation Does Not Exist Search Path
An unqualified statement such as SELECT ... FROM orders raises 42P01 relation "orders" does not exist, while the exact same statement works…
Schema & ConstraintsCheck Constraint Add Violated By Some Row
A CREATE/ALTER migration or a hand-run ALTER TABLE ... ADD CONSTRAINT ... CHECK (...) aborts with SQLSTATE 23514 and the message 'check…
Schema & ConstraintsDuplicate Key Creating Unique Index With Duplicate Rows
CREATE UNIQUE INDEX, ALTER TABLE ... ADD CONSTRAINT ... UNIQUE, or ALTER TABLE ... ADD PRIMARY KEY fails with SQLSTATE 23505 and…
Schema & ConstraintsColumn Does Not Exist Quoted Identifier Case
A query that looks obviously correct returns 'column "" does not exist', where the name in the message is the lowercased form…
Schema & ConstraintsExclusion Constraint Conflicts With Existing Rows
Two related failures, both SQLSTATE 23P01. At schema-change time, ALTER TABLE ... ADD CONSTRAINT ... EXCLUDE ... fails with 'could not create…
Read any recipe free. Unlock the executed proof with Pro.
Every recipe gives you the diagnose-fix-verify arc for free. Pro adds the executed verification, catalog audits, and the cloud-provider notes for RDS, Azure & Cloud SQL.
- ✓ The full verification step for every recipe — executed, not described.
- ✓ Catalog & log queries that surface every at-risk object up front.
- ✓ Cross-version gotchas across PostgreSQL 14–18.
- ✓ Exactly where each symptom surfaces on managed Postgres.