Postgres Index Tuning
- Run
EXPLAIN (ANALYZE, BUFFERS)on the slow query; look forSeq Scanon large tables. - Identify the filtered/joined columns driving the scan.
- Add a targeted index (
CREATE INDEX CONCURRENTLYin production to avoid locks). - Re-run
EXPLAIN ANALYZEand confirm the planner switched to anIndex Scan. - Drop indexes that never appear in
pg_stat_user_indexes— they only slow writes.