Skip to content

PlanetScale's Insights Agent turns slow queries into pull requests

An agent built into PlanetScale reads your Query Insights data, proposes a fix and opens a pull request in your own code style, using OpenAI and Anthropic models under a zero-retention policy.

Source: PlanetScale

PlanetScale has turned its Query Insights feature into an agent that files pull requests on its own. Insights Agent, announced on 17 November, runs in two modes: schema recommendation runs that check your schema against Query Insights data (rows read versus rows returned, index usage, query run stats), and slow query runs that target one specific slow query for a code-level fix.

Each run happens inside a sandbox that combines your code, your schema and the Insights data, using models from OpenAI and Anthropic under what PlanetScale calls a zero data retention policy, with the sandbox existing only for the run itself. If the agent finds a real fix, it opens a pull request written in your codebase’s own conventions, plus a deploy request if you’re on Vitess. Nothing merges automatically. It is on by default across every plan, engine (Vitess, Neki, Postgres) and host, and an admin can turn it off from Settings, then Overview, then Insights Agent. You can also trigger a run on demand from the app, the CLI or MCP.

Why it matters: this is a hosted database pointing a coding agent at its own query diagnostics and letting it propose the fix, not just the report. If you already use Query Insights to find slow queries, the manual step of turning that into a migration or an index change is what’s being automated here.

The caveat: PlanetScale picks the models and keeps the zero-retention promise to itself. There is no way to swap in your own model for the automatic runs, though the CLI and MCP route exists if you want that control.

Share

Related reading

More from The Wire

All briefs