IVF On-Disk
Note:
Performance tables, charts, timings, and capacity heuristics on this page are retained from upstream Apache Doris material. They were not measured on VeloDB Cloud. Use them as starting points and validate recall, latency, throughput, and memory on your own workload.
ivf_on_disk is an index type that VeloDB Cloud provides for large-scale vector retrieval (ANN) scenarios. It stores the main body of the IVF inverted lists on disk and loads hot data on demand through a dedicated cache, significantly reducing resident memory usage while preserving IVF retrieval capabilities.
Quick navigation
- To learn why
ivf_on_diskis needed, read Background and goals. - To start using it directly in table creation, read Index DDL and Query parameters.
- To control memory usage, read Managed cache configuration and Tune the index.
- To evaluate real-world behavior, read Performance reference data.
- To compare with in-memory IVF, read Comparison with IVF.
Background and goals
When the vector scale reaches tens of millions or more, the index memory cost of pure in-memory IVF rises rapidly and becomes a resource bottleneck. The design goals of ivf_on_disk include:
- Preserve the parameter model and retrieval semantics of IVF (
nlist/nprobe). - Switch from a "must reside fully in memory" mode to a "disk + dedicated cache" mode.
- Allow users to continue using existing ANN SQL usage and operational practices.
In short, ivf_on_disk is mainly aimed at production scenarios where the memory budget is constrained but ANN acceleration is still required.
Comparison with IVF
The following table helps you quickly decide when to choose ivf_on_disk over ivf.
| Comparison dimension | ivf (in memory) | ivf_on_disk (disk + cache) |
|---|---|---|
| Inverted list storage | Fully in memory | Mainly on disk, loaded on demand via cache |
| Memory usage | High, grows linearly with data volume | Inverted-list residency is bounded by its cache; total index and process memory also include other allocations |
| Query latency | Lowest | Slightly higher than in-memory IVF, affected by cache hit ratio |
| Parameter model | nlist / nprobe | Identical |
| Query functions | ANN query functions | Identical |
| Applicable scale | Small to medium | Tens of millions and above |
| Migration | Keep the existing index | Recreate and build the index with index_type="ivf_on_disk"; plan build resources and the period without ANN acceleration |
User interface
1) Index DDL
Create an ANN index by specifying index_type="ivf_on_disk":
CREATE TABLE vec_tbl (
id BIGINT NOT NULL,
embedding ARRAY<FLOAT> NOT NULL,
INDEX idx_emb (embedding) USING ANN PROPERTIES (
"index_type" = "ivf_on_disk",
"metric_type" = "l2_distance",
"dim" = "768",
"nlist" = "1024"
)
) ENGINE=OLAP
DUPLICATE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 8
PROPERTIES ("replication_num" = "1");
Key notes:
- Both
ivfandivf_on_diskmust explicitly specifynlist. metric_typesupportsl2_distanceandinner_product.- The query functions remain the same:
l2_distance_approximate/inner_product_approximate.
2) Query parameters
ivf_nprobe remains the most critical query-phase parameter for the IVF family:
SET ivf_nprobe = 64;
In general, a larger nprobe yields a higher recall, but query latency rises accordingly.
3) Managed cache configuration
ivf_on_disk introduces a dedicated cache for IVF inverted lists. The table shows compiled Core 26.1.3 values for context. They are not guaranteed warehouse settings. Cache tuning is managed by VeloDB Cloud support:
| Configuration item | Default | Description |
|---|---|---|
ann_index_ivf_list_cache_limit | 70% | Cache upper limit. The percentage is based on the compute-node process memory limit (constrained by mem_limit), not the physical memory of the entire machine. |
ann_index_ivf_list_cache_stale_sweep_time_sec | 3600 | Cleanup interval for stale entries in the cache, in seconds. |
Observability
To help locate performance bottlenecks of ivf_on_disk, query profile counters and compute-node metrics are provided. They can be used to determine whether the current cache size is appropriate and whether latency mainly comes from disk page faults or from the retrieval computation itself.
Common Profile fields:
AnnIvfOnDiskLoadCostsAnnIvfOnDiskCacheHitCntAnnIvfOnDiskCacheMissCnt
Compute-node metrics (availability depends on the monitoring interface; contact Support if needed):
ann_ivf_on_disk_fetch_page_costs_msann_ivf_on_disk_fetch_page_cntann_ivf_on_disk_search_costs_msann_ivf_on_disk_search_cntann_ivf_on_disk_cache_hit_cntann_ivf_on_disk_cache_miss_cnt
Usage notes
ivf_on_diskshares the major usage constraints of existing ANN indexes (such as vector column types and the validity of index parameters).- Training quality and retrieval effectiveness still depend on the data scale and the parameter combination (
nlist,ivf_nprobe). ivf_on_disksupports common ingestion paths such as Stream Load. You are advised to validate it with your business data before going to production.
Performance reference data
The following table is an upstream Apache Doris benchmark snapshot. Its full release, dataset, and hardware configuration are not provided. It is not a VeloDB Cloud benchmark and is a reference only. It illustrates the practical trade-offs among cache coverage, memory usage, and latency.
| Scenario | Memory usage (GB) | AnnIndexIVFListCache hit ratio | Max QPS | Recall@100 | Average latency (s) | P99 latency (s) | P95 latency (s) |
|---|---|---|---|---|---|---|---|
| Brute Force (No Index) | - | - | 0.2922 | 0.0000 | 292.5394 | 307.9490 | 307.9442 |
| IVF In Memory | 32.0 | 100% | 71.8535 | 0.9598 | 0.4167 | 0.5623 | 0.5151 |
| OnDisk Cache 100% | 32.0 | 100% | 72.3649 | 0.9599 | 0.8274 | 1.1236 | 1.0395 |
| OnDisk Cache 79% | 22.0 | 70% | 45.0266 | 0.9599 | 1.9900 | 4.4059 | 3.3568 |
| OnDisk Cache 60% | 16.7 | 55% | 38.3141 | 0.9599 | 2.3281 | 4.0063 | 3.5542 |
Reading guidance:
- When the recall is roughly the same (around 0.96), reducing the cache significantly lowers memory usage but raises tail latency.
- When the cache coverage approaches 100%,
ivf_on_diskcan maintain a recall close to in-memory IVF, but with some increase in latency. - Monitor query latency and available cache metrics. Share the workload and profiles with VeloDB Cloud support if cache tuning is needed.
Tune the index
The recommended iterative tuning steps are:
- Start tests by reusing the baseline
nlist/ivf_nprobeparameters fromivf. - Choose cluster capacity for the workload. Ask VeloDB Cloud support to assess
ann_index_ivf_list_cache_limitif cache residency is a bottleneck. - If recall is stable but latency varies, compare cold and warm queries and the cache hit ratio before requesting a managed configuration change.
- After the cache ratio changes, jointly adjust
ivf_nprobeagain to balance recall and latency.
FAQ
Q1: Is there any difference in SQL usage between ivf_on_disk and ivf?
Query SQL is unchanged. To replace an existing index, drop and recreate it with index_type="ivf_on_disk", then build it on existing data. The query functions (l2_distance_approximate / inner_product_approximate) and parameters (ivf_nprobe) remain the same.
Q2: What is the percentage baseline for ann_index_ivf_list_cache_limit?
It is the compute-node process memory limit (constrained by mem_limit), not the physical memory of the entire machine. The cache budget excludes other memory consumers; it is not a cap on total process memory. Support manages this setting.
Q3: What hit ratio is considered reasonable?
It depends on the tail latency that the business can tolerate. According to the reference data, latency is most stable when the hit ratio is 100%; when the hit ratio drops to 55%-70%, memory usage decreases substantially, but P99 latency can rise to the seconds level. Continuously tune based on observability metrics.
Q4: When should ivf_on_disk be chosen over ivf?
Choose ivf_on_disk first when the vector scale is large (tens of millions or more), the memory budget is tight, and ANN acceleration is still required. Choose ivf when latency is extremely sensitive and memory is sufficient.