Postgres Index Tuning

Diagnose a slow Postgres query and add the right index using EXPLAIN ANALYZE.

alexngai Updated
skill-tree CLI — list, search, read, and fork versioned agent skills

File contents

Postgres Index Tuning

  1. Run EXPLAIN (ANALYZE, BUFFERS) on the slow query; look for Seq Scan on large tables.
  2. Identify the filtered/joined columns driving the scan.
  3. Add a targeted index (CREATE INDEX CONCURRENTLY in production to avoid locks).
  4. Re-run EXPLAIN ANALYZE and confirm the planner switched to an Index Scan.
  5. Drop indexes that never appear in pg_stat_user_indexes — they only slow writes.

alexngai/skill-tree commit bd9656838e

Frequently asked questions

npx get-skill add alexngai/postgres-index-tuning