Why I Added a Dedicated Vector Database to Our Knowledge Base—Then Removed It Three Months Later
This article walks through a real-world knowledge base project: why a dedicated vector database seemed like the obvious choice for semantic search, the three operational costs it introduced, how we replaced it with a relational database plus a vector extension, and the specific signals that should make you choose a dedicated vector database instead. It includes table design, indexing and query examples, and a pre-launch validation checklist.
1. Where It Started: A Simple Retrieval Requirement
When we kicked off our internal knowledge base project last year, the first problem we hit was straightforward: documents had to be findable “by meaning,” and fuzzy matching in a traditional relational database simply couldn’t do that.
The retrieval team surveyed the options and reached a unanimous conclusion: install a dedicated vector database. There were plenty of choices on the market—pick one and install it. That’s what we did. Three months later, we took it out again.
This article covers four things: why we installed it in the first place, what extra trouble it created, how we solved the problem with a relational database plus a vector extension, and when you should make the opposite choice and go with a dedicated vector database.
2. The Principle: Why Text Matching Is Never Enough
A traditional database retrieves by string matching. If a user searches for “refund,” it can only return paragraphs that literally contain the word “refund.” But real users don’t phrase things that way. They’re far more likely to type something like:
I don’t want the thing I bought anymore—when do I get my money back?
Not a single word here mentions “refund,” so literal matching drives recall to zero. This isn’t a gap that tokenization or a synonym table can close—the combinations of equivalent expressions are open-ended, and a manually maintained word list will never keep up with real-world language.
The mainstream AI approach compares along a different dimension: a model first maps each piece of text to a string of high-dimensional floating-point numbers (a step usually called vectorization or embedding). Texts with similar meaning end up close together in that space, so retrieval no longer compares characters—it compares distance. This mechanism is called vector retrieval, and the component that stores and indexes those vectors is what people call a vector database.
At this point, “just install a dedicated database” sounds like the natural move: it’s purpose-built, it’s fast, it supports several approximate nearest neighbor index algorithms, and nearly every tutorial recommends it. The catch is that tutorials only cover getting it running—not maintaining it for three years.
3. The Cost: Three Things You Take On
3.1 One More Piece of Software to Own Long-Term
Nothing that reaches production is “install and forget.” A dedicated vector database comes with its own deployment model, its own backup and recovery procedure, its own monitoring metrics, and its own upgrade path. Someone on the team has to know where the data directory lives, how to bring the process back up when it dies, at what disk watermark you need to scale storage, and whether a major version upgrade requires downtime.
Our initial assumption was “install it and we’re done.” In reality, the operational mental load doubled. For a small team with only two ops engineers, that’s a concrete cost.
3.2 Data Has to Stay Consistent in Two Places
The text lives in the relational database, the vectors live in the new one, and every write operation degenerates into a distributed consistency problem:
- Delete a document, and you have to delete it on both sides. One missed deletion and production serves “search result appears, click through, page is empty.”
- When a document is edited, it has to be re-vectorized. If the old vector isn’t cleaned up, the same passage shows up twice in the results, and the model receives three duplicate context chunks—answers get wordy and start contradicting themselves.
This isn’t a theoretical exercise; it happened to us in production. Fixing it means introducing a transactional outbox, compensation jobs, or reconciliation scripts—complexity that never needed to exist.
3.3 One More Phone Call in the Middle of the Night
When the new database goes down, search goes down with it. We used to watch a single database; now there are two, which doubles the failure surface, the alerting rules, and the on-call runbook.
One less piece of middleware means one less middle-of-the-night phone call. That line later became one of our hard criteria for technology selection.
4. The Solution: Put the Vectors Back in the Existing Database
Vector capabilities in relational databases (typically offered as an extension such as pgvector) solve exactly this: they let the existing relational database store vectors, compute distances, and sort by similarity. Feasibility comes down to two things—how you design the table and how you build the index.
4.1 Table Design: Let Vectors Live and Die with the Text
The key is to attach the vector column directly to the document table rather than create a separate table that has to be synchronized manually:
CREATE TABLE kb_document (id BIGSERIAL PRIMARY KEY,title TEXT NOT NULL,content TEXT NOT NULL,embedding VECTOR(1024), -- dimension must match the actual modelupdated_at TIMESTAMPTZ DEFAULT now());
This eliminates the double-write problem from 3.2 outright: the text and the vector are replaced inside a single transaction, and a delete is a row-level delete, so there’s no such thing as “half deleted.” When a document is updated, an UPDATE overwrites the old vector, and the duplicate-recall problem disappears on its own.
4.2 Indexing and Querying: Validate on a Small Table First, Then Tune
-- Build an approximate index only when the dataset is large; exact scan is often faster on small tablesCREATE INDEX ON kb_document USING hnsw (embedding vector_cosine_ops);SELECT id, titleFROM kb_documentORDER BY embedding <=> $1 -- cosine distance between the query vector and the contentLIMIT 5;
Three things to watch in practice. First, index construction consumes memory and takes time, so run it during off-peak hours. Second, an approximate index is a tradeoff between recall and latency—you must evaluate it with an evaluation set built from your own real user queries rather than trusting the default parameters. Third, always put the filter conditions (tenant, permissions, time range) in the same SQL statement as the vector ordering, so you don’t end up “fetch TopN first, then filter” and get empty results.
4.3 Pre-Launch Validation Checklist
- Build an evaluation set from 100–200 real user queries and measure the recall hit rate;
- Compare latency and recall between exact scan and the approximate index;
- Load-test P95 latency under concurrent queries;
- Define the backup strategy: one database, one backup, a single recovery path.
5. The Boundary: When You Should Install It After All
The single-database approach isn’t a universal answer. A dedicated vector database is the more reasonable choice when these signals appear:
- Vector volume reaches tens of millions or even hundreds of millions of entries, with continuous high-frequency writes;
- You need multiple index algorithms coexisting, with frequent parameter tuning;
- Retrieval has become an independent business line that needs resource isolation and independent scaling from the main database;
- The team already has mature platform-level operations, so one more component isn’t a burden.
The criterion compresses into one sentence: adopt it only when the benefit of one more component consistently outweighs the operational and consistency costs that come with it.
6. Closing
Taking that database out left us with a simple selection principle: use the strongest convergence tool available to keep the architecture simple, and treat a new component as debt that accrues interest—not a free accelerator. We didn’t lose semantic search. It just moved back into the database we already knew and already had someone responsible for.
