Overview
This topic describes the vector index types supported by seekdb and their characteristics.
Index types
seekdb supports the following vector index types:
- Dense index
- Sparse index
- Semantic index
Dense index
seekdb supports dense vector indexes, including the HNSW series and IVF series. For convenience, they are referred to as dense indexes in the following sections.
| Index type | Description |
|---|---|
| HNSW | The maximum dimension of the index column is 4096. HNSW indexes are memory-based and must be fully loaded into memory. |
| HNSW_SQ | HNSW_SQ indexes provide similar build speed, search performance, and recall rate as HNSW indexes, but they use only 1/2 to 1/3 of the memory. |
| HNSW_BQ | HNSW_BQ indexes have slightly lower recall rates than HNSW indexes but significantly reduce memory usage. The BQ quantization compression algorithm (Rabitq) can compress vectors to 1/32 of their original size. As the vector dimension increases, the memory optimization effect of HNSW_BQ indexes becomes more pronounced. |
| IVF | The IVF index is implemented based on database tables and does not occupy resident memory. |
| IVF_PQ | The IVF_PQ index is implemented based on database tables and does not occupy resident memory. It applies the PQ quantization technique to the IVF index, resulting in slightly lower recall rates but higher performance. In general scenarios, the PQ quantization compression algorithm can compress vectors to 1/16 to 1/32 of their original size. |
Index maintenance mode (HNSW series)
HNSW series vector indexes support the sync_mode parameter to control index maintenance:
immediate: Synchronous maintenance. After a write commits, the vector index becomes available for approximate search as soon as possible (see HNSW series indexes for full semantics).async: Asynchronous maintenance. Writes land in the main table and return first; the vector index is built in the background. Search results are eventually consistent, with visibility delay generally within milliseconds. Only the HNSW series (HNSW,HNSW_SQ,HNSW_BQ) supportsync_mode(immediateandasync). Other types such as IVF do not support this parameter (specifying it returns an error). When you create an index without specifyingsync_mode, the default is generallyasync. Existing indexes are not automatically switched to asynchronous mode; rebuild or adjust the index to change maintenance mode.
When your application needs approximate search to return hits soon after a write, run CALL dbms_index_manager.refresh(); before querying to advance asynchronous consumption progress. For details, see REFRESH (DBMS_INDEX_MANAGER).
Sparse index
seekdb supports in-memory sparse vector indexes. For convenience, they are referred to as in-memory sparse indexes in the following sections. In-memory sparse indexes are efficient index types provided by seekdb for sparse vectors (vectors with most elements being zero). They require the complete loading of the index into memory and support DML operations and real-time search.
In-memory sparse indexes are an experimental feature in the current version and are not recommended for use in production environments.
Semantic indexes
seekdb supports semantic indexes, which leverage built-in embedding capabilities to greatly simplify the process of using vector indexes. It makes the concept of vectors transparent to users: you can directly write the raw data you want to store (such as text), and seekdb will automatically convert it into vectors and build an index. During searches, you only need to provide the raw search content, and seekdb will automatically perform the embedding and search the vector index, significantly enhancing usability.
Semantic indexes are an experimental feature in the current version and are not recommended for use in production environments.
Considerations and limitations
- Distance algorithm: Dense vector indexes support L2, inner product (IP), and cosine distance as index distance algorithms.
- Distance function: Vector index search supports calling some distance functions. For more information, see Use SQL functions.
- Filter conditions: Vector search supports filter conditions. The filter conditions can be scalar conditions or spatial relationships, such as ST_Intersects. Multi-value indexes, full-text indexes, and global indexes cannot be used as pre-filterers.
- Offline DDL: For information about the support of vector indexes for offline DDL, see Offline DDL.
- Under asynchronous maintenance, the main table and the vector approximate index may be briefly inconsistent. Main table queries read the latest committed data; approximate search with
APPROXIMATE/APPROXdepends on asynchronous index visibility. After an insert, approximate visibility is generally within milliseconds. After a delete, the row is immediately invisible on the approximate search path. Updating only scalar columns does not change the vector index. sync_mode,CALL dbms_index_manager.refresh(), and the monitoring viewDBA_OB_CHANGE_STREAM_REFRESH_STATare available starting in seekdb V1.3.0 with asynchronous vector index support.