Improve query speed.
A query that ran fine on a thousand rows can crawl on a million, and the fix is almost never obvious from staring at the SQL. The bottleneck is usually a missing index or a full table scan hiding behind a subquery, but spotting it means reading the query plan, knowing which columns to index, and rewriting the logic without changing the result. Most teams either guess or wait for the one database expert to have a free afternoon. This blueprint builds a tool that does the reading for you.
A SQL query analyzer. You paste in a query and it flags the performance bottlenecks, points to the specific indexes worth adding, and rewrites the query using CTEs, common table expressions, so the logic reads top to bottom instead of nesting subqueries three deep. You get back the concrete index list and a cleaner version of the query that returns the same rows.
You watch it happen in the task workspace: the agent scaffolds the tool, wires the analysis and rewrite logic, and runs a sample query through it to confirm the output before handing you a live preview. The code lands on a branch in your repository with a pull request ready.
The first version handles a single query and you steer it from there with plain follow-up messages:
Each follow-up wakes the same repository and the agent continues on its own code.
Does it connect to my database? Not by default; it analyzes the SQL text you paste. Ask it to connect and it can pull real query plans and table stats.
Which SQL dialect does it assume? It works with standard SQL out of the box; tell it you're on Postgres, MySQL, or another engine and it tailors the index and CTE suggestions.
Will the rewritten query return the same results? Yes, the CTE rewrite restructures for readability, not behavior; the goal is the same rows, faster and easier to read.