See how leading teams deploy agents at scale in our upcoming webinar — Register here.

Under the Hood of RegattaDB's Vector Index

Nitai Kluger

Nitai Kluger

Software Engineer and Architect

Retrieval-augmented generation (RAG), recommendation engines, image matchers, and semantic search all use a vector database to identify similarity in a high-dimensional space. To do this efficiently, they must build an index that organizes vectors so approximate nearest-neighbor (ANN) queries can be answered quickly without a full scan of all the vectors in the database. The index is constructed over the data first, then queries are executed against it. These two operations, build and search, are what every vector engine must support.

As datasets grow into the millions and billions of vectors, a single-node index (not distributed) is no longer sufficient. Distributed vector indexes become necessary, and with them come real challenges. How is load balanced across nodes How are resources managed during index constructionH how is query execution optimized at the cluster level.

RegattaDB is a distributed SQL database that supports both OLTP and OLAP queries, and extends this with native vector capabilities that optimize both index construction and query execution. Admins and operators have full control over resource usage, scheduling, and placement through standard SQL.

The sections below cover how RegattaDB handles build and search for vectors, how it compares to pgvector, Qdrant, and Pinecone, and what the end-to-end workflow looks like in practice.

Building and Searching

Every vector index involves two kinds of work: building the index structure over the data, and searching it at query time. The two most widely adopted approximate nearest-neighbor (ANN) index methods are HNSW (a graph-based structure optimized for recall and speed) and IVFFLAT (a partition-based structure optimized for memory efficiency). RegattaDB supports both, and optimizes each side of the lifecycle; exposing fine-grained control over how much CPU to dedicate, which cluster nodes participate, and how queries are routed — all through familiar SQL statements.

Every vector index involves two kinds of work, build and search. Build is CPU-intensive, and an uncontrolled build on a production cluster that performs additional activities can starve the other transactional, analytical, and search activities, causing performance issues such as latency spikes across the rest of the application. Search is usually done in high throughput, and hence must be fast and parallelized across nodes without overwhelming the cluster.

Building: Controlled, Localized, and Parallel

Index construction in RegattaDB is designed to be predictable and governable.

Controlled. In a production cluster, nodes are constantly serving vector searches, transactions and analytical queries. Vector index build can starve those workloads of CPU and memory, introducing performance issues, such as increased latency or even causing timeouts for the rest of the application. RegattaDB makes index construction an explicitly governed operation. The `parallelism` parameter (`FULL`, `HIGH`, `MEDIUM`, `LOW`) controls how many cores each node dedicates to the build, and can be set globally or overridden per node. You also choose which nodes build and when - so you can build on one set of nodes while another set continues serving production traffic at full speed.

Distributed with minimal cross-node overhead. When you create a vector index on a column, the table's data is already natively distributed across the cluster's nodes. Each node builds its own HNSW or IVFFLAT structure over the rows it already stores — independently and concurrently, with almost no inter-node communication. A four-node cluster can build four indexes in parallel, and no vector payloads are shuffled across the network.

The following example demonstrates the flexibility of vector index builds in RegattaDB. Here, we use the `ALTER INDEX` statement to execute a rolling build that targets a subset of nodes at a time. The `parallelism` parameter is set to `HIGH`, and is overridden for nodes 4 and 2 to fine-tune resource consumption. There is complete control over both the execution topology and per-node resource usage.

Step 1: Build the index only on nodes 3 and 4,

CREATE INDEX docs_embedding_hnsw_cosine
ON docs USING HNSW (embedding COSINE)
WITH (
    parallelism = HIGH,
    modules = ((3), (4, MEDIUM)),
    ef_construction = 64,
    m = 16
);

Step 2: Check build progress per node.

SHOW VECTOR INDEX MODULES IN INDEX docs_embedding_hnsw_cosine;

Step 3: Once nodes 3 and 4 reach COMPLETE,

extend the index to nodes 1 and 2 with minimal CPU impact.

ALTER INDEX docs_embedding_hnsw_cosine

ADD MODULE 1,

ADD MODULE 2 LOW;

Searching: Massively Parallel, SQL-Native, Precision-Routed

Vector search in RegattaDB leverages the exact same query planner and optimizer as any traditional SQL query

When a vector search query arrives, any node in the cluster can act as its coordinator. This coordinator fans the request to the relevant nodes, which search their indexes in parallel. After computing their local top-k candidates, these nodes return their findings to the coordinator, which performs a final merge step to determine the global top-k results.

From the application side, it is standard SQL:

SELECT doc_id, tenant_id

FROM docs

ORDER BY embedding <=>

'[0.014, -0.092, 0.337, 0.118, 0.044, -0.201, 0.009, 0.411]'

LIMIT 10;

Query behavior is tunable inline — search strategy, HNSW probe depth, and other parameters are set through the `PARAMS` clause:

SELECT doc_id, tenant_id

FROM docs

ORDER BY embedding <=>

'[0.014, -0.092, 0.337, 0.118, 0.044, -0.201, 0.009, 0.411]'

LIMIT 10

PARAMS (

hnsw_ef_search = 128,

search_type = APPROX

);

Vector search combines naturally with standard SQL filtering — any `WHERE` clause works alongside vector distance ordering:

SELECT doc_id, body

FROM docs

WHERE tenant_id = 42

ORDER BY embedding <=>

'[0.011, -0.101, 0.341, 0.107, 0.031, -0.194, 0.015, 0.405]'

LIMIT 5;

Because vector search goes through RegattaDB's query optimizer, it benefits from the same dynamic optimizations as any other SQL query - the optimizer chooses execution strategies rather than treating every vector query the same way regardless of data shape.

Precision routing. When your data is logically segmented, sometimes there is no need to query the entire cluster, only the nodes that contain relevant data. RegattaDB allows you to target vector searches directly at the nodes containing the relevant data. Limiting the search space to only the necessary nodes reduces the blast radius of individual requests, which translates to higher overall throughput.

SELECT doc_id, body

FROM docs

ORDER BY embedding <=>

'[0.014, -0.092, 0.337, 0.118, 0.044, -0.201, 0.009, 0.411]'

LIMIT 10

PARAMS (modules = (0, 1));

The rest of the cluster is completely unaffected by this query.

How RegattaDB Differs from Other Approaches

Pinecone, Qdrant, pgvector, and RegattaDB all support the same vector indexing methods (HNSW, IVFFLAT). The difference is where the control plane lives, where application data is stored, and what the operator is expected to manage.

pgvector

pgvector is a strong fit when you want vector search inside PostgreSQL on a single database instance. It supports exact search by default, approximate HNSW and IVFFLAT indexes, and parallel index build settings through PostgreSQL maintenance workers.

But pgvector itself is not a distributed vector engine. Multi-node routing, shard-aware build placement, and cluster-wide top-k reduction are not part of the extension - those concerns are pushed to the surrounding PostgreSQL ecosystem.

RegattaDB bakes that distributed execution model into the database layer itself - so multi-node routing, build placement, and cluster-wide top-k reduction work out of the box without assembling external components.

Qdrant

Qdrant is a vector database with a  distributed architecture, including sharding, replication, and user-defined shard keys. But it is not a relational database, it does not support SQL, and it has no OLTP or OLAP capabilities.

This means vectors in Qdrant live in a separate system from your application’s relational data. While you can duplicate simple attributes into Qdrant's metadata payloads for basic filtering, Qdrant lacks the rich expressiveness of SQL, such as relational JOINs or transactional logic. For complex queries, this architectural split forces your team to manually coordinate two distinct systems at the application layer or maintain complex synchronization pipelines while constantly battling consistency issues. In RegattaDB, vectors sit alongside relational data in the same database, queried with the same SQL, and governed by the same transactional guarantees. There is no separate system to synchronize, no cross-system joins, and no parallel infrastructure to manage.

Pinecone

Pinecone optimizes for a different goal: managed vector infrastructure behind an API. That makes it a good fit for teams that want to get started with vector search quickly without managing any infrastructure themselves. However, there is no direct control over how or where the index is built, and similarly to Qdrant, you are forced to continuously duplicate your transactional/relational data into Pinecone just to filter search results. There is no shared schema with your transactional/relational data, no SQL support, and no OLTP or OLAP capabilities.

RegattaDB is aimed at teams that want vector search inside the database, governed with SQL, and collocated with the rest of the application's data model.

Putting It All Together

The end-to-end workflow lives entirely in SQL — no separate SDK, no external service, no context switch between "database work" and "vector work":

1. Create a table with a vector column

CREATE TABLE docs (

doc_id BIGINT PRIMARY KEY,

tenant_id INTEGER,

body VARCHAR(2048),

embedding VECTOR(8)

);

2. Insert data

INSERT INTO docs (doc_id, tenant_id, body, embedding)

VALUES

(101, 42, 'Distributed databases and vector search',

'[0.014, -0.092, 0.337, 0.118, 0.044, -0.201, 0.009, 0.411]');

3. Build a vector index with controlled parallelism

CREATE INDEX ON docs USING HNSW (embedding COSINE)

WITH (parallelism = HIGH);

4. Monitor build state per node

SHOW VECTOR INDEX MODULES IN INDEX docs_embedding_hnsw_cosine;

5. Search — approximate by default when an index exists

SELECT doc_id, body

FROM docs

ORDER BY embedding <=>

'[0.011, -0.101, 0.341, 0.107, 0.031, -0.194, 0.015, 0.405]'

LIMIT 5;

6. Force exact search when you need perfect recall

SELECT doc_id, body

FROM docs

ORDER BY embedding <=>

'[0.011, -0.101, 0.341, 0.107, 0.031, -0.194, 0.015, 0.405]'

LIMIT 5

PARAMS (search_type = EXACT);

Schema definition, data loading, index creation, monitoring, and querying all use the same SQL connection your application already has.

Vector indexing in RegattaDB is not a separate subsystem bolted onto the database — it is part of the database. Builds are controlled and transparent: you decide which nodes build, how many cores they use, and you can inspect progress at any time. Searches are parallelized and optimized by the same query planner that handles every other SQL workload. Everything is governed through SQL, lives alongside your relational data, and behaves predictably at cluster scale.