Add the index the slow-query log keeps asking for
An index the slow-query log has been recommending for months, added with the plan captured either side.
The ticket
Add the index a slow query needs and record the plan before and after.
Acceptance criteria
- The query plan is captured before and after
- The index is created without locking the table for an unacceptable time
- Write-path impact is considered and stated
- No redundant index is added that an existing one already covers
What lands as proof
Two query plans showing the scan replaced by an index lookup, on production-like data volumes.
Why teams defer it
- Creating an index on a large table can lock it, so it needs a maintenance window or an online build.
- Indexes cost write throughput, and nobody wants to be the one who slowed down inserts.
Questions
- What does the agent actually change?
- The ticket is scoped to one outcome: add the index a slow query needs and record the plan before and after. Work that serves that outcome is in scope, and anything outside it is left for a separate ticket, so the pull request stays reviewable.
- How do I know the work is done?
- The pull request carries the evidence, not only the diff. Here that means query plan before and after, pasted into the pull request, so a reviewer can confirm the result without reproducing the work locally.
- How much oversight does this need?
- The run stops once the plan is written. Somebody reads the approach and approves it before any code exists, which is the cheapest moment to redirect the work.