Index planner & SQL generator
Describe the vectors you are storing and this tool generates the correct CREATE INDEX statement, the matching distance operator and operator class, a storage estimate, recommended query tuning values, and warnings when your dimensions exceed the index limits. Everything runs in your browser — nothing you type is sent anywhere.
Recommendations
Generated SQL
What this plan means
Adjust the inputs on the left to generate a plan.
How the recommendations are derived
The tool applies documented pgvector rules and defaults; it does not guess. The exact figures come from the project's own guidance.
Index parameters
- IVFFlat lists: start with
rows / 1000for up to 1 million rows, andsqrt(rows)above that. - IVFFlat probes: start at
sqrt(lists)and increase for recall. - HNSW defaults:
m = 16andef_construction = 64. - HNSW query default:
hnsw.ef_search = 40; raise it for better recall at the cost of speed. - Iterative scans: enable
hnsw.iterative_scanorivfflat.iterative_scanwhen a query filters results.
Storage estimate
Per-row bytes, multiplied by the row count. The index and TOAST overhead are excluded.
| Type | Bytes per row |
|---|---|
vector | 4 * dimensions + 8 |
halfvec | 2 * dimensions + 8 |
bit | dimensions / 8 + 8 |
sparsevec | 8 * non-zero elements + 16 |
vector, 4,000 for halfvec, 64,000 for bit, and 1,000 non-zero elements for sparsevec. When you exceed a limit the tool suggests half-precision indexing, binary quantization, subvector indexing, or dimensionality reduction. See indexing for details.After you run it
- Enable the extension once per database (see the install guide):
CREATE EXTENSION vector;. - Load your data first. Use
COPYfor bulk loads, then add indexes — especially IVFFlat, which needs data to train. - Create the index. In production, use
CREATE INDEX CONCURRENTLYto avoid blocking writes, and raisemaintenance_work_memso an HNSW graph fits in memory. - Tune the query. Set
hnsw.ef_searchorivfflat.probesper query withSET LOCALinside a transaction when you need different recall. - Verify the plan. Run
EXPLAIN (ANALYZE, BUFFERS)and confirm the index is used, not a sequential scan. - Measure recall. Compare approximate results with exact results by disabling index scans for one query, and raise
ef_searchorprobesif recall is too low.
About this tool
Is my data uploaded anywhere?
No. The index planner runs entirely in your browser using JavaScript, and nothing you type is transmitted to a server. You do not need an account. The site uses Google Analytics to measure aggregate traffic, but it never receives the values you enter here — see the privacy statement.
How are the IVFFlat list and probe values chosen?
The tool uses pgvector's own guidance: start with rows / 1000 lists for up to 1 million rows and sqrt(rows) above that, then start probing at sqrt(lists). Increase probes for better recall at the cost of speed.
Why does it warn that my dimensions are too high?
Approximate indexes have dimension limits: 2,000 for vector, 4,000 for halfvec, 64,000 for bit, and 1,000 non-zero elements for sparsevec. The tool suggests half-precision indexing, binary quantization, subvector indexing, or dimensionality reduction when you exceed them.
Does the tool cover every pgvector feature?
No. It focuses on choosing an index, generating the CREATE INDEX statement, and picking tuning values. For data types, operators, functions, filtering, and hybrid search, see the documentation and the cheatsheet.