← back to flaviocopes.com

Database index advisor

← All tools

Describe how you filter, join, and sort — get a suggested index and a plain-English explanation of column order. Educational heuristics, not a replacement for EXPLAIN.

~~~

Query pattern

Comma-separated. Suffix each column withetc.

Small SELECT lists may get a covering-index suggestion.

Under ~1k rows, seq scans are often fine.

~~~

Suggested index

Column order cheat sheet

PositionPut hereWhy
1Equality (=) columnsNarrows the row set fastest — use highest-selectivity columns first when possible.
2One range columnB-tree indexes support one range scan per index; put BETWEEN / > / < here.
3ORDER BY columnsLets the index return rows already sorted — avoids an extra sort step.

Form choices are saved in the URL (short fields only). Rule-based heuristics — always verify with EXPLAIN on your database.

~~~

About this tool

Indexes speed up reads but cost writes and disk space. This advisor applies textbook B-tree ordering: equality columns first, then one range column, then sort columns. It flags low-cardinality fields, tiny tables, and write-heavy tradeoffs.

It is not a query planner. Run EXPLAIN (ANALYZE, BUFFERS) on Postgres, or your engine's equivalent, with production-like data before you ship an index to production.

~~~

Read more