Database Index Advisor Skill for PostgreSQL Query Plans
Review query predicates in Claude Code, test a multicolumn index locally, and compare execution plans and buffer use.
中文Install in Claude Code
Use psql, a disposable PostgreSQL database, and a synthetic orders table. Real workload analysis also needs approved read-only statistics access and representative data.
- Get the complete `plugins/database/database-index-advisor/skills/analyzing-database-indexes` directory from the pinned GitHub commit.
- Copy it into the target project's `.claude/skills/`. Check `.claude/skills/analyzing-database-indexes/SKILL.md`, start Claude Code at the project root, and call `/analyzing-database-indexes`.
Example task
Spread 100,000 orders across 100 customers and 100 dates. Capture EXPLAIN (ANALYZE, BUFFERS) for customer 17 in the final week. Add (customer_id, created_at), analyze the table, and rerun the same query.What to check
Record scan nodes, rows, and buffers for both plans. Preserve a sequential plan if selected and investigate the measured selectivity.
Original SKILL.md on GitHub · Updated
Frequently asked question
Does a sequential scan always require an index?
Assess the matching fraction, table size, frequency, and write cost. A sequential scan can be appropriate for a small table or broad predicate.