SQL Index Advisor
Paste a SQL SELECT query and get CREATE INDEX suggestions. The advisor analyzes WHERE, JOIN ON, and ORDER BY clauses to recommend single-column and composite indexes.
Frequently Asked Questions
How does this tool suggest indexes?▼
The advisor parses your SELECT query and identifies columns used in WHERE clauses (equality, range, LIKE), JOIN ON conditions, and ORDER BY clauses. It suggests single-column indexes for individual conditions, composite indexes when multiple columns on the same table appear in WHERE, and notes ORDER BY columns that benefit from indexing.
What is a composite index and when should I use it?▼
A composite index covers multiple columns in a defined order. Use it when your WHERE clause filters on multiple columns from the same table — the database can use one composite index instead of scanning separate single-column indexes. The most selective column (smallest cardinality) should typically come first, with range columns last.
Why should I index foreign key columns?▼
Foreign key columns used in JOIN ON conditions cause full table scans if unindexed — the database must scan every row of the joined table to find matches. An index on the foreign key column turns this into an index lookup, reducing JOIN cost from O(n) to O(log n).
What is the cardinality rule for composite indexes?▼
Put higher-cardinality columns (more unique values) first in composite indexes. For example, if filtering by country (low cardinality, ~250 values) and user_id (high cardinality, millions of values), the index should be (user_id, country) for queries that filter on user_id, or (country, user_id) for queries filtering on country first.
How many indexes is too many?▼
Every index adds overhead to INSERT, UPDATE, and DELETE operations because the database must update all indexes on write. As a rough guideline, 3–5 indexes per table is a reasonable range for OLTP workloads. Profile actual query performance with EXPLAIN ANALYZE before adding indexes in production.
Does this tool send my SQL to a server?▼
No. All analysis runs entirely in your browser using JavaScript. Your SQL never leaves your machine.
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 →DevToolkit Starter Kit
A ready-to-deploy developer tools website with 12 built-in tools. Astro + Preact + Tailwind. Deploy to Cloudflare Pages for free. Built-in SEO, dark mode, and ad-ready layout.
Buy on Gumroad →TypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
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.
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.
Database Performance Tuning Guide: Query Optimization, Indexing, Connection Pooling
Complete database performance tuning guide: EXPLAIN ANALYZE, index strategies (B-tree, partial, composite), query optimization, connection pooling with pgBouncer, N+1 problem solutions.
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.
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.
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 →