Senior AI Dev Kit
Back to the catalog

subagent

SQL query optimizer

sql-query-optimizer

Scans .sql files and SQL inside application code, reads the plan and rewrites the slow queries.

When to use it

Run it when queries are slow or costly.

Technical description

Specialized subagent for finding and optimizing slow SQL — scans directories of .sql files and SQL embedded in application code, diagnoses BigQuery query plans (shuffle, skew, partition pruning) or traditional EXPLAIN plans, and rewrites queries with the reasoning behind each change. Use when asked to optimize a query, audit a codebase's SQL, or investigate why a query is slow/expensive.