Tune vector index
tune_vector_indexRecommends optimal ivfflat or hnsw index configuration for a pgvector column by analyzing live row count and dimension, outputting parameters and a ready-to-run CREATE INDEX statement.
Instructions
Recommend an ivfflat or hnsw configuration for a pgvector column. Reads the live row count and column dimension, applies the standard pgvector heuristics, and returns the parameters plus a ready-to-run CREATE INDEX statement. Requires the vector extension.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| column | Yes | ||
| metric | No | l2 | |
| schema | Yes | ||
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. | |
| index_type | No | hnsw |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dimension | Yes | ||
| rationale | Yes | ||
| row_count | Yes | ||
| index_type | Yes | ||
| parameters | Yes | ||
| create_index_sql | Yes |