# DuckDB and Infino on SQL, keyword, vector and hybrid search

> Source: <https://infino.ai/blog/duckdb-and-infino/>
> Published: 2026-12-03 00:00:00+00:00

**Recommendation:** For keyword or hybrid retrieval over millions of documents, use a dedicated search engine like Infino or Lucene rather than DuckDB's fts extension, which took about 6,000 ms per query versus 0.30 ms.
More in the playbook "Retrieval and RAG": <https://wpnews.pro/playbooks/rag-retrieval>

# DuckDB and Infino on SQL, keyword, vector and hybrid search

DuckDB is a popular analytics database, and like a lot of analytics tools it has added search: its `fts` extension does BM25 full-text search and its `vss` extension does HNSW vector search. We wanted to see how far those extensions go, so we ran DuckDB against Infino on four workloads: SQL analytics, keyword search, vector search and hybrid search.

DuckDB is faster on SQL analytics over its own storage format. Infino is faster on the three search workloads: about 2x on vector search at the same recall, 10x on hybrid search, and thousands of times on keyword search.

## Setup

The SQL numbers come from the public ClickBench results. For search, we ran DuckDB 2.0.1 and Infino 0.13.2 (the Python package) on one Azure `Standard_D8ds_v7` (8 vCPU, 32 GiB, local NVMe), with Lucene 10.6.0 as a reference for keyword search. Data was on local disk, not object storage.

Every engine got the same data and the same queries. Queries ran one at a time on a warm engine, with a warm-up pass before timing. We used default settings, except for DuckDB’s HNSW `ef_search`, which we swept so DuckDB could reach the same recall as Infino. A query an engine couldn’t run counted as unsupported.

## SQL analytics

ClickBench runs 43 analytical queries over 100 million rows of web traffic. These are the hot-run totals from the latest [public results](<https://benchmark.clickhouse.com/#system=+DuckDB|DuckDB%20(Parquet,%20single)|Infino&machine=+c6a.4xlarge|c8g.metal-48xl&cluster_size=-&type=-&metric=hot>): for each query, the faster of the second and third runs, summed.

| Machine | DuckDB | DuckDB on Parquet | Infino | 
|---|---|---|---|
| c6a.4xlarge (16 vCPU) | 25.1 s | 33.9 s | 30.5 s | 
| c8g.metal-48xl (192 vCPU) | 4.99 s | 8.10 s | 6.08 s | 

On its own format, DuckDB is about 20% faster than Infino on both machines. On Parquet, the format Infino stores its data in, DuckDB is 11% slower than Infino on the smaller machine and 33% slower on the larger one.

ClickBench doesn’t test text ranking, vector search or score fusion, so we measured those ourselves.

## Keyword search

We used [Search Benchmark, the Game](https://github.com/infino-ai/search-benchmark-game), which runs 962 real queries against 5 million English Wikipedia articles on a single thread. We added a DuckDB engine that uses `match_bm25`.

DuckDB took about 6 seconds per query, so it ran a stratified sample of 101 queries, timed once after a warm-up. Infino and Lucene ran the same sample with the harness’s usual best of 10. DuckDB can’t run phrase or exclusion queries, which ruled out 38 of the 101. Mean latency on the other 63:

| Query | DuckDB | Infino | Lucene | 
|---|---|---|---|
| Top 10 | 6,241 ms | 0.30 ms | 0.62 ms | 
| Top 100 | 6,025 ms | 0.47 ms | 0.97 ms | 
| Top 1000 | 6,049 ms | 0.80 ms | 1.74 ms | 
| Top 100 and count | 6,006 ms | 1.12 ms | 3.43 ms | 
| Count | 6,009 ms | 0.27 ms | 0.68 ms | 

DuckDB, Infino and Lucene returned the same hit counts on all 63 queries. DuckDB’s time barely changes between query types because `match_bm25` scores every document in the table. It doesn’t skip through posting lists or stop once it has the top k. DuckDB’s full-text index also doesn’t update when rows change. It has to be rebuilt.

On the full 962 queries, Infino takes 0.49 of Lucene’s time on top-k queries and 0.39 on counts.

| Index build | Time | Size | 
|---|---|---|
| Infino | 133 s | 2.5 GB | 
| Lucene | 129 s | 2.7 GB | 
| DuckDB | 165 s | 13 GB, including the article text | 

## Vector search

We used Cohere 1M from [VectorDBBench](https://github.com/zilliztech/VectorDBBench): 1 million 768-dimension embeddings, cosine similarity, and 1,000 queries with exact ground truth, at k = 10. DuckDB used the `vss` HNSW index at four `ef_search` values. Infino used its defaults.

| Engine | ef_search | Recall@10 | p50 | p95 | 
|---|---|---|---|---|
| DuckDB | 64 (default) | 0.937 | 3.2 ms |  | 
| DuckDB | 128 | 0.967 | 4.0 ms |  | 
| DuckDB | 256 | 0.979 | 5.3 ms |  | 
| DuckDB | 512 | 0.989 | 8.1 ms | 9.6 ms | 
| Infino | n/a | 0.991 | 3.9 ms | 6.2 ms | 

At recall 0.99, Infino’s median is 3.9 ms and DuckDB’s is 8.1 ms. DuckDB at its default `ef_search` is faster, at recall 0.937.

DuckDB builds its HNSW index in memory. Keeping it on disk needs an experimental setting, so by default every new process builds it again, which took 212 s on this data. Infino loaded the data and built its index in 92 s, and the table is 4.5 GB on disk.

## Hybrid search

We took 1 million English passages from Cohere’s [Wikipedia 2023-11 embeddings](https://huggingface.co/datasets/CohereLabs/wikipedia-2023-11-embed-multilingual-v3) (1024 dimensions) and used the next 1,000 passages as queries. Each query searches the passage title as keywords and its embedding as the vector.

DuckDB and Infino can both answer a hybrid question in one SQL statement, and both can add a graph hop to that statement: Infino with its `graph_walk` table function, DuckDB with the DuckPGQ extension. We measured text and vector here, not graph.

DuckDB and Infino each take the BM25 top 100 and the vector top 100 and combine them with reciprocal rank fusion (k = 60). Infino uses its `hybrid_search` table function. DuckDB uses two CTEs and fuses them in SQL.

| Engine | p50 | p95 | 
|---|---|---|
| DuckDB | 80 ms | 340 ms | 
| Infino | 8.0 ms | 12.1 ms | 

Infino’s median is 10 times lower and its p95 28 times lower. DuckDB and Infino share 80% of their top 10 results. The rest comes down to how each tokenizes text for BM25.

## Limitations of the extensions

Apart from speed, the extensions leave gaps that showed up in the tests above.

|  | DuckDB | Infino | 
|---|---|---|
| Phrase and exclusion queries | Not supported by `match_bm25` , which ruled out 38 of the 101 sampled queries | Supported | 
| Top-k keyword search | Scores every document in the table | Skips through posting lists and stops at the top k | 
| Full-text index when rows change | Rebuilt by hand | Kept up to date as rows are written | 
| Vector index on disk | Needs an experimental setting. By default it is rebuilt in every new process, 212 s on Cohere 1M | Stored with the table | 
| Hybrid search | Two CTEs and rank fusion written by hand in SQL | One `hybrid_search` table function | 

## Summary

DuckDB is an analytical database with search extensions. Infino is a search engine that runs SQL over Parquet. If your queries scan and aggregate columns, DuckDB on its own format is faster. If they rank text, vectors or both, Infino was faster on the keyword, vector and hybrid tests above.

## What it means for agents

The questions agents ask mix all of these at once. “How many errors last night mention disk full or look like a capacity incident, and which team owns the service?” needs a keyword search, a vector search, a filter, a count and a join. To Infino that is [one SQL statement](https://infino.ai/blog/one-query-agent-engine/), and the search parts of it are the ones measured above.

An agent also asks many of these questions to finish one task, each building on what the last one returned, so retrieval time adds up. At DuckDB’s 6 seconds per keyword search, ten steps take a minute. At Infino’s 0.3 ms per keyword search and 8 ms per hybrid search, ten steps take under a tenth of a second.
