SQL Performance
Analyze queries and indexes to reduce latency and cost.
Overview
Review a representative query, schema, and plan before proposing an optimization. Explain which observation supports each change. Prefer read-only EXPLAIN; executing a query with ANALYZE requires separate approval.
Referenced source
PostgreSQLUsing EXPLAINDraft. Independent runtime review pending.
Reference linked; draft instructions are original.
0.1.0, pinned in this draft.
Explicit permissions and limits below.
Claude Code, Codex, Cursor
Read supplied schema and plans. No production queries, index creation, or EXPLAIN ANALYZE without approval.
Capabilities
- Identify expensive scans, joins, and sorts
- Compare estimates with supplied measurements
- Review predicate selectivity and index coverage
- Spot unbounded result sets and repeated queries
- Propose a measured validation plan
- Explain write overhead and index trade-offs
How it works
- Ask for a redacted query, schema, and representative plan.
- Locate the dominant cost and verify relevant assumptions.
- Propose the smallest supported query or index change.
- Describe the experiment and rollback; do not apply it automatically.
This is an original Reporadars draft, informed by the linked source. Compatibility has not been independently runtime-tested; inspect the instructions, permissions, and placement for your agent before use.
