SQL query optimizer
Database performance reviews shouldn't require a $300/hr consultant. Paste your query, pick your dialect, and get specific index DDL plus an optimized rewrite.
About database query optimization
A slow query is almost always a missing index, a function call in a WHERE clause, or a correlated subquery that should have been a JOIN. The Qaynaq Labs SQL Optimizer reviews your query against the quirks of your chosen dialect — PostgreSQL plans differently from MySQL differently from BigQuery — and returns a rewrite plus specific CREATE INDEX statements you can run.
Pasting EXPLAIN output (and rough row counts) makes the analysis cardinality-aware. Without that, the tool reasons structurally — catches anti-patterns reliably, misses cardinality-driven plan choices. For production tuning, combine this tool with your database's real EXPLAIN ANALYZE.
Frequently asked
Will the rewrite always be faster?
Usually, sometimes not. Indexes have write costs, rewrites change semantics in edge cases. The tool flags risk areas — always run EXPLAIN ANALYZE on both versions before deploying.
Do you support every SQL dialect?
Currently: PostgreSQL, MySQL, SQLite, MS SQL Server, Oracle, BigQuery, Snowflake. Each dialect's plan semantics are accounted for — pick yours in the dropdown.
What about ORM-generated queries?
Paste the generated SQL (most ORMs log it). The advice applies — though the cleanest fix is often back at the ORM call (eager-loading, projection).
Will it suggest indexes I shouldn't add?
Index suggestions include a write-cost estimate so you can weigh the tradeoff. The tool errs toward fewer, targeted indexes rather than indexing every column.