Execution Plan Analysis — Read What the Engine Actually Chose
Optimize what the engine does, not what the SQL looks like: cost concentration, estimate-vs-actual gaps, and plan warnings — with forensic evidence rules.
Coding Workflows
"Optimize this query" gets generic indexing advice. Pick a goal, a database platform, and an evidence mode — and get an optimization contract: execution-plan thinking, per-platform guidance, justified index recommendations with their write tax, and a forensic mode where generic advice is forbidden and missing evidence becomes a command to gather it.
Which query, slow in what way? E.g. "Find why the order-search query behind GET /orders takes four seconds."
Forensic is the flagship: every conclusion cites evidence, and generic advice is forbidden.
How slow, since when, for which inputs — measured, not felt.
Paste it and the prompt carries it verbatim — the detector also flags SELECT * and non-sargable patterns.
If you have it, the analysis grounds in it. If not, the prompt demands the capture command instead of inventing one.
Optimize what the engine does, not what the SQL looks like: cost concentration, estimate-vs-actual gaps, and plan warnings — with forensic evidence rules.
Map every predicate, join, and sort to the index that serves it — or doesn't. Composite order rules, covering decisions, and the write tax nobody mentions.
EXPLAIN shows type=ALL on a 1.2M-row table: full scan on every search. MySQL optimization with InnoDB clustering realities, version-aware optimizer limits, and covering reads.
An 11-minute report that reads two years of orders to return 24 rows: the rows-read to rows-returned ratio is the target — filters pushed down, pre-aggregation costed honestly.
A five-table join that got slow as data grew: establish cardinality first, check each join strategy against the data shape, and hunt the fan-out doing wasted work.
A real plan with the story inside: estimate says 42 rows, actual is 51,840. PostgreSQL analysis grounded in the plan — stale statistics, bloat, planner costs, and the index arsenal.
Queries that were instant at launch and crawl a year later: scale-aware investigation of work that grows faster than the data, before it owns the server.
"Optimize this query" gets generic indexing advice. The optimization contract demands evidence: real bottlenecks, justified indexes with their write tax, and no invented plans.
At 240M rows and growing: keyset pagination over OFFSET, partition pruning, and the PostgreSQL specifics — analysis aimed at the scale the table will reach, not the scale it passed.
Fast for most customers, 30x slower for the largest two — the parameter sniffing signature. SQL Server tuning with actual plans, clustering-key economics, and CONVERT_IMPLICIT hunting.
Design a schema on its data, not a hunch — model the entities and relationships, set the constraints that protect integrity, plan indexes around real queries, then document the schema and migration.
The full path from idea to a shipped SaaS MVP — define and scope the requirements, design the architecture, API, and data model, then build it reviewed, tested, secured, cost-controlled, and deployed.
The full path to a backend you can put clients on — define the requirements, design the architecture, API contract, data model, and access control, then build it reviewed, tested, secured, and shipped.
The full path to an applicant tracking system — model jobs, candidates, and hiring stages, generate job descriptions and screening prompts, parse résumés into structured data, design the hiring API, set roles, review security, then ship.
The full path to a booking and reservation system — model resources, availability, and reservations, design the booking API, set customer accounts, wire calendar and notification integrations, design the UI, review security, then ship.
The full path to an inventory management system — model products, stock, locations, and movements, design the inventory API, set roles, plan supplier and POS integrations, design the UI, review data-integrity risks, then ship.
The full path to an internal admin panel — model the operational data it manages, design the management API, define RBAC and admin permissions, design the tables and forms, review risky admin actions, then ship to trusted internal users.
The full path to a two-sided platform — define the buyer-and-seller requirements, model the data, design the API, build roles and permissions, wire integrations, design the UI, then test, secure, and ship it.
The full path to a CRM that fits your sales process — define the contacts, deals, and pipeline, model the data that ties them together, then build the roles, integrations, and pipeline UI, and ship.
The full path to a store you own end to end — model the catalog and orders, design the storefront and checkout, add customer accounts and payments, then secure it, test it, and ship.
The full path to a pipeline that moves data without corrupting it — design the ingestion and transforms, extract and structure the sources, gate the quality, store it, then deliver and ship it monitored.
State the optimization objective, pick the goal — Query Speed, Join Optimization, Index Strategy, Large Dataset Scaling, Reporting Query Optimization, or Execution Plan Analysis — and choose the database platform and evidence mode. Each goal is a different optimization philosophy with its own priorities and analysis areas; each platform adds real engine-specific guidance — actual-plan tooling, optimizer quirks, clustered-index realities — not just a label. Then provide what evidence you have: the query (the detector flags SELECT * and non-sargable patterns), the execution plan, tables with row counts, existing indexes, and measured symptoms. What you can't provide changes the contract: no plan means the prompt demands the exact capture command instead of inventing one; no index list means no index may be assumed. Click Generate SQL Optimization Prompt for the full contract — bottleneck analysis, impact-ordered opportunities, justified index recommendations with their write tax, tradeoffs, and an assumptions ledger. Forensic mode adds the rule that defines the tool: generic advice is forbidden. Nothing leaves your browser.
No — it builds the contract. The output is a prompt that instructs an AI how to analyze and optimize your SQL: which philosophy to apply, what platform realities to respect, what evidence to demand, and how to justify every recommendation. The flagship is the evidence discipline — no invented execution plans, no assumed indexes, no assumed row counts, and in Forensic mode, no generic advice at all.
Because it gets generic database advice: "add an index on the WHERE columns, avoid SELECT *" — recommendations that read the same for every query ever written. Real optimization is evidence work: which operator concentrates the cost, what the estimate-vs-actual gap says about statistics, whether the join order matches the cardinalities, what each candidate index taxes on writes. The contract demands exactly that, and forbids the rest.
Same reasoning as frameworks in the Test Case Prompt Generator: the optimization question is identical — only the engine realities differ. SQL Server brings parameter sniffing and clustering-key economics; PostgreSQL brings EXPLAIN (ANALYZE, BUFFERS), bloat, and planner cost settings; MySQL brings InnoDB realities and version-specific optimizer limits. Each platform mode injects that real guidance into the same contract — and the platform-specific search intents live as resources.
Depends on what you know. If you don't yet know where the time goes — could be code, could be network, could be the database — start with the Debugging Prompt Generator's performance investigation: it finds the bottleneck. Once the suspect is a specific query, this tool takes over: query-level analysis is its entire job. In this category's verbs: Debugging investigates, SQL Optimization optimizes.
The contract refuses to fake one. Its non-goals open with "do not invent execution plans" — so instead, the prompt demands the exact capture command for your platform (EXPLAIN (ANALYZE, BUFFERS) on PostgreSQL, the Actual Execution Plan plus SET STATISTICS IO, TIME ON on SQL Server) and marks every plan-dependent conclusion as pending that evidence. In Forensic mode, gathering the missing evidence becomes the first recommendation itself.
Review's SQL language mode judges code that happens to contain SQL — injection risks, readability, obvious anti-patterns — from a reviewer's perspective. This tool owns performance: execution plans, cardinality, join strategy, index economics. The category rule is strict: everything SQL-performance belongs here, which is why the review tool deliberately has no database-review resources.
Only with a pedigree. The contract's index rules: every recommendation must name the exact predicates, joins, or sorts it serves — no index without a clause; composite column order must be justified; covering decisions come with their storage and write cost; and every index states its write tax — which inserts and updates it slows. It also checks existing indexes first: extending a near-miss index beats creating an overlapping new one.