Audit Your Database Indexes Against How the App Actually Queries It
Tap any variable to replace it with your own value:
AI prompt
Audit a database's indexes against how the application actually queries it, not against generic best practices. I'll paste the table's current indexes: [paste index list/DDL] and the actual queries the app runs against it: [paste 3-6 representative real queries, ideally including any slow ones]. Produce: (1) which existing indexes are actually being used by these queries and which look unused or redundant (two indexes covering overlapping column sets, for instance); (2) which of the pasted queries has no supporting index at all and would benefit from a new one, with the exact index definition to add; (3) a warning on any index that helps reads but is expensive on writes, given how often this table gets written to: [describe write frequency]; (4) a specific, ordered list of what to add and what to consider dropping, not a generic 'index your foreign keys' lecture. If the queries given don't show enough to judge an index confidently, say so rather than guessing.
Related prompts
- Diagnose Why a Specific Query Got Slow as a Table Grew
Diagnose why one slow query degraded as data grew and what to change.
- Get a senior-engineer critique of your database schema before you commit to it
Catch schema issues early before they turn into indexing pain later.
- Plan a Zero-Downtime Migration Between Two Database Schemas
Plan safe schema changes when new indexes need wider table changes.
- Turn a vague performance complaint into a specific bottleneck to fix
Narrow a vague slowdown into the exact queries worth indexing first.
- Catch performance bottlenecks in code before they hit production
Find code paths that create costly query patterns before tuning indexes.
- Prioritize your technical debt list by what's actually costing you time
Rank database fixes by the time and pain they actually save.