Database Topic Archive

Indexes Articles

Index design, index debt, reindexing, constraint indexes, and evidence-driven DDL.

Unindexed Foreign Keys in PostgreSQL: The Seq Scan Inside Your DELETE
8 min read

Deleting one tenant row took forty-five minutes because a foreign key trigger was sequentially scanning a 90-million-row events table — inside the deleting transaction, while the lock queue grew behind it. The detection query, the rollback-safe EXPLAIN trick, and the…

PostgreSQL Index-Only Scans and the Visibility Map
7 min read

An index-only scan is only index-only when the visibility map says the heap page is all-visible. How to read Heap Fetches in EXPLAIN, build covering indexes with INCLUDE, and keep vacuum honest.