Architecture decisions · Architecture and technical rescue

Do we need a search engine or a vector database next to our database?

Search needs to be better, and the proposal is a search engine or a vector database beside the database the team already runs.

01

How it is diagnosed

Write down what must stay consistent between what is stored and what is found; then run labelled queries on your own data against the database's own search and against the engine.

02

The options, side by side

Switch on a situation and see what each option does with it.

A

Search inside the database you already run: full-text, and pgvector for meaning-based search

A record is deletedIt leaves every search in the same commit.

The search's first configuration is wrongThe labelled queries show it before users notice.

The corpus grows tenfoldTest at the new size first; the choice may flip.

When it fits
The data is already in the database, the corpus is modest and the ranking needs are ordinary.
Trade-offs
Ranking and facets are limited to what the database offers, and one database carries the load.

B

A search engine or a vector database beside it (OpenSearch, Elasticsearch, or a dedicated vector store)

A record is deletedIt leaves once the sync runs; a failed sync leaves it in results.

The search's first configuration is wrongIn the lab, the engine's first query returned nothing for half the searches until it was changed to match across fields.

The corpus grows tenfoldIt scales by adding nodes to the cluster.

When it fits
Volume, facets, relevance tuning or search analytics go beyond the database.
Trade-offs
A second store to run, sync, secure and back up, with the access rules repeated inside it.

C

A hosted search service

A record is deletedAs with the engine, across a network.

The search's first configuration is wrongThe labelled queries show it, if there are any.

The corpus grows tenfoldMove to a larger tier, and pay for it.

When it fits
Nobody should run the engine, and the data may leave your systems.
Trade-offs
Data location rules apply; the sync and the access rules are still yours.

03

What decides between the options

The size of the corpus and its growth, ranking or facet needs the database cannot meet, how soon a write must be searchable, and who will run the second system.

What decidesA Search inside the database you already run: full-text, and pgvector for meaning-based searchB A search engine or a vector database beside it (OpenSearch, Elasticsearch, or a dedicated vector store)C A hosted search service
Searchable right after a write What was stored and what is found should not disagree. suits it In the same transaction. needs work After the index's next refresh: a median of 713 ms in the lab. needs work After the sync.
Systems to run For a small team, every extra system is a standing cost. suits it One. limited Two, and the sync. needs work One more contract, and the sync.
Relevance and speed, at this size It is the usual reason to add an engine. suits it Level with the engine at the lab's scale; test at yours. suits it Level, once tuned; more headroom to grow. suits it Depends on the service; headroom to grow.
Access rules A copied rule drifts from the original. suits it Written once, in the query. limited Copied into the engine. limited Copied into the service.
Facets, relevance tuning and search analytics When search is the product, these features decide more than speed does. limited Limited to what the database offers. suits it This is what it is built for. suits it Included, within what the service offers.
Searchable right after a write A B C

What was stored and what is found should not disagree.

  • A · Search inside the database you already run: full-text, and pgvector for meaning-based search suits it In the same transaction.
  • B · A search engine or a vector database beside it (OpenSearch, Elasticsearch, or a dedicated vector store) needs work After the index's next refresh: a median of 713 ms in the lab.
  • C · A hosted search service needs work After the sync.
Systems to run A B C

For a small team, every extra system is a standing cost.

  • A · Search inside the database you already run: full-text, and pgvector for meaning-based search suits it One.
  • B · A search engine or a vector database beside it (OpenSearch, Elasticsearch, or a dedicated vector store) limited Two, and the sync.
  • C · A hosted search service needs work One more contract, and the sync.
Relevance and speed, at this size A B C

It is the usual reason to add an engine.

  • A · Search inside the database you already run: full-text, and pgvector for meaning-based search suits it Level with the engine at the lab's scale; test at yours.
  • B · A search engine or a vector database beside it (OpenSearch, Elasticsearch, or a dedicated vector store) suits it Level, once tuned; more headroom to grow.
  • C · A hosted search service suits it Depends on the service; headroom to grow.
Access rules A B C

A copied rule drifts from the original.

  • A · Search inside the database you already run: full-text, and pgvector for meaning-based search suits it Written once, in the query.
  • B · A search engine or a vector database beside it (OpenSearch, Elasticsearch, or a dedicated vector store) limited Copied into the engine.
  • C · A hosted search service limited Copied into the service.
Facets, relevance tuning and search analytics A B C

When search is the product, these features decide more than speed does.

  • A · Search inside the database you already run: full-text, and pgvector for meaning-based search limited Limited to what the database offers.
  • B · A search engine or a vector database beside it (OpenSearch, Elasticsearch, or a dedicated vector store) suits it This is what it is built for.
  • C · A hosted search service suits it Included, within what the service offers.

04

What the work looks like

The step of the offer where a case like this usually starts:

03

Architecture assessment

Findings, risks, options and next steps, in writing. A good starting point when the scope is not yet clear.

See the service: Architecture and technical rescue →

05

Is this your case?

Send it with this problem already selected; the next page asks which options you considered and a little context. No verdict on your system: that only comes once I understand it.

Send this case →

Or write to me directly at contacto@danielcolaco.pt.