# Postgres Index Tuning

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

- Skill: `alexngai/postgres-index-tuning` (Agent Skill)
- Install (CLI): `npx skillmds@latest add alexngai/postgres-index-tuning`
- Raw SKILL.md: https://api.skillmd.com/api/skills/alexngai/postgres-index-tuning/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: alexngai (https://skillmd.com/u/alexngai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/alexngai/postgres-index-tuning

---


# 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.

