Achieving Fast Vector Search in MariaDB MariaDB Server 12.3 makes vector search faster where it matters most: the high-recall levels […]
MariaDB Server 12.3 makes vector search faster where it matters most: the high-recall levels that production AI workloads actually require. A new Matryoshka-aware optimization uses a cheap check on the first slice of each embedding to discard far-away candidates, then confirms the close ones with the full vector — so search stays just as accurate while doing far less work.
The result is higher throughput, lower compute cost per query, and no added developer complexity.
For developers, that means faster vector search on upgrade. For businesses, it means faster AI applications with less infrastructure, fewer moving parts, and lower operational cost.
What’s the problem with vector search at production recall?Vector search powers the retrieval layer in almost every modern AI application: RAG over enterprise knowledge bases, semantic product search, recommendations, and fraud detection. As datasets grow, the distance calculations behind that search become the expensive part — and in each of these systems, two numbers ultimately drive cost:
In benchmarks it is easy to chase QPS at recall of 0.80 or 0.90. In production, that is rarely where applications run. A RAG pipeline that misses the right chunk one time in five is a RAG pipeline that hallucinates. Real workloads target recall of 0.94 and above — and that is exactly where every vector engine slows down sharply, because each additional point of recall costs more distance calculations against high-dimensional embeddings. So the real engineering question is not “How fast is your vector search?” but “How fast is it at the recall your application requires?”
An embedding is a long list of numbers — a vector — that a model produces to represent a piece of text, an image, or a product. Similar items get similar vectors, so “find related things” becomes “find the nearest vectors.” That search is the retrieval step behind most AI features.
Two numbers describe how well it runs. QPS (queries per second) is throughput — how many lookups the database serves. Recall is quality — the share of searches that return the genuinely closest matches. Higher recall means better answers but more work per query, so the two trade off against each other.
A growing class of embedding models — including OpenAI and Gemini embedding models, open-source Sentence Transformers, and Matryoshka-style models — produce embeddings whose lower-dimensional prefixes preserve useful semantic information. The name comes from Russian nesting dolls: the first slice of the vector already carries the coarse meaning, and each further slice adds detail. This means a low-dimensional prefix is often enough to tell whether two vectors are even in the same neighborhood.
Think of how you’d describe a book. “A thriller” narrows it down a lot. “A legal thriller set in Chicago” narrows it further. “A legal thriller set in Chicago about a whistleblower” gets you close to the exact book — but the first few words already ruled out most of the library.
A Matryoshka-style embedding works the same way. It’s a list of numbers — its dimensions, say 1,536 of them — ordered so the front, say the first 192, carries the gist and the rest fill in detail. Comparing just the front is a cheap way to rule out the obvious misses.
MariaDB Server 12.3 applies exactly this at search time, in a single automatic pass. For every candidate the HNSW graph touches, the engine first computes a partial distance over just the first 192 dimensions. That partial distance is a reliable predictor of the full 1,536-dimensional distance: if it already places a candidate well outside the range that could matter, the engine discards it without ever computing the rest. Only the candidates that survive this cheap filter get the full, precise distance calculation. The final ranking is based on full distances, so recall is preserved and the engine has avoided full computations for many candidates that were never going to make the cut.
Crucially, both stages happen inside the engine, on the same index, in the same query. It is the two-stage filtering pattern that teams normally build by hand — but MariaDB does it internally and automatically.
What the Matryoshka benchmark showsThe dbpedia-openai-1000k benchmark comprises one million 1,536-dimensional OpenAI embeddings. It is a general-purpose vector-search benchmark used to evaluate how engines trade QPS against recall, which makes it a good proxy for the real-world efficiency and infrastructure cost of a vector database at production recall.
In a recent 10-database benchmark on the dbpedia-openai-1000k dataset — one million 1536-dimensional OpenAI embeddings — the field separates into three clear tiers at 94% recall:
| Tier | Databases | QPS at 94% recall |
|---|---|---|
| Top | MariaDB, RediSearch | 850–1000 |
| Middle | Weaviate, pgvectorscale, pgvecto.rs | 470–570 |
| Trailing | pgvector | 250 |
| Bottom | OpenSearch, Qdrant, Milvus | 90–250 |
MariaDB 12.3 sits in the top tier at 94% recall, delivering 850–1000 QPS alongside RediSearch, and pulls into a clear lead above 95%.
Compared with the previous MariaDB Server 11.8: 12.3 is faster across the high-recall range, delivering up to 30% more QPS at the same recall. The new Matryoshka-aware optimization does the work.
Developer Advantages of MariaDB for Matryoshka EmbeddingsThe optimization turns itself on. Developers do not need to know whether their embedding model is Matryoshka-trained, choose a prefix length, maintain multiple vector indexes, or build the two-stage retrieval pipeline themselves.
MariaDB observes the relationship between prefix distance and full-vector distance on the actual dataset. If the prefix is a reliable predictor, the optimization is enabled. If it is not, MariaDB continues using the standard full-distance computation. The same SQL, the same vector column, and the same index work in both cases.
To our knowledge, MariaDB Server 12.3 is the first general-purpose database to apply this kind of Matryoshka-aware distance pruning automatically at query time. Other engines that support Matryoshka embeddings push the work onto developers — choosing a prefix length, maintaining parallel indexes, and wiring up two-stage retrieval in the application.
That difference is operational:
MariaDB Server 12.3 with the Matryoshka-aware optimization is available now. Existing MariaDB vector search users can upgrade in place — no schema changes are required for the optimization to take effect.
Benchmark details: dbpedia-openai-1000k dataset (1,000,000 vectors, 1,536 dimensions, angular distance), run on Intel Xeon E5-2660 v4 (AVX2), using a fork of ann-benchmarks with MariaDB support. QPS figures are approximate tier ranges from the published results; verify the latest numbers against the source benchmark.
Frequently Asked QuestionsA technique that uses the most informative low-dimensional prefix of an embedding to cheaply discard far-away candidates, then computes the full distance only for the close ones — cutting compute while preserving recall.
Because production systems run at high recall (typically 0.94 and above). Throughput measured at lower recall does not reflect real cost or accuracy.
No. The optimization requires no schema, index, or query changes. Existing MariaDB Vector workloads benefit on upgrade to 12.3.
Yes. These models — along with many Sentence Transformers — produce embeddings with usable prefix structure that the optimization can exploit.
On the dbpedia-openai-1000k benchmark, up to 30% higher QPS at equivalent recall, with the largest gains at the high-recall end. Results vary by dataset and embedding model.
MariaDB tests whether the prefix predicts full-vector distance on your data. If it does not, the engine uses standard full-distance computation — no penalty, no configuration.
For many workloads it removes the need to run one alongside MariaDB, consolidating transactional, JSON, analytical, and vector workloads in a single engine.
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Big Vector Search Benchmark: 10 databases comparison | 0 | 17.6 | 11-03-2026 |
| 2 | MariaDB Innovation: InnoDB-Based Binary Log | 0 | 17.58 | 17-03-2026 |
| 3 | Updated MariaDB C++ and ODBC Connectors now available | 0 | 19.96 | 07-07-2026 |
| 4 | MariaDB Node.js Connector 3.5.4 and 3.4.7 now available | 0 | 25.43 | 07-08-2026 |
| 5 | Optimizing Compute for Agentic Systems With New Request Handoff Functionality | 0 | 9.76 | 13-07-2026 |
| 6 | An Easy Path from MySQL to MariaDB: Introducing MariaDB Migrator | 0 | 8.49 | 09-07-2026 |
| 7 | MariaDB Community Server 10.6.28 now available | 0 | 12.77 | 13-08-2026 |
| 8 | MariaDB Java Connector 3.5.10, 3.4.4, 3.3.6, and 2.7.15 now available | 0 | 27.04 | 29-07-2026 |
| 9 | Multi-Cluster Replication, FIPS Mode, and More with MariaDB Enterprise Kubernetes Operator 26.06 | 0 | 10.51 | 15-07-2026 |
| 10 | What a careful MySQL to MariaDB migration still misses | 0 | 13.29 | 18-08-2026 |