Cut slow queries and bulk loads
Use The Index, Luke sells a book and training on fast SQL. This playbook works on your own code and does not ask you to buy anything.
Screens open in seconds, saving every teammate time daily.
The number it moves
Time to finish the job
Minutes a teammate takes to complete the task the tool exists for.
What your AI does
Find list and dashboard queries. Look for selects of all rows without limit, N+1 queries inside loops, and missing indexes on filtered columns. Propose pagination and one batched query for the worst offender, with before and after timing.
Done when
- Lists load a page at a time
- No query runs inside a loop
- Filtered columns have an index
The prompt
Paste this into any AI coding tool, or run it in MightyMouse and your AI works on your own project.
Cut slow queries and bulk loads (Internal tool) Find list and dashboard queries. Look for selects of all rows without limit, N+1 queries inside loops, and missing indexes on filtered columns. Propose pagination and one batched query for the worst offender, with before and after timing. Done when: - Lists load a page at a time - No query runs inside a loop - Filtered columns have an index Read the code first. If it already does this well, change nothing and say so. Otherwise make the smallest change that makes every line above true. Work with what this project already uses. Do not add a paid tool or service unless I ask for one. Playbook: https://getmightymouse.com/playbooks/internal-cut-slow-queries-and-bulk-loads/ - published by MightyMouse. Source: Use The Index, Luke, https://use-the-index-luke.com/no-offset
The skill file
Save this as SKILL.md and Claude Code or Cursor can run the playbook any time you ask.
--- name: internal-cut-slow-queries-and-bulk-loads description: Screens open in seconds, saving every teammate time daily. Use on a internal tool project to improve "Time to finish the job". --- # Cut slow queries and bulk loads Find list and dashboard queries. Look for selects of all rows without limit, N+1 queries inside loops, and missing indexes on filtered columns. Propose pagination and one batched query for the worst offender, with before and after timing. ## Done when - [ ] Lists load a page at a time - [ ] No query runs inside a loop - [ ] Filtered columns have an index ## How to run it Read the code first and tick every line that is already true. If all are true, change nothing and say so. Otherwise make the smallest change that makes the rest true, then report each line as done or not done. Work with what this project already uses. Do not add a paid tool or service unless I ask for one. Playbook: https://getmightymouse.com/playbooks/internal-cut-slow-queries-and-bulk-loads/ - published by MightyMouse. Source: Use The Index, Luke, https://use-the-index-luke.com/no-offset