SQL Query Analyzer
Find expensive SQL patterns, missing filters and index opportunities.
SQL query
Static analysis only — the query is never executed and never leaves your browser.
Analysis
Tables: orders, customers, order_items
- warningSELECT * returns every column
Wildcard projections read and transfer columns the application may never use, and they break silently when the table changes.
→ List only the columns you need: SELECT id, name, created_at …
- warningLeading-wildcard LIKE
A pattern that starts with % cannot use a B-tree index, so it forces a full scan.
→ Anchor the pattern (LIKE 'abc%'), or use a full-text / trigram index.
- warningFunction applied to a filtered column
Wrapping a column in a function makes the predicate non-sargable, so the index on that column is ignored.
→ Rewrite the predicate (e.g. col >= '2026-01-01' AND col < '2026-02-01') or add a functional/expression index.
- infoORDER BY without LIMIT
Sorting the full result set costs memory and may spill to disk.
→ Add LIMIT/OFFSET, or sort in the application when the set is small.
- warningLarge OFFSET pagination
OFFSET N still reads and discards N rows on every page.
→ Use keyset pagination: WHERE id > :last_id ORDER BY id LIMIT :n.
Suggested indexes
CREATE INDEX idx_o_status ON o (status);
CREATE INDEX idx_c_id ON c (id);
CREATE INDEX idx_o_customer_id ON o (customer_id);
CREATE INDEX idx_i_order_id ON i (order_id);
CREATE INDEX idx_o_id ON o (id);Hints are derived from WHERE, ON and ORDER BY columns — verify against your real cardinality and existing indexes.
About the SQL Query Analyzer
Paste a SQL statement to get a static review: SELECT *, missing WHERE clauses, UPDATE/DELETE without filters, leading-wildcard LIKE, non-sargable functions on filtered columns, NOT IN subqueries, implicit cross joins, joins without ON, deep OFFSET pagination, UNION versus UNION ALL and more — plus a cost estimate and ready-to-run CREATE INDEX suggestions.
Examples
Wildcard select
SELECT * FROM ordersOutput
Warning: SELECT * and no WHERE clauseKeyboard shortcuts
- Copy the main outputCtrl / ⌘ + Shift + C
- Download the resultCtrl / ⌘ + S
- Share this toolCtrl / ⌘ + Shift + S
- Reset the inputsAlt + R
- Open the tool search paletteCtrl / ⌘ + K
Related tools
SQL Formatter
Dev Utilities
Format and indent SQL queries for readability.
SQL Playground & Query Runner
Dev Utilities
Write schema and seed SQL, then run queries against an in-memory database.
SQLite Database Viewer & Query Runner
Dev Utilities
Open a .sqlite/.db file in your browser and run SQL against it.
.htaccess Redirect Generator
Dev Utilities
Generate Apache .htaccess redirect and rewrite rules.
Bash Alias Generator
Dev Utilities
Create shell aliases for Bash, Zsh or Fish with correct quoting.
Chmod Calculator
Dev Utilities
Unix permission calculator: checkboxes, octal, and symbolic.
Frequently asked questions
Version 1.0.0 · Updated 2026-08-17 · Runs entirely in your browser