01Overview
QueryLens parses Postgres and MySQL plans into a typed IR, runs a suite of rule-based heuristics, and feeds the residue into an LLM with strict tool-use constraints to suggest changes.
Every suggestion comes with a synthetic-load benchmark you can run against a shadow database before merging.
02The Problem
Backend engineers were chasing slow queries with vibes. Index decisions were lore, not data.
03Approach
- Wrote plan-tree parsers in Rust with a typed intermediate representation.
- Rule engine for the boring 80% of issues; LLM only for ambiguous joins and creative rewrites.
- Shadow-database benchmark harness using pg_dump-derived synthetic loads.
04Outcome
Adopted by three teams, removed 17 footgun queries in the first month.
Cut average query latency on the largest table by 4.2x.