Enforces HNSW index selection over IVFFlat and correct distance operator usage for pgvector.
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Enforces HNSW index selection over IVFFlat and correct distance operator usage for pgvector.
This tile mandates HNSW as the only vector index type and enforces the correct distance operator based on embedding normalization. Normalized embeddings MUST use Inner Product (<#>), which is mathematically equivalent to cosine similarity but faster. IVFFlat indexes are explicitly forbidden.
| Embedding Type | Operator | Operator Class | Notes |
|---|---|---|---|
| Normalized | <#> | vector_ip_ops | Equivalent to cosine, faster |
| Unnormalized | <=> | vector_cosine_ops | Handles variable magnitudes |
| Euclidean (rare) | <-> | vector_l2_ops | Only with explicit approval |
| Table Size | m | ef_construction |
|---|---|---|
| < 1M rows | 16 | 64 |
| >= 1M rows | 24 | 128 |
CREATE INDEX idx_{table}_embedding_hnsw
ON {table}
USING hnsw (embedding vector_ip_ops)
WITH (m = 16, ef_construction = 64);SELECT vector_norm(embedding) FROM {table} LIMIT 5;
-- All values ~1.0 = normalizedvector) extension MUST be enabled.supabase/ivfflat-index -- MUST NOT be installed alongside this tile.