General vector index configuration
This document explains how to configure general and advanced settings for a vector index when creating a table to meet the performance, cost, and real-time requirements of your business scenario.
Parameters
During step 4 of table creation, you can configure detailed settings for your vector fields in the Index Schema section.
Vector dimension
Purpose: Defines the number of features in a vector. This value must exactly match the output dimension of your embedding model.
Recommendations:
Ensure consistency: If the configured dimension does not match the dimension of the written vector data, index building will fail.
Performance impact: Higher dimensions allow vectors to represent more information, but they also increase memory usage and computational overhead. Doubling the dimension approximately doubles the memory usage.
Distance type
Purpose: Defines the method for calculating similarity between vectors. Choosing an appropriate distance type is critical to retrieval quality and depends on your data's characteristics and business scenario.
Selection guide:
Distance type
Score description
Typical use cases
Cosine distance
Scores range from
[-1, 1], where higher scores indicate greater similarity. A score of1means the vectors are identical, while-1means they point in opposite directions.Semantic text search and retrieval from RAG knowledge bases. For example, generate text embeddings with models such as text-embedding-v3/v4 and measure semantic similarity based on vector direction. Other use cases include multilingual and cross-language search, document deduplication and clustering of similar questions, and similarity matching between user interests and content tags.
Inner product distance
Higher scores indicate greater similarity.
Recommendation retrieval and ranking. For example, use vector magnitude to represent popularity, click-through rate, or confidence and incorporate it into ranking. Other use cases include two-tower models trained with an inner product objective, such as DSSM, ad and product ranking, and maximum inner product search (MIPS) in vector databases.
Squared Euclidean distance
Lower scores indicate greater similarity. A score of
0means the vectors are identical.Image-to-image search, product image or video frame retrieval, face comparison, and audio fingerprint comparison. This metric is particularly suitable when feature magnitudes have practical meaning and the vectors are not normalized. Other use cases include K-means clustering and anomaly detection, and distance measurement for dense numerical features such as prices and coordinates.
Recommendations:
Choose a distance metric that matches how your embedding model was trained. Cosine is commonly used for text embeddings. Use InnerProduct for models trained with an inner product objective or for use cases that incorporate vector magnitude into ranking.
When both query vectors and indexed vectors are L2-normalized, Cosine and InnerProduct produce the same exact ranking for the same set of candidate vectors. In this case, you can prefer Cosine because its score directly reflects similarity in vector direction.
SquareEuclideanreturns the squared Euclidean distance and produces the same ranking as standard Euclidean distance (L2). To represent greater similarity with a higher score, use1/(1+d)to map the distance to a score in (0, 1], wheredis the returned squared Euclidean distance.The distance metric is part of the index structure and is specified when you create the index. Changing the metric typically requires rebuilding the index and, depending on the data source type, importing the data again. Choose the metric before importing data. For specific configuration details, refer to the field descriptions in the console or API documentation.
Vector index algorithm
Purpose: Selects the underlying algorithm for building the vector index. Different algorithms offer various trade-offs between index building speed, memory usage, query performance, and recall.
Selection guide:
Algorithm
Description
Distance type
Data scale
Recall
Latency
Memory usage
Primary use case
FLAT
(formerly Linear)
Vector scale: Suitable for tens of thousands of vectors.
Scenario: Scenarios that require perfect data accuracy (100% recall).
InnerProduct , SquaredEuclidean, Cosine
Very small (< 10k)
Tens of thousands
100% (Exact)
Very slow
Very low
Benchmarking; exact re-ranking on very small datasets.
HNSW
Vector scale: Suitable for tens of millions of vectors.
Scenario: A high-performance option for use cases with strict requirements for accuracy and low latency.
InnerProduct , SquaredEuclidean, Cosine
Medium (10M+)
Tens of millions
Very high
Low
Very high
High-performance, in-memory online retrieval.
HNSW_RaBitQ
Vector scale: Suitable for billion-scale datasets.
Scenario: Ideal for massive datasets with strict memory constraints where some accuracy trade-off is acceptable.
SquaredEuclidean
Medium/large (100M+)
Hundreds of millions
High
Very low
Very low
Lightweight retrieval optimized with binary quantization.
CagraHNSW
Vector scale: Suitable for hundreds of millions of vectors.
Scenario: A GPU performance powerhouse for graph indexing, often used with multiple GPUs for datasets in the hundreds of millions.
InnerProduct , SquaredEuclidean
Medium/large (100M+)
Hundreds of millions
Very high
Very low (GPU)
Very high
GPU-accelerated search for high-throughput scenarios.
HNSW_SQ
(formerly QGraph)
Vector scale: Suitable for billion-scale datasets.
Scenario: For use cases requiring high query performance and low latency, where accuracy requirements are less strict.
InnerProduct , SquaredEuclidean, Cosine
Medium (100M+)
Billion-scale
High
Low
High
IVF_SQ8
Vector scale: Suitable for hundreds of millions of vectors.
Scenario: A balanced, traditional approach when requirements for accuracy and latency are moderate.
InnerProduct , SquaredEuclidean, Cosine
Large
500-million-scale
Medium to high
Medium
Low
A classic, cost-effective solution for large datasets that uses vector compression to reduce memory usage. Ideal for balancing cost and scale, especially with cold/hot data tiering.
DiskANN
Vector scale: Designed for maximum scale, handling datasets of a billion vectors or more.
Scenario: Uses local disks, making it suitable for scenarios where higher latency is acceptable and memory usage must be minimal.
InnerProduct , SquaredEuclidean, Cosine
Massive (1B+)
Billion-plus
High
Medium to high
Very low
Disk-resident search for ultra-large-scale datasets.
Real-time indexing
Purpose: When enabled, incrementally written data is indexed and becomes searchable within seconds.
How it works: The system first builds a temporary in-memory index for real-time data writes. Once this temporary index reaches a certain size, the system merges its data into the full index on disk.
Recommendations:
Enable (
true): Recommended for online services that require data to be searchable immediately after writing. This option consumes a small amount of additional memory and CPU resources.Disable (
false): Suitable for offline analytics or for data that is not frequently updated after a full import.
Advanced configuration
Linear build threshold
Purpose: When the number of vectors in a shard is below this threshold, the system performs a brute-force search using the
Linear(linear scan) algorithm, even if you configured another vector index algorithm.Recommendations:
Default:
5000. For datasets of this size, a brute-force search often performs as well as or better than a complex index due to lower index building overhead.When to adjust: You typically do not need to change this value. However, if you have very high query concurrency and your data volume is near the threshold, you can lower this value to force the use of a high-performance index like
HNSW. This may increase index building overhead.
Ignore invalid vector data
Purpose: Controls how the system handles invalid vectors (e.g., dimension mismatches or null values) encountered during full or incremental index building.
Recommendations:
Option
Behavior
Recommended use case
trueThe system skips any row with an invalid vector, logs a warning, and continues the index building task.
Development and testing. Allows you to debug quickly by preventing a few bad records from causing the entire build task to fail.
falseIf the system encounters any invalid vector, the index building task fails immediately and returns an error.
Production environment. Enforces data quality and prevents silent data loss. We recommend using this setting with a robust upstream data cleaning pipeline.
Real-time indexing parameters
Purpose: When real-time indexing is enabled, these parameters fine-tune real-time data stream processing.
Parameter example:
{"proxima.oswg.streamer.segment_size":2048}Parameter explanation:
proxima.oswg.streamer.segment_sizecontrols how many real-time records accumulate in memory before flushing them to a small in-memory segment.Tuning recommendations:
High write QPS scenarios: Increase this value (e.g., to
4096) to reduce the number of in-memory segments and lower index management overhead. This slightly increases the write-to-search latency.Low write QPS scenarios: Keep the default value of
2048or decrease it to make newly written data searchable more quickly.
Real-time retrieval parameters
Purpose: Dynamically adjusts the search behavior of the index algorithm at query time to balance recall and latency. The keys and values for this parameter vary depending on the selected vector index algorithm.
General description: These parameters typically control the scope of the search. For example, with the
HNSWalgorithm, theefparameter controls the number of neighbor nodes to traverse during a search. A largerefvalue increases recall but also increases query latency.Configuration example (HNSW):
{"searcher_name":"HNSW", "ef":200}eftypically ranges fromk(the top K results returned by the query) to4096. We recommend starting with100and adjusting it based on your recall and latency requirements.
Vector separator
Purpose: Defines the separator used between dimension values in string-formatted vector data.
Example: For the vector data
1.05,0.15,0.14, the separator is a comma (,), which is the system default. You typically do not need to change this setting.
Write volume control and resource planning
Vector data write volume directly affects data processing memory consumption and query performance. Control the write pace and allocate sufficient resources to prevent increased query latency due to insufficient data processing memory.
Write volume control
Limit batch size: Avoid writing too many documents in a single batch. Split data into smaller batches based on your vector dimension and instance type to prevent sudden spikes in data processing memory usage.
Control write frequency: For high-frequency write scenarios, consider reducing write concurrency or increasing the interval between batches. This provides sufficient time for index building and segment merging.
Monitor data processing memory: If data processing memory usage remains high after writes even when sufficient overall instance memory is available, it indicates high memory overhead from index building or segment merging. In this case, reduce the write rate and wait for merge operations to complete before resuming.
Resource assessment and scaling
If you experience insufficient data processing memory or a noticeable increase in query latency, assess whether your current instance type meets your business requirements.
Use the Specification calculator and enter your business parameters, such as vector dimension, data volume, and QPS, to get a recommended instance type.
If the calculator indicates that your current instance type is insufficient, upgrade the memory and compute resources of your data nodes by changing the instance configuration.