Back in August 2024, shortly after I joined Pinecone, we were GA’ing our shiny new Serverless offering, and our data plane (the part that stores your vectors and answers your queries) was powered by ~77 managed Postgres (PG) databases across AWS, GCP and Azure. At the end of September 2026 we deleted the last one. Everything those databases used to hold was migrated live to either object storage or FoundationDB (FDB) without stopping writes. Today, we’re paying about 20× less for all of it.
Before you grab a pitchfork: Postgres is great. It didn't work for us as a metadata store because it wasn't a good fit to begin with. We chose it back in 2023, mostly because we needed something available as a managed service on every cloud and didn't have the capacity to run anything ourselves. We still run plenty of Postgres outside the data plane, and even a bit of SQLite sneaks in here and there. In this post, we'll tell you the story of how we migrated off it, focusing on what it takes to migrate live, self-hosting FoundationDB, and lessons learned along the way.
What the data plane keeps track of
Pinecone serverless stores index data as immutable files in object storage. Every write first lands in our write-ahead log (WAL), index builders turn the WAL into files, query executors load whichever files they need to answer a query. Something has to keep track of which files make up an index right now, where each namespace (a partition of an index) keeps its data, which workers are alive to serve it. That bookkeeping is the metadata. All of it used to live in Postgres. Object storage, where the rest of our data lives, is a poor fit for it. You can build a database entirely on object storage, but metadata is tiny and read very frequently, and some of it gets written just as often, so per-request latency and cost add up fast.

What managed Postgres cost us
A managed product gives you nice things like backups, replication and failover out of the box. It tries to give you a hands-off or at least low-touch experience. But no guarantees come without assumptions, and we saw firsthand that “managed” doesn’t actually mean “reliably guaranteed to behave the same under extremely variable workloads”.
In less than three years we merged about a hundred changes that resized, re-tiered or retuned these databases, and roughly a fifth of them just wrote down what on-call had already click-ops'ed™ through in a console during an incident. Our AWS fleet went back and forth between serverless and provisioned instances four separate times as the cost and latency trade-offs changed. Each cloud had its own quirks: on AlloyDB resizing is a failover, on RDS running out of connections once ended in a cross-zone failover, and only AWS could autoscale back then. We also had to take engine upgrades we mostly didn’t want or need, and ironically the ones we did need, we sometimes couldn’t even do because some databases had too many tables. Oh, and every now and then a database would just restart, which usually led to a blip of unavailability while it came back.
The worst of it was mostly on us. Our original design created PG tables, plural, per Pinecone index. In hindsight this was a design decision that would prove not to scale well, but it made sense given the constraints we had back then, and that on its own would have been mostly fine at the scale we were aiming for. But of course, assumptions fall apart: in each data plane, we run internal checkers that keep creating indexes in a loop to exercise the whole lifecycle. A bug in those checkers meant their indexes never got cleaned up, so we held onto all of their tables. Those checkers created an index every five seconds (about 17,000 a day, per environment, across seven environments). We'll spare you the math on this one. Millions of empty, garbage tables were left behind. Millions. It got so bad that in August 2024 AWS warned us that one of our databases was approaching transaction ID wraparound. Turns out that PG numbers transactions with 32 bits, so about 4 billion IDs, and every table has to be frozen before the counter gets halfway around, or PG stops accepting writes. Freezing all of those tables took manual vacuums that ran for more than 40 hours. We put ourselves into a situation where we needed to have our best engineers figuring out this arguably niche Postgres mechanism most people never had to think about.
At any given time, someone on the team was babysitting a Postgres database.
Migrations, migrations, migrations
We didn't remove PG in one go. Each kind of database left with a different project.

We first started with the vector directory, which was a system of record mapping vector IDs to files and offsets. In 2025, through the “Clustering to Slab” migration, our new slab architecture made it possible to place this data in a new object store file (internally called vlookup) that exists for each slab. This architectural migration was a legendary feat, and deserving of its own post coming soon.
Our WAL files were already in object storage, but the metadata and consistency layer had lived in PG, because S3 didn't support conditional writes until late 2024. In December 2025 we moved the metadata to object storage too, and let it handle consistency using conditional writes. This too was a pretty hefty project, and a story for another day.
Together, those two kinds of databases were more than half of what we spent on managed PG. The remaining two were smaller in data size and cost, but pretty much every read and every write in the data plane touched the "system" and "control" databases. This is the migration (or more precisely, the set of migrations) we're going to cover in the rest of this post.
Why FoundationDB
We'd known for a while that we needed to get off Postgres, but it kept getting pushed back. BYOC was the forcing function. With BYOC we run inside our customers' own cloud accounts, where they provide and maintain everything. Needing RDS there adds to their operational burden, and in orgs that only allow an approved list of cloud services, it could be a non-starter. We wanted one metadata store that runs the same way anywhere k8s runs.
FoundationDB is an open-source, distributed key-value store with ordered keys and fully serializable transactions across any set of keys. It's the metadata layer behind systems like Snowflake and Datadog. It's tested with deterministic simulation, and it comes with a maintained k8s operator. Today each of our clusters runs its own FDB cluster.
The other reason is that our workload had always been key-value. We had intentionally never used joins and every lookup was by key or key range, so a distributed SQL database would have meant running a query engine we didn't need. Running PG ourselves wouldn't have fixed the real problem either: we'd have had to run HA ourselves. A pooler like PgBouncer would probably have handled the connection limits, but every write to a shard still goes through a single primary, so the only ways to grow a shard are a bigger machine or splitting it by hand. And what kept growing for us was the number of namespaces, which FDB handles by splitting and moving key ranges across its servers on its own.
FDB had been on our radar since 2023 and was the obvious first thing to try. A quick test later showed the trade-off we expected: PG was faster for single-key reads, and FDB was faster for batched writes.1

From tables to key ranges
Going from SQL to a key-value store means a bunch of work the database used to do for you is now your problem. Let’s look at the table that holds our namespace metadata:
CREATE TABLE mappings (
id VARCHAR PRIMARY KEY,
index_id VARCHAR NOT NULL,
namespace VARCHAR NOT NULL,
status VARCHAR NOT NULL,
deleted_at TIMESTAMP,
...
);
CREATE UNIQUE INDEX ON mappings (index_id, namespace, deleted_at);
CREATE INDEX ON mappings (index_id, status);
CREATE INDEX ON mappings (id, status);In PG, you simply declare an index. FDB just has sorted keys, so every index becomes a range of keys we write ourselves, in the same transaction as the record:
fn write_mapping(trx: &Transaction, m: &Mapping) {
trx.set(&RECORDS.pack(&(m.index, m.id)), &m.encode_to_vec());
trx.set(&BY_NAMESPACE.pack(&(m.index, &m.namespace, m.deleted_at)), m.id.as_bytes());
trx.set(&BY_INDEX_STATUS.pack(&(m.index, m.status, m.id)), b"");
trx.set(&BY_STATUS.pack(&(m.status, m.id)), m.index.as_bytes());
trx.atomic_op(&COUNTS.pack(&m.index), &1i64.to_le_bytes(), MutationType::Add);
}Every FDB key and value is plain bytes. pack turns a tuple like (index, namespace, deleted_at) into bytes that sort the same way the tuple does, so "everything under this index" is a single range read. We encoded values as protobuf, which our data plane already used everywhere, so we could add fields without rewriting old records. And counting rows became an atomic counter, which concurrent writers can bump without conflicting with each other (as long as they don't also read it).
Since we now maintained the indexes ourselves, we needed to make drift impossible to miss. So we made every FDB store implement the same Rust trait as its PG predecessor, and both ran the same test suite plus randomized property tests. After every FDB test, a checker rebuilt every index key from the records alone and diffed the result against what was actually stored:
let expected: BTreeMap<_, _> = scan(&trx, &RECORDS).await
.into_iter()
.flat_map(|(key, m)| index_entries(&key, &m))
.collect();
let actual: BTreeMap<_, _> = scan_all(&trx, [&BY_NAMESPACE, &BY_INDEX_STATUS, &BY_STATUS]).await;
assert_eq!(expected, actual, "an index drifted from its records");You only write once
One way to move live data between databases is to write to both of them for a while. Stripe described the canonical four steps: dual-write, move reads, move writes, then delete the old data. But it’s a well-known trap, sometimes referred to as the dual-write problem: you can't write to two separate systems atomically. Sooner or later one write succeeds and the other doesn't, so you need a reconciler to find and repair the difference.
Our first design was dual-write as well. During review, a teammate suggested a different rule: in any phase of a migration, a write goes to exactly one database, while reads are allowed to fall back from one database to the other. We ended up applying it to every piece of metadata we moved.
From safe and easy to hard and scary
Some records are ephemeral by nature (e.g. leases), so data loss becomes a non-issue. Other records belong to a single service that can tolerate a short pause, so you can just switch writes over, copy what's left, and you're done. That covered most of the tables we had left. From there, the more complex the access patterns and the more critical the table, the harder the migration got.
Data we could rebuild
Manifests are the list of files that make up a namespace, and every query reads one. Copying everything and flipping doesn't work here, because manifests keep changing while you copy. But they're also derived, since an index builder can always rebuild the newest manifest from the WAL. So we could migrate them by reading through first instead of doing one big copy up front, in four steps:

First, reads learned to fall back from FDB to PG. At this point, as expected, we saw a 100% fallback rate, because nothing was on FDB yet. Then writers switched to FDB, and we started seeing the fallback rate steadily drop as FDB filled up with new manifests. Then a backfill copied the older manifests across, and finally, reads stopped falling back.
Falling back is only correct while a manifest missing from FDB means "not moved yet" and a manifest present there means "newest". If you backfilled before flipping writes, PG could still get new manifests during the backfill, and you'd then have to figure out which one is newer. That's why the backfill has to come only after the writers move.
To make things more interesting, switching writers is a rolling restart, which means for a few minutes old and new pods publish side by side, and the same index could get a new manifest in both databases, giving you the exact same problem of figuring out which one is newer.
Fortunately, every manifest records how far into the WAL it covers, so the backfill only ever replaced an FDB manifest with a newer one. In the worst case, one of two competing manifests gets dropped, and that only costs work, since manifests can be rebuilt. The index builder replays the WAL from wherever the surviving manifest left off, and the files a compaction would have replaced are only ever cleaned up by garbage collection, which we paused for the migration. Before cutting each cluster over, a verification pass compared those WAL positions and made sure nothing in PG was newer than its FDB copy.
The source of truth
The scariest one by far was migrating the table holding our internal mappings. These say where each namespace's data lives. Nothing rebuilds them if they're lost, lots of different services write to them, and nearly every reader and writer in the data plane depends on them.
We needed as much assurance as we could get before starting, so we made automated FDB backups a hard requirement on every production cluster: a continuous backup that trails the live database by well under a minute, plus daily snapshots.
We weren't going to stop writes for a whole cluster, so the mappings moved one index at a time, and every write had to know which side of the move its index was on. A small state table in PG tracked that. It helped that writes to these mappings are infrequent, so each index could tolerate a few seconds of blocking.

A write to an index always started by looking up that index's state.
While the index was on PG, the write locked the state row and wrote to PG in the same transaction, so the migration could never flip the index from underneath it.
While the index was migrating, writes waited and retried.
Once the index was on FDB, writes still glanced at the state but no longer held the lock. They went straight to FDB.
To keep the write freeze as short as we could, we first copied all the rows from PG to FDB. Keep in mind, though, that this copy happened live and writes never stopped, so there would always be more rows to copy, and some freeze was unavoidable. Once the first copy completed, we blocked writes and migrated (and verified) the small diff of new writes that had piled up. For a typical index that was way less than a second (the longest pause we recorded on a live index was about three and a half seconds). Reads were never blocked, every other index kept taking writes the whole time.
Once every index was on FDB, the small state table went away with the rest of PG.
What self-hosted FoundationDB costs us
Self-hosting FDB brings its own set of challenges. You usually have mostly yourself to blame if something goes wrong, and there are no support tickets to file or anyone to escalate to. What this meant for us was learning the hard way, and writing some additional tooling to address QoL gaps.
The upgrade that killed all storage servers at once
One day, we started a routine deploy, like we always do. An FDB patch upgrade also changed a sidecar's container image, which meant the k8s operator had to recreate the storage pods instead of updating them in place. It's supposed to do that one failure domain at a time, which our redundancy_mode: double survives just fine. The (old) operator version we were running had a bug: with zones taken from node labels, it looked them up in an environment variable that's never set, so every storage pod looked like it was in the same zone, and the operator went ahead and deleted all of them at once (the pods, not the data, which sat on persistent disks), on every FDB cluster it touched.
The other clusters got new nodes quickly and were down for just a few minutes. One GCP cluster was in a zonal capacity shortage (you probably know which region) and didn't get any. Our main dashboard was painted red, and that cluster had a full read and write outage for about 25 minutes, until we freed up room by hand. The data came back intact as soon as the storage pods were scheduled, since the operator only deleted the pods and each new one reattached to its old disk. The bug had already been fixed upstream.2 We upgraded the operator and changed its deletion mode to remove one pod at a time3, which made things a lot simpler.
Whales, hippos and e-brakes
The mapping migration ran indexes smallest-first, and saved the largest ones, the "whales" 🐳, for a careful one-at-a-time pass. On one cluster we ran it with way too much parallelism, naively thinking that non-whale indexes wouldn't amount to much load, but what we didn't think of was that all the indexes sitting just below the whale threshold (near-whales, if you will) could finish at exactly the same moment. About 660,000 rows hit FDB in under a minute. When FDB's storage servers fall behind, it starts throttling new transactions, and past a hard limit (a.k.a. the e-brake) a storage server stops pulling new writes from the logs until it catches up. The storage disks saturated, the queue blew past the throttle and into the e-brake, and for about four minutes a large share of that cluster's requests failed. At least we learned an important lesson:

We had never pushed FDB that hard before, so the migration tool had no rate limit. What it did have was four knobs:
--shards: which control databases to copy from, all at once--index-parallelism: how many indexes per database at a time--fdb-write-concurrency: how many FDB transactions per index at a time--fdb-write-batch: how many rows per transaction
None of these is a rate, but multiplied together they show how many rows are in flight at any moment. That afternoon we had:
But FDB works in writes/s, so let’s translate: each of our rows is 4 writes (the record plus 3 index entries), about 75 bytes each. For keys and values that size, the expected throughput as advertised is roughly 20,000 writes a second per core (on our clusters the disks set the real ceiling, so treat it as a ballpark). We run five storage servers and keep two copies of everything, so:
At the peak, FDB measured about 190,000 writes (47,000 rows) a second coming in, roughly 4 times that. A hippo's keys sit right next to each other, so the hottest storage server was taking in about double the average. That storage server's disk couldn't keep up, and its queue went from 50 MB to the 1.5 GB e-brake in about two minutes.
FDB commits a write once it's safely on the transaction logs, and the storage servers apply it afterwards. So our commits stayed fast the whole time. But FDB's ratekeeper, which throttles new transactions as the storage queues fill up, cut the limit from effectively unlimited to about ten transactions a second, and every transaction has to fit under that limit, reads included. Our migration ran at the same priority as customer traffic, so customer requests had to compete with it, and our query routers not retrying FDB's retryable errors made it worse. In hindsight, the migration tool should have used FDB's batch priority, which exists exactly so bulk jobs get throttled before everyone else.
That evening we ran the rest with just 250 rows in flight in total, which came out to about 13,000 rows a second, right at the ~12,500 we estimated above, with no headroom to spare. The queue topped out under the throttle, and nothing failed:

SQL, on top of FoundationDB
Moving off PG meant losing psql, and our team's muscle memory is very much SELECT * FROM. FDB's CLI works only with raw keys and bytes. But the values we stored were protobuf, so reading them raw was a non-starter.
So we built fdbsql, a small read-only SQL shell over our FDB stores.
It's built on Apache DataFusion. Each FDB store becomes a DataFusion table. A scan pages through the store's key range using snapshot reads, handing out Arrow batches to DataFusion. When a query pins the first column of the key, the scan narrows down to that key range instead of reading the whole store.
Nobody writes a schema for these tables, the columns come straight from the protobuf definitions the stores already have. One line in our protobuf build makes every message in the data plane queryable:
// build.rs
builder = builder.type_attribute(".", "#[derive(::pc_introspect::Introspect)]");Add a field to a proto and it just shows up in SELECT *.
Six long months
The Rust implementation for the FDB stores, the migration code, the scripts, utils, monitors and the ops themselves took six long months, and it would have taken a lot longer without coding agents. Quickly turning thoughts into working POCs sped the whole thing up massively. Agents also made room for things we'd probably have skipped: before running any of this in production, we had Claude Code write a formal model of the mapping migration in TLA+ (which we reviewed for completeness), then had a model checker go through every interleaving of two pods, two indexes and the migration tool. It checked 1.5 million states. Along the way it even found an actual bug in our runbook.4
No more Postgres
On September 25 we merged the change that removed PG from the data plane's code, deleting roughly 40k LoC.5 Between September 27 and 29, a routine deploy destroyed the last 24 control databases. The data plane's PG bill went to zero, and the FDB clusters that took over cost about a third of the databases they replaced.6

Ever since a lot of us got here, it's been "RDS this" and "Postgres that", and we've been refactoring, migrating, downsizing and deleting things ever since. Shutting down the last Postgres pieces in the data plane really felt like a wrap-up of years of joint work, spread across a lot of teams and engineers.
Postgres and object storage are good defaults, but at some point scale and cost push you into making an opinionated choice, and for us that was FDB.
By the way, if making opinionated choices about distributed systems sounds like your kind of work, we're hiring!
Notes
- PG won single-key reads by 1.4 to 2×, but both sides stayed in single-digit milliseconds. In production our query routers answer about 98% of these lookups from cache, so the slower single-key reads add well under a millisecond to an average query. ↩︎
- fdb-kubernetes-operator #2465, released in v2.27.0 in May 2026. We were still running v2.22.0. ↩︎
- Strictly, the operator's
ProcessGroupdeletion mode removes one process group at a time: an FDB server process plus the pod it runs in. We run one storage server per pod, so in practice it's one pod at a time. ↩︎ - A pod that hadn't picked up the "new indexes start on FDB" setting yet could still create an index on PG after we had already counted them. The runbook got a new step that waits for the setting to reach every pod. ↩︎
- The PR was titled THE GREAT POSTGRES EXTINCTION. There were knife emojis involved 🔪. ↩︎
- Spend is grouped by database name across AWS, GCP and Azure. FDB counts the nodes it runs on and their disks. ↩︎
Was this article helpful?






