All posts
RivestackEngineering

Building Rivestack: a Postgres your app and your agents can share

OpsaFlow 5 min read

Rivestack is a product we build and operate ourselves. It is managed PostgreSQL for AI applications: pgvector and pgvectorscale on dedicated nodes with local NVMe, at a flat monthly price, with a hosted MCP server so that the agents working on your product can query the same database the product does.

This post is about the decisions behind it. Most of them are the opposite of what the market defaults to, so they are worth explaining.

One database, not two

The usual shape of an AI feature is a relational database for the application and a separate vector store for the embeddings. That works until the first query that needs both: "the ten most similar documents, but only the ones this user is allowed to see, from the last ninety days". Now you are filtering in one system, searching in another, and reconciling the two in application code.

Rivestack keeps the vectors next to the rows they describe. pgvector provides HNSW indexes, pgvectorscale adds DiskANN, and both live inside ordinary Postgres. A similarity search is a SQL query, so it can filter, join, and run inside a transaction like everything else. Semantic search, recommendations, and RAG all become a question of schema design rather than of keeping two data stores in agreement.

It is not always the right answer. Whether pgvector or a dedicated vector database suits you depends on your vector count, dimensions, filters, throughput, and latency targets, and the Rivestack site says so instead of claiming to win every comparison.

Dedicated and always on

Every dedicated plan is its own compute with local NVMe, running all the time. There is no scale-to-zero, which means there is no first query that waits for a database to wake up.

That is a trade. Serverless pricing is attractive when a database is idle most of the day. It is much less attractive when an agent or a search box needs an answer in a few milliseconds and the index has to be read back from cold storage first. For vector workloads, where the index wants to stay in memory and on fast disk, we chose the boring option: a machine that is yours and is on.

A price you can know in advance

Rivestack charges a fixed monthly price per node. There is no charge per query, per gigabyte of egress, or per vector stored.

At the time of writing, dedicated plans in the EU Central region start at $29 a month for a single node with 1 vCPU, 2 GB of RAM, and 30 GB of usable NVMe, and run up to nodes with 8 vCPU and 16 GB from $159. There is a smaller hobby tier from $9. The numbers will change over time; the principle should not. A database bill ought to be something you can state before the month starts, which is the same reason we quote our own client work at a fixed price per phase.

Benchmarks with the recall attached

Vector database benchmarks have a well-known trick: quote queries per second and leave out recall. Any approximate index gets faster if you let it return worse results.

So Rivestack publishes throughput, latency, and recall together, for every node size. On 250,000 vectors of 1,536 dimensions with an HNSW index, the smallest dedicated plan measured 983 queries per second at 0.93 recall@10 with a 3.8 ms median, and the largest measured 4,465 at 0.95 recall with a 3.4 ms median. The index parameters, the PostgreSQL version, and the pgvector version are listed next to the results, and the tool that produced them, pgvector-bench, is open source.

The numbers themselves matter less than the fact that you can rerun them. A benchmark you cannot reproduce is an advertisement.

Giving agents the database, carefully

The part of Rivestack that is newest is the MCP server. Point Claude Code, Cursor, or any other MCP client that supports remote servers at mcp.rivestack.io/mcp, and the agent can list databases, read schemas, run SQL, create vector indexes, and run similarity searches.

Handing a language model a connection to a production database deserves some suspicion, so the defaults are conservative:

  • Read-only unless you say otherwise. Write tools do not appear to the agent at all until the connection is opened with read_only=false.
  • Nothing that costs money happens in one step. Creating a database returns a price preview first and needs a second, confirmed call.
  • Agents leave the same trail as people. Their actions land in the same activity log as backups and restores.
  • Authentication is OAuth or an API key, so access can be scoped and revoked like any other credential.

None of this is exotic. It is the same least-privilege thinking we apply to CI pipelines and service accounts, applied to a new kind of client.

The operations are the product

Anyone can start Postgres. The reason to pay for a managed one is everything that happens afterwards: daily backups, point-in-time recovery (7 days on the smallest plan, 14 on the rest), monitoring, and failover. Plans above the smallest become highly available when you add a second node, with Patroni handling the failover. There is a Terraform provider, so a cluster and its databases can be declared in the same repository as the rest of your infrastructure. Nodes run in Germany, Virginia, and Singapore.

This is the same work we do for clients, packaged so that it does not need us in the room.

What it does not promise

Given that transparency is the thing we claim to be built on, the limits belong in the same post as the features:

  • The smallest plan is a single node. It is always on, but it has no failover. High availability starts when you add a second node.
  • Migration is dump and restore. Downtime depends on the size of your data and how busy your writes are. Rivestack does not promise a zero-downtime cutover.
  • Hosting in Germany is a fact about location, not a certificate. EU Central nodes are in Falkenstein. That is not, by itself, a compliance certification, and the site does not describe it as one.
  • pgvector is not always the answer. See above.

Why we show it

For the same reason we show Dioveo: it is checkable. You can start a trial, load your own vectors, rerun the benchmarks, connect an agent, and email support, which reaches the people who built it.

If you are deciding where your embeddings should live, rivestack.io is the place to start. If the question is larger than the database, for instance the pipelines that feed it, the infrastructure around it, or the security review ahead of it, we would like to hear about it.

Keep reading