Lance Indexes
Lance treats indexes as independent, redundant data structures, hierarchically built on top of table row identifiers. This design frees the file format from built-in search structures and allows the index format to evolve independently of the table layout. Lance supports three types of indexes: scalar indexes, vector indexes, and system indexes.
Scalar Indexes
Scalar indexes accelerate queries on scalar data types such as integers, timestamps, and strings. The scalar indexes supported by Lance are listed in Table 1.
| Index Type | Storage Files | Accelerated Queries | Description |
|---|---|---|---|
| Zone Map | zonemap.lance | Equals, Range, IsIn, IsNull | Data is divided into fixed-size regions, and min/max/null_count statistics are maintained for predicate pushdown and scan pruning. False positives may be included and need to be rechecked. |
| BTree | page_lookup.lance + page_data.lance | Equals, Range, IsIn, IsNull | Two-level structure with an in-memory BTree cache at the upper layer and sub-indexes storing sorted values and row IDs at the lower layer. The indexes balance the memory structures and disk structures. |
| Bitmap | bitmap_page_lookup.lance | Equals, Range, IsIn, IsNull | Bit arrays are used to represent the presence or absence of values. The index is suitable for low-cardinality columns and provides extremely fast query performance. |
| Bloom Filter | bloomfilter.lance | Equals, IsIn, IsNull | The index adopts a probabilistic data structure that allows for fast membership testing. It is space-efficient, with possible false positives but no false negatives. The index is implemented through the Split Block Bloom Filter (SBBF) to optimize the SIMD operation. |
| Full Text Search | tokens.lance + docs.lance + invert.lance + metadata.lance | contains_tokens, match, phrase, boolean, multi_match, boost | An inverted index that maps terms to the documents that contain them. The index supports BM25 scoring, phrase queries, and multiple tokenizers. |
| Label List | bitmap_page_lookup.lance | array_has / array_contains, array_has_all, array_has_any | The label list index is optimized for columns that contain multiple labels or tags per row. It uses underlying bitmap indexes to provide efficient set-based queries for multi-valued columns. |
| N-gram | ngram_postings.lance | contains | The N-gram index breaks text into overlapping sequences (trigrams) to enable efficient substring matching. It provides fast text search by indexing all triple sequences in text after applying ASCII folding and lowercasing. |
| R-Tree | page_data.lance | Intersects, Contains, Within, Touches, Crosses, Overlaps, Covers, CoveredBy, IsNull | The index is built based on bounding boxes to organize data. It is designed to accelerate rectangle-based pruning operations. |
Vector Indexes
Vector indexes are specialized for approximate nearest neighbor search (ANN) of high-dimensional embeddings. Lance divides each vector index into three parts: clustering, sub-index, and quantization.
- Clustering: Partitions all vectors into distinct, non-overlapping clusters. Lance currently supports Inverted Files (IVF) as the primary clustering mechanism and uses the k-means clustering algorithm to partition vectors.
- Sub-index: Determines how vectors are organized for search. Supported types include FLAT (exact search) and HNSW (hierarchical navigable small world graph for fast approximate search).
- Quantization: Defines how vectors are stored and compressed. Options include Product Quantization (PQ), Scalar Quantization (SQ), RabitQ (RQ), and FLAT (no quantization).
Index types are typically denoted as {clustering}_{sub_index}_{quantization}. If the sub-index is FLAT, it is usually omitted, simplifying the notation to {clustering}_{quantization}.
| Index Type | Name | Description |
|---|---|---|
| IVF_PQ | Inverted file + Product quantization | Combines IVF clustering and PQ compression for efficient storage and search. |
| IVF_HNSW_SQ | Inverted file + HNSW + Scalar quantization | Uses IVF coarse clustering and HNSW fine-grained search, combined with scalar quantization. |
| IVF_SQ | Inverted file + Scalar quantization | Combines IVF clustering and scalar quantization for balanced compression. |
| IVF_RQ | Inverted file + RabitQ | Combines IVF clustering and RabitQ, using binary quantization for extreme compression. |
| IVF_FLAT | Inverted file + FLAT | Uses IVF clustering and exact vector storage for precise search within clusters. |
System Indexes
System indexes are auxiliary structures that support internal table maintenance and row identifier parsing. They are not directly queried by end users. For example:
- Fragment Reuse Index (FRI): Optimizes fragment operations during compaction and dataset updates, supporting efficient remapping after compression.
- MemWAL Index: A centralized structure of all MemWAL metadata. It stores configuration (shard specs and indexes to be maintained), merge progress, and shard status snapshots.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot