Slow query fixer
Give it a slow SQL query. Get the cause found and a faster version with indexes where needed.
Slow query fixer is a free AI skill for the job "Test and fix code". Give the instructions to an AI assistant that supports the required files and tools, then review its output.
Free · No account · MIT licence · Made by Burhan Sebin · Level: advanced · Thinking: high
Made by Burhan Sebin. See the original on GitHub; we copied it as it is, with its licence.
What it does
A slow SQL query turned into a fast one, with the reason it was slow explained. You paste the query, or a slow log line, and the skill reads the database's execution plan to find the cause. It looks for full table scans, joins that repeat too much work, sorts that spill and filters that cannot use an index. Then it applies fixes: new indexes for the columns in your WHERE, JOIN and ORDER BY, subqueries rewritten as joins, SELECT * narrowed to the columns you need, and limits added where they make sense. It also tunes common ORM habits that generate bad SQL. It runs the plan again to confirm the gain. Works with PostgreSQL and MySQL.
You give it
- The slow query
- The execution plan (optional)
- Table sizes and how often it runs
- Your database type, like PostgreSQL or MySQL
- Your question (optional)
You get
- The cause of the slowdown
- A rewritten query
- Index statements to add
- A before and after plan comparison
Use it when
- A report query takes minutes and used to take seconds.
- Your database CPU spikes on one page load.
- Your ORM builds a query you cannot read.
- You have an EXPLAIN plan and cannot tell what is wrong.
How to use it
- Add it to your AI once: download it and add the folder to Claude, ChatGPT or Codex as a skill.
- Ask for the job in your own words. Your AI opens the skill when it fits.
- It works best when your AI can run code and reach your database.