Fix a top cause of slow queries in PostgreSQL (no slow query log needed)
How-to 7 min +70 XP
PostgreSQL automatically indexes primary keys and UNIQUE columns but not the referencing column of a foreign key, so lookups on that side and ON DELETE CASCADE / SET NULL triggers fall back to full table scans.