- Control index build performance and memory usage
- Tune accuracy vs performance trade-offs
- Configure storage layout and compression
- Enable Matryoshka embedding support
Samples
Memory-optimized storage with custom neighbors
Plain storage for maximum accuracy
Matryoshka embeddings
High-accuracy build configuration
Build performance considerations
Index builds can be memory-intensive. To improve build performance:maintenance_work_mem is typically 64MB, which may be too low for building indexes on large datasets.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
storage_layout | text | memory_optimized | Storage format: memory_optimized uses Statistical Binary Quantization; plain stores uncompressed vectors |
num_neighbors | int | 50 | Maximum number of neighbors per node. Higher values increase accuracy but slow graph traversal |
search_list_size | int | 100 | Search list size during construction (S parameter). Higher values improve graph quality at the cost of slower builds |
max_alpha | float | 1.2 | Alpha parameter in the DiskANN algorithm. Higher values improve graph quality but slow index builds |
num_dimensions | int | 0 (all dimensions) | Number of dimensions to index. Enables Matryoshka embeddings by indexing fewer dimensions |
num_bits_per_dimension | int | 2 (if less than 900 dims), 1 otherwise | Bits per dimension for Statistical Binary Quantization encoding |
storage_layout
Controls how vector data is stored:- memory_optimized (default): Uses Statistical Binary Quantization (SBQ) developed by researchers to compress vectors. Provides excellent performance with reduced memory footprint.
- plain: Stores vectors uncompressed. Uses more memory but may provide slightly higher accuracy. Required for certain distance operators.
num_neighbors
The maximum number of neighbors per node in the graph. This is a key parameter for balancing accuracy and performance:- Lower values (20-50): Faster queries, lower memory, slightly reduced accuracy
- Higher values (50-100): Better accuracy, slower queries, more memory
search_list_size
The size of the candidate list during graph construction (S parameter in DiskANN). Affects index build quality:- Lower values (50-100): Faster index builds, slightly lower quality
- Higher values (100-200): Slower builds, higher quality graph structure
max_alpha
The alpha parameter controls pruning during graph construction:- Lower values (1.0-1.2): More aggressive pruning, faster builds
- Higher values (1.2-2.0): Less aggressive pruning, higher quality graph
num_dimensions
Enables Matryoshka embedding support by indexing only the first N dimensions:- 0 (default): Index all dimensions
- Positive integer: Index only first N dimensions
num_bits_per_dimension
Controls the precision of Statistical Binary Quantization:- 1 bit: Maximum compression, fastest queries, lower accuracy
- 2 bits: Balanced compression and accuracy (default for <900 dimensions)