SQL Index Advisor
Paste a SQL query and (optionally) your table DDL; get column-ordered index recommendations with CREATE INDEX statements. Parses WHERE, JOIN, ORDER BY, and GROUP BY clauses; applies equality-before-range column ordering; detects redundant/overlapping existing indexes; warns about write-amplification, low-selectivity columns, and leading-wildcard LIKE. 100% client-side — no DB required.
About SQL Index Advisor
Paste a SQL query and (optionally) your table DDL; get column-ordered index recommendations with CREATE INDEX statements. Parses WHERE, JOIN, ORDER BY, and GROUP BY clauses; applies equality-before-range column ordering; detects redundant/overlapping existing indexes; warns about write-amplification, low-selectivity columns, and leading-wildcard LIKE. 100% client-side — no DB required. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
How does the index advisor decide which columns to recommend?
We parse the query's WHERE, JOIN ON, ORDER BY, and GROUP BY clauses. Equality predicates (=, IN) on indexed columns become leading columns; range predicates (<, >, BETWEEN, LIKE prefix) become trailing columns; ORDER BY / GROUP BY columns become trailing keys. We then group per-table and emit composite CREATE INDEX statements in the correct column order. The result is the same heuristic a senior DBA would apply.
Why equality columns before range columns?
A B-tree index can be used for both equality and range lookups, but only if equality columns come first. With idx(a, b) and `WHERE a = 1 AND b > 5`, the index first narrows to a=1 then scans b>5. With idx(b, a) the same query can only use the index for the b>5 range, then must re-check a=1 on every row. Equality-first ordering maximizes index selectivity.
Does the advisor consider my existing indexes?
Yes — paste your DDL (CREATE TABLE + CREATE INDEX statements) alongside the query. We parse existing indexes and flag recommendations that are redundant (already covered) or overlapping (a longer existing index already serves the query). We also identify covering-index opportunities (INCLUDE columns) when the SELECT list is small enough to fit.
What edge cases does the advisor handle?
Leading-wildcard LIKE (`%foo`) cannot use a B-tree index — we flag it and suggest a trigram/GIN index (Postgres) or full-text. Functions on columns (`LOWER(name) = 'foo'`) need an expression index — we suggest one. OR clauses and low-selectivity columns (booleans, gender) trigger a caveat that an index may not help. We never recommend without explaining the trade-off.
Are my queries or schema uploaded to a server?
Never. Parsing, index design, and CREATE INDEX generation all run in your browser. History (last 20 analyses) is stored in localStorage on this device only. The shareable URL encodes only options in the fragment. There's an honest banner: 'Heuristic advice — validate with EXPLAIN on real data (use the EXPLAIN Plan Visualizer, #271).'
Related tools
.bashrc / .zshrc Alias & Config Manager
Build shell aliases, functions, exports, and PATH edits in a visual editor, then export a clean, commented .aliases file sourced from both .bashrc and .zshrc — with shadowing detection against shell builtins and common CLI tools, function suggestions when args are needed, starter packs (git, docker, kubectl, navigation, safety, ls, dev, devops, data science), import of existing rc files, dedupe, history (localStorage), and shareable URL. 100% client-side.
Add / Subtract Date Calculator
Add or subtract years, months, weeks, days, hours, minutes and seconds from a starting date/time. Calendar-day or business-day mode with custom weekend + holiday list. Month-end policy toggle (clamp to last day vs overflow). Repeat/series mode (e.g. every 2 weeks x 10) with CSV export. Shareable URL. 100% client-side.
Age Calculator
Calculate exact age from a birth date in calendar years/months/days (no negative-day bugs) plus totals in months/weeks/days/hours/minutes/seconds. Next-birthday countdown with weekday. Feb-29 birthday policy toggle. Milestones (1,000 days, 10,000 days, 1 billion seconds). Zodiac sign + Chinese zodiac. Age gap comparison. Shareable URL. 100% client-side.