SQL Index Advisor
Paste a SELECT query with WHERE, JOIN, or ORDER BY clauses.
The advisor detects which columns need indexes, suggests the index type, and generates CREATE INDEX SQL.
Runs entirely in your browser — nothing is sent to a server.
EXPLAIN ANALYZE (PostgreSQL) or EXPLAIN FORMAT=JSON (MySQL) on your query to verify the index is being used and check actual vs estimated row counts.
Frequently Asked Questions
How does the index advisor parse my query?▼
The advisor uses regex-based pattern matching to extract tables and aliases from the FROM/JOIN clauses, columns from WHERE conditions, JOIN ON predicates, and ORDER BY expressions. It then classifies each column reference and generates CREATE INDEX recommendations. It handles common SQL patterns but is not a full SQL parser — very complex subqueries or CTEs may not be fully analysed.
When should I use a composite index vs a single-column index?▼
Use a composite index when your query consistently filters on multiple columns from the same table together (e.g., WHERE status = 'active' AND created_at > ?). Put equality columns first, range columns last. A single-column index is better when a column is frequently queried alone across many different queries.
What is index selectivity and why does it matter?▼
Selectivity measures how many distinct values a column has relative to total rows. High selectivity (e.g., user_id, email) means an index narrows down results to very few rows — excellent candidates for indexing. Low selectivity (e.g., status with only 3 values, boolean flags) means an index still returns a large fraction of the table — often not worth the overhead. The advisor flags low-selectivity columns with a warning.
When should I use a Hash index instead of B-tree?▼
Hash indexes are only useful for equality lookups (col = ?). They cannot handle range queries (col > ?, col BETWEEN), sorting, or partial matches. In PostgreSQL, Hash indexes are rarely worth it since B-tree handles equality just as fast in practice. MySQL's InnoDB does not support explicit Hash indexes on disk — only in the adaptive hash index buffer. Use Hash only when you have a very specific equality-only access pattern on a memory-based table.
Will adding more indexes always improve performance?▼
No. Every index you add slows down INSERT, UPDATE, and DELETE operations because the index must be maintained on every write. Indexes also consume disk space and memory. Only add indexes that serve actual query patterns observed in production. Use EXPLAIN ANALYZE to verify an index is being used before adding it permanently.
Does this tool send my SQL to a server?▼
No. All analysis runs entirely in your browser using JavaScript. Your query text is never sent to any server.
Related Products
on GumroadDeveloper Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →You Might Also Need
SQL Formatter & Beautifier
Format and beautify SQL queries online. Auto-indent SELECT, FROM, WHERE, JOIN clauses, uppercase keywords, and minify SQL to a single line. Supports MySQL, PostgreSQL, SQLite. Free, runs in browser —
Open free tool →
SQL Query Formatter
Format and prettify SQL queries online. Auto-indent SELECT, FROM, WHERE, JOIN clauses, uppercase or lowercase keywords, configurable indent size. Supports MySQL, PostgreSQL, SQLite. Runs in browser.
Open free tool →
SQL Query Formatter Pro
Advanced SQL formatter with MySQL, PostgreSQL, and SQLite dialect support. Syntax highlighting, configurable indent size and keyword case. Free, runs in your browser.
Open free tool →
More Free Tools
Related Articles
Database Indexing Strategies Every Developer Must Know
Master database indexing in 2026. Learn B-tree, hash, composite, partial, and covering indexes with practical SQL examples for PostgreSQL and MySQL.
SQL Best Practices for Modern Development in 2026
Essential SQL best practices every developer should follow in 2026. Covers query optimization, indexing strategies, security patterns, and database design principles for PostgreSQL, MySQL, and SQLite.
PostgreSQL Performance Tuning: Indexing Strategies Every Developer Should Know
Master PostgreSQL indexing in 2026: EXPLAIN ANALYZE, B-tree vs GIN vs GiST indexes, partial indexes, covering indexes, and real-world optimization patterns. With code examples and query plans.
SQLite vs PostgreSQL vs MySQL: Database Selection Guide 2026
A comprehensive technical comparison of SQLite, PostgreSQL, and MySQL for 2026 — covering ACID compliance, performance benchmarks, JSON support, replication, and which database to choose for your use case.
PostgreSQL Performance Tuning: The Complete 2026 Guide
Master PostgreSQL performance tuning with this comprehensive guide. Learn about query planning, indexing, configuration tuning, VACUUM strategies, connection pooling, and monitoring for high-throughput production workloads.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →