LanceDB vector index on 1.1 million vectors: IVF_PQ in 50 s, HNSW in 469 s
LanceDB vector index measured on 1.1 million vectors: IVF_PQ built in 50 s, HNSW in 469 s, with recall against the exact search.
I built two vector indexes on a copy of my own LanceDB table and measured them against an exact search, and an AI assistant (Claude, from Anthropic) helped me write the test script and draft this article. The numbers below are the real output of these runs, with LanceDB 0.41.0 on a laptop with 8 cores and 31.5 GB of RAM. The table is the one from the first article: 1,130,595 rows and one vector column of 1024 floats.
Quick answer
For a LanceDB vector index, the baseline is the exact search: without an index it takes 2,392 ms in median on this table. An IVF_PQ index builds in 50 seconds, weighs 76.7 MiB and answers in 11 to 29 ms, but with the default parameters it finds only 66 % of the true neighbours. Adding nprobes=100 and refine_factor=10 brings that recall to 93.3 % for 29 ms. An IVF_HNSW_SQ index builds in 469 seconds and weighs 1,355 MiB, but it finds 90 % of the neighbours in 9 ms with the defaults and 99.3 % in 12 to 19 ms with refine_factor=10. On this table the HNSW index costs nine times the build time and about 18 times the disk space of IVF_PQ, and it gives the better recall at every setting I tried.

The LanceDB vector index test
I took the cleaned copy of the table, 5.78 GiB in one data file, and drew 50 rows at random with a fixed seed. Their vectors are the queries. The reference answer for each query is the exact search, which I ran first with the index bypassed, using the cosine metric. The recall is the share of the exact top 11 that the indexed search also returns. The query row is part of both lists, so the figure counts the row itself plus 10 neighbours. The latency is the time of the Python call, with limit(11) and two selected columns, measured one query at a time. Each figure comes from one build and one pass of 50 queries.
No index: the exact search
| Search | Median | p95 | Max |
|---|---|---|---|
| Exact, no index | 2,392 ms | 3,071 ms | 3,641 ms |
The table has no index, so LanceDB compares the query with every vector.
IVF_PQ: a small LanceDB vector index
I created the index with create_index(metric="cosine", index_type="IVF_PQ", num_sub_vectors=64) and left the other parameters at their defaults. The build took 50 seconds. The index is 80,380,099 bytes, which is 76.7 MiB, in one segment, and it covers the 1,130,595 rows. The build created version 266.
| Parameters | Recall | Median | p95 |
|---|---|---|---|
| defaults | 0.660 | 26 ms | 30 ms |
| nprobes=20 | 0.640 | 11 ms | 13 ms |
| nprobes=50 | 0.658 | 17 ms | 19 ms |
| nprobes=20, refine_factor=10 | 0.858 | 14 ms | 16 ms |
| nprobes=100, refine_factor=10 | 0.933 | 29 ms | 31 ms |
The nprobes setting makes the search visit more partitions, and refine_factor re-ranks the candidates with the exact vectors. On this table the second one matters more: raising nprobes from 20 to 50 gains almost nothing, while the refinement adds 22 points of recall. The first line is slower than the second although I did not set nprobes. I repeated the defaults four times and the median stayed at 26 ms each time, so it is not a cold cache. The defaults gave the same recall (0.660) and nearly the same median as nprobes=100 (25 ms), so on this index they behave like about 100 probes. The documentation of nprobes that I read does not give a default value, so I read the Lance source, version 14.0.2, which is the version named in the error paths of my install. There is no fixed default: without nprobes, the query uses an adaptive mode in which the initial number of partitions to visit is chosen for each query from the distances between the query and the partition centroids, and the source comments call it an empirical heuristic, not a recall guarantee. The comparison with nprobes=100 is therefore an observation on my index, not a rule. The other values on the same index: nprobes=1 gives 0.384 at 6.7 ms, nprobes=5 gives 0.560 at 7.4 ms and nprobes=10 gives 0.618 at 8.3 ms.
IVF_HNSW_SQ: a large LanceDB vector index
I created the second index with create_index(metric="cosine", index_type="IVF_HNSW_SQ") and all defaults, on another copy of the same table. The build took 469 seconds. The index is 1,420,975,175 bytes, which is 1,355 MiB.
| Parameters | Recall | Median | p95 |
|---|---|---|---|
| defaults | 0.900 | 9 ms | 12 ms |
| nprobes=20 | 0.900 | 8 ms | 10 ms |
| nprobes=50 | 0.900 | 8 ms | 10 ms |
| nprobes=20, refine_factor=10 | 0.993 | 19 ms | 24 ms |
| nprobes=100, refine_factor=10 | 0.993 | 12 ms | 13 ms |
The recall does not move with nprobes here, and it jumps from 0.900 to 0.993 with refine_factor=10. I did not test the parameters of the HNSW graph itself.
What the numbers say and what they do not
The LanceDB vector index is worth building: 2.4 seconds per query becomes 9 to 29 ms. The choice between the two types is a trade between disk space and build time on one side and recall on the other. For 1.13 million rows, the 76.7 MiB IVF_PQ index at 93 % recall may be enough, and the 1.3 GiB HNSW index buys the last points. These are measurements on one table of text embeddings, with queries taken from the table itself, so they do not tell you how another dataset behaves.
What I did not test
I did not test filters combined with the search, the cost of adding rows after the index exists, concurrent queries, or a GPU. I ran each build once, so I have no variance for the build times. The recall counts the query row itself, which slightly flatters it, and the figures come from 50 queries, a small sample.
Official documentation
The LanceDB project documents create_index, the index types and the search parameters, and the Lance format pages describe the table layout where the _indices/ directory appears.