Skip to departures
Hpjadul
MAC END

How Pinecone Moved 77 Data Plane Databases from Postgres to FoundationDB

Departs
Crew
Richard Miller
Passengers
582

Pinecone migrated 77 managed Postgres databases to FoundationDB and object storage, cutting database costs by about 20× without stopping writes.

How Pinecone Moved 77 Data Plane Databases from Postgres to FoundationDB

Pinecone removed the last managed Postgres databases from its data plane in September 2026 after migrating 77 databases to object storage and FoundationDB. The work took more than two years, kept writes running during the migrations, and left the company paying about 20 times less for the systems involved.

Benny Nazimov

The result came from splitting Postgres’s former responsibilities across two storage systems. Pinecone moved data that could be stored in files, along with its consistency metadata, to object storage. It moved the remaining frequently accessed metadata to FoundationDB (FDB), a distributed key-value database. That choice also gave the team a metadata service it could run in customer cloud accounts using Kubernetes, without requiring managed Postgres there.

This was a workload and operational fit decision, not a verdict on Postgres. The team still uses Postgres elsewhere. But its data plane needed to manage large numbers of namespaces through key-based reads and writes, and that work had become expensive to operate in Postgres across three cloud providers.

What the data plane stores

Pinecone’s serverless indexes store their main data as immutable files in object storage. Writes first enter a write-ahead log (WAL); index builders turn that log into files, and query executors load the files they need. Alongside those files, the data plane needs metadata describing which files currently make up an index, where each namespace’s data lives, and which workers are available to serve it.

That metadata is comparatively small, but it’s read frequently and some of it changes often. Putting every lookup and update through object storage would add latency and cost. Pinecone had therefore used Postgres for the bookkeeping while keeping the larger index data in object storage.

Diagram comparing Pinecone cluster storage in 2024 and 2026. The earlier design used managed Postgres for the vector directory, WAL metadata, control databases, and system database. The later design stores the bulk data and some metadata in object storage, with remaining metadata in FoundationDB.
Diagram comparing Pinecone cluster storage in 2024 and 2026. The earlier design used managed Postgres for the vector directory, WAL metadata, control databases, and system database. The later design stores the bulk data and some metadata in object storage, with remaining metadata in FoundationDB.

Figure 1. The earlier clusters had as many as four types of managed Postgres databases. In the new layout, bulk data and some metadata sit in object storage, while FDB holds the remaining metadata.

Why managed Postgres became a burden

Managed databases offer backups, replication, and failover, but those features don’t remove the need to understand how a service behaves under a particular workload. In less than three years, Pinecone merged about a hundred changes to resize, retier, or retune its Postgres fleet. Around one fifth of those changes documented adjustments the on-call team had already made manually during incidents.

Cloud-specific behavior added to the work. On AWS, the team switched between serverless and provisioned instances four times as cost and latency needs shifted. Resizing AlloyDB caused a failover. On one occasion, exhausting connections on RDS led to a cross-zone failover. At the time, only AWS offered autoscaling for the relevant setup. Engine upgrades created more work: some weren’t needed, while others were blocked because certain databases had accumulated too many tables. Databases also sometimes restarted, causing short availability interruptions.

A design choice from the system’s early days made the table count much worse. Pinecone created multiple Postgres tables for each index. That was manageable at the intended scale, but internal checker programs continuously created test indexes to exercise the full lifecycle. A bug stopped those indexes from being cleaned up. The checkers created one index every five seconds in each of seven environments—about 17,000 per day, per environment—and the associated empty tables accumulated into the millions.

In August 2024, AWS warned Pinecone that a database was nearing transaction ID wraparound. Postgres uses a 32-bit transaction counter, and tables must be frozen before the counter reaches halfway around its range. Otherwise, Postgres stops accepting writes. Freezing the accumulated tables required manual vacuum jobs that ran for more than 40 hours. The incident pulled senior engineers into a maintenance problem created by the table-per-index design and the checker bug.

The team’s account of that period is blunt: someone was always looking after a Postgres database.

The migration happened in stages

Pinecone did not move every database in one operation. The vector directory left first. It mapped vector IDs to files and offsets, and the 2025 “Clustering to Slab” architecture work made it possible to store this information in an object storage file called vlookup for each slab.

WAL files already lived in object storage, but Postgres still held metadata and enforced consistency. That changed in December 2025, after S3 added conditional writes in late 2024. Pinecone moved the metadata to object storage and used conditional writes to coordinate updates.

The vector directory and WAL databases accounted for more than half of managed Postgres spending. The remaining system and control databases held less data, but almost every data plane read and write touched them. Those were the databases moved to FDB. A timeline in the company’s account shows the fleet declining from 77 databases in 2024 to zero in September 2026.

Timeline from August 2024 to September 2026 showing 77 Postgres databases declining to zero as the vector directory and WAL metadata move to object storage and system and control databases move to FoundationDB.
Timeline from August 2024 to September 2026 showing 77 Postgres databases declining to zero as the vector directory and WAL metadata move to object storage and system and control databases move to FoundationDB.

Figure 2. Each database group moved on its own schedule, taking the fleet from a peak of 77 to none.

Why FoundationDB fit the remaining work

Bring Your Own Cloud (BYOC) pushed the decision forward. In that deployment model, Pinecone runs in customers’ cloud accounts, where customers provide and maintain the infrastructure. Requiring them to provision RDS would add another service to operate and could make deployment impractical for organizations that limit which cloud services they permit. Pinecone wanted a metadata store it could operate consistently anywhere Kubernetes runs.

FoundationDB is an open-source distributed key-value store. It supports ordered keys and serializable transactions across multiple keys. Pinecone points to its use as a metadata layer by systems including Snowflake and Datadog, its deterministic simulation testing, and the availability of a maintained Kubernetes operator. Each Pinecone cluster now runs its own FDB cluster.

The workload mattered as much as the deployment model. Pinecone had deliberately avoided joins: its operations looked up individual keys or ranges of keys. A distributed SQL database would have added a query engine the data plane didn’t need. Running Postgres itself would have left the main scaling limits in place. The team would still need to manage high availability, and each shard would still have one primary handling its writes. Scaling a shard would mean using a larger machine or splitting it manually.

By contrast, the number of namespaces was growing, and FDB can split and move key ranges among servers. Early tests showed a trade-off rather than a universal performance win. Postgres was faster for single-key reads, while FDB performed better on batched writes. At the 95th percentile, the reported latency for looking up one namespace was 0.8–1.2 milliseconds on Postgres and 1.2–2.4 milliseconds on FDB across tests with 10, 10,000, and 90,000 namespaces. Creating 100 namespaces at once took 16–25 milliseconds on Postgres and 8.5–15 milliseconds on FDB.

The slower individual lookup had limited expected impact on production queries, according to Pinecone: its query routers answered about 98% of these lookups from cache. The company estimated that the difference added well under a millisecond to an average query. That context helps explain why its test results favored the migration despite Postgres’s edge on single-key read latency.

Bar chart comparing 95th percentile latency for Postgres and FoundationDB at 10, 10,000, and 90,000 namespaces. Single namespace lookups are faster on Postgres, while creating 100 namespaces together is faster on FoundationDB.
Bar chart comparing 95th percentile latency for Postgres and FoundationDB at 10, 10,000, and 90,000 namespaces. Single namespace lookups are faster on Postgres, while creating 100 namespaces together is faster on FoundationDB.

Figure 3. Test results showed lower single-namespace lookup latency on Postgres and lower latency for batched namespace creation on FDB.

Slack message from a teammate that says "so not a whale but a hippopotamus", above a search result saying the closest living relative to whales is the hippopotamus.

Replacing SQL indexes with ordered keys

Moving from SQL to a key-value store shifts some database responsibilities into application code. In Postgres, a table definition and its indexes describe how records can be found. FDB stores byte keys and values, so Pinecone had to write each index entry itself, in the same transaction as the record.

For namespace mappings, the old table had fields for an ID, index ID, namespace, status, and deletion time. Postgres maintained a unique index over the index, namespace, and deletion time, plus lookup indexes for index and status combinations. In FDB, Pinecone represented those access paths as separately packed key ranges. A write stored the record, wrote its namespace and status index entries, and updated a per-index counter with an atomic operation.

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);
}

FDB’s tuple packing preserves sort order. A tuple such as (index, namespace, deleted_at) becomes a byte sequence whose ordering makes all entries for one index available as a range scan. Pinecone encoded record values as Protocol Buffers, which the data plane already used. That let the team add fields while keeping older records readable. Atomic counter updates let concurrent writers increment a count without conflicting, provided they didn’t also read that count in the transaction.

Manually maintained indexes can drift from their source records, so Pinecone built checks into the store tests. Both the Postgres and FDB implementations followed the same Rust interface and ran the same test suite, with randomized property tests as well. After each FDB test, a checker rebuilt the expected index entries from the records and compared them with the stored entries. That made an inconsistent index visible during development rather than leaving it to emerge as a production lookup failure.

A live migration rule: one destination per write

A common online migration pattern uses dual writes: write to both databases, move reads, then switch writes and remove the old copy. The problem is that two independent databases can’t commit one atomic operation together. One write can succeed while the other fails, leaving the systems out of sync and requiring a process to identify and repair the difference.

Pinecone’s revised rule was simpler to reason about: during every migration phase, each write goes to exactly one database. Reads may try one database and fall back to the other. The team applied this rule across the metadata migrations, adapting the steps to how each record was used and whether it could be rebuilt.

Ephemeral records such as leases could tolerate loss. Some service-owned records could move with a short pause: switch writes, copy what remained, and finish. The riskiest cases were records that many services depended on and that couldn’t be reconstructed. Pinecone’s two main examples were manifests, which can be rebuilt from the WAL, and namespace mappings, which cannot.

Moving rebuildable manifests

A manifest lists the files that make up a namespace, and every query reads one. Since manifests continue changing during a copy, a single copy followed by a switch would risk moving stale information. But an index builder can reconstruct a current manifest from the WAL, which made a read-first migration possible.

First, reads began by checking FDB and falling back to Postgres. Since FDB initially held no manifests, the fallback rate started at 100%. The team then switched writers to FDB. New manifests accumulated there, and the fallback rate declined. After writers had moved, a backfill copied older manifests from Postgres. Once fallback reads were no longer needed, the team removed Postgres from the path.

Four-phase manifest migration: reads first fall back from FoundationDB to Postgres while writes remain on Postgres; writes then move to FoundationDB; older records are backfilled; finally, Postgres is removed.
Four-phase manifest migration: reads first fall back from FoundationDB to Postgres while writes remain on Postgres; writes then move to FoundationDB; older records are backfilled; finally, Postgres is removed.

Figure 4. The manifest migration moved reads, then writes, then older data. Each write went to one database throughout.

The order was essential. If the backfill started before writers moved, Postgres could keep receiving new manifests while older ones were copied. The migration would then need another way to decide which database held the latest version. Switching writers first made it possible to treat a missing FDB manifest as “not copied yet” and an existing FDB manifest as the newer version.

A rolling restart added a brief complication: old and new application pods ran side by side for a few minutes, and both could publish manifests for the same index. Each manifest records how far into the WAL it reaches. Pinecone used that position to keep the newer version during backfill. Losing one of two competing manifests could cost extra rebuilding work, but not the underlying data. The index builder could replay the WAL, and garbage collection of files that compaction might replace was paused during the migration.

Before each cluster switched fully, a verification pass compared WAL positions and checked that no Postgres manifest was newer than its FDB counterpart. That check provided a concrete condition for removing the fallback path.

Moving the mappings that can’t be rebuilt

Namespace mappings were the harder migration. They tell services where namespace data is stored, many services write to them, and nearly every data plane reader and writer relies on them. There is no builder that can recreate them if they disappear. Before beginning, Pinecone required automated FDB backups on every production cluster: continuous backups that trailed the live database by well under a minute, plus daily snapshots.

The team migrated one index at a time and kept the overall data plane serving writes. A small state table in Postgres tracked where each index was in the move. Because writes to mappings were infrequent, a brief pause for an individual index was acceptable.

While an index remained on Postgres, a write checked its state, locked the corresponding state row, and wrote to Postgres in the same transaction. That prevented the migration from changing the index’s destination during a write. Once an index entered the migrating phase, writes waited and retried. After the switch, writes checked the state but no longer needed to hold the lock before going directly to FDB.

The copy started while writes continued. Once the initial copy finished, Pinecone briefly blocked writes for that index, copied and verified the small set of rows changed during the copy, then switched the index to FDB. Reads stayed available, and other indexes continued accepting writes. For a typical index, the pause was well under a second; the longest recorded pause on a live index was about 3.5 seconds. When every index had moved, the state table and the remaining Postgres databases could be removed.

Four steps for migrating one index’s mappings: read and write in Postgres; copy rows to FoundationDB while writes continue; pause writes briefly to copy and verify recent changes; then read and write in FoundationDB.
Four steps for migrating one index’s mappings: read and write in Postgres; copy rows to FoundationDB while writes continue; pause writes briefly to copy and verify recent changes; then read and write in FoundationDB.

Figure 5. Mapping records moved one index at a time. The brief write pause applied only to the index being switched.

Operating FoundationDB introduced new failure modes

Moving to a self-operated database gave Pinecone more control over deployment and key-range scaling, but also left the team responsible for the failure modes and tooling. One incident began during a routine rollout that included an FDB patch upgrade and a sidecar image change. The Kubernetes operator responded by recreating storage pods instead of updating them in place.

The operator was meant to handle one failure domain at a time, which should have been safe with the cluster’s redundancy_mode: double. But the version in use had a bug when it read zones from node labels: it looked for them in an environment variable that wasn’t set. As a result, it treated all storage pods as though they were in one zone and deleted them together across the affected FDB clusters. The data remained on persistent disks; it was the pods that disappeared.

Most clusters scheduled replacement pods quickly and recovered within minutes. One Google Cloud Platform cluster faced a shortage of capacity in its zone. It had a full read and write outage for about 25 minutes until the team freed capacity manually. Once new pods were scheduled and reattached to the existing disks, the data returned intact. The operator bug had already been fixed upstream, and Pinecone upgraded the operator and changed its deletion mode to process one pod at a time.

This episode illustrates a practical cost of self-hosting: the database’s safety features depend on the surrounding operator and infrastructure behaving as expected. Persistent disks protected the data, but they couldn’t make replacement capacity appear in a constrained zone.

Migration load needs a rate, not just concurrency limits

A separate incident showed that a migration can overwhelm the database it is meant to populate. Pinecone moved smaller indexes first and saved the largest “whales” for individual attention. On one cluster, the migration ran with too much parallelism. Many indexes just below the whale cutoff—nicknamed “hippos”—finished together, sending roughly 660,000 rows to FDB in less than a minute.

The migration tool had four controls: the number of source shards, the number of indexes copied at once, the number of concurrent FDB transactions per index, and the number of rows per transaction. Those settings determined how many rows could be in flight, but none set a target write rate.

Each migrated row produced four FDB writes: the record plus three index entries. Each key and value was about 75 bytes. Pinecone estimated a rough throughput of 20,000 writes per second per core for keys and values of that size, while noting that its storage disks set the practical limit. Its clusters ran five storage servers and kept two copies of the data.

At the peak, FDB measured about 190,000 writes per second, equivalent to 47,000 rows per second—roughly four times the team’s estimate. Because a hippo’s keys were clustered, its writes concentrated on nearby key ranges. The busiest storage server received about twice the average load. Its disk fell behind, and its write queue rose from 50 MB to the 1.5 GB emergency threshold in about two minutes.

FDB commits writes after they reach transaction logs; storage servers apply them afterwards. That meant commits remained fast while the backlog grew. But FDB’s ratekeeper reduced the permitted transaction rate as storage queues filled, eventually bringing it down to about ten transactions per second. The limit applied to reads as well as writes. Since the migration used the same priority as customer traffic, both competed for the reduced capacity. Query routers that didn’t retry FDB’s retryable errors made the impact worse.

Pinecone later ran the remaining migration with just 250 rows in flight at a time. That resulted in about 13,000 rows per second, close to the team’s estimated capacity of roughly 12,500. The queue stayed below the throttling threshold, and requests didn’t fail. The experience also showed a missing safeguard: bulk jobs should have used FDB’s batch priority, which is designed to let the system slow background work before customer traffic.

Charts of the storage write queue on the busiest server. A high-parallelism migration fills the queue to its emergency threshold; a later run with reduced concurrency keeps the queue below the throttle line.
Charts of the storage write queue on the busiest server. A high-parallelism migration fills the queue to its emergency threshold; a later run with reduced concurrency keeps the queue below the throttle line.

Figure 6. The first run filled the busiest server’s queue. Lower concurrency kept a later run below the throttle line.

Building a SQL view for FDB data

Moving away from Postgres also meant losing psql, a familiar way for engineers to inspect records. FDB’s command-line tools expose raw keys and bytes; Pinecone stored values as Protocol Buffers, making those records inconvenient to inspect directly.

The team built fdbsql, a read-only SQL shell over its FDB stores, using Apache DataFusion. Each store appears as a DataFusion table. A scan reads through a key range using snapshot reads and hands Arrow batches to DataFusion. If a query constrains the first column of a key, the scan can narrow its work to the matching range.

The tables don’t require separately maintained schemas. Their columns come from the existing Protocol Buffer definitions, with a Rust build step deriving introspection support for every message. When a developer adds a field to a protobuf definition, it becomes available to queries such as SELECT *. This doesn’t turn FDB into a general-purpose SQL database, but it restores a practical inspection tool for the data the team chose to store there.

Six months of implementation and verification

The Rust storage implementations, migration code, scripts, utilities, monitors, and production operations took six months. Pinecone says coding agents helped the team turn early ideas into working prototypes and made it possible to take on additional verification work.

Before running the mapping migration in production, the team used Claude Code to produce a formal TLA+ model, which engineers reviewed for completeness. A model checker examined every interleaving it could produce for two pods, two indexes, and the migration tool, checking 1.5 million states. The analysis found a bug in the runbook: a pod might not yet have received the setting that directs new indexes to FDB, and could therefore create an index in Postgres after the migration had counted existing indexes. The runbook was updated to wait until the setting had reached every pod.

What changed at the end

On September 25, 2026, Pinecone merged the change that removed Postgres from the data plane’s code, deleting about 40,000 lines of code. Between September 27 and 29, a routine rollout removed the last 24 control databases. The Postgres bill for the data plane reached zero; the FDB clusters that replaced those databases cost about one third as much as the databases they replaced.

The full cost result was about 20 times less than the earlier setup, according to Pinecone. Its spending comparison grouped database costs across AWS, Google Cloud, and Azure. The FDB line counted the nodes and disks it ran on, and the chart showed the fall in spending as the vector directory, WAL metadata, system database, and control databases moved in separate projects.

Chart of monthly data plane database spending across three cloud providers from January 2025 to October 2026, relative to the May 2025 peak. Postgres costs decline as database groups move to object storage and FoundationDB; the final month shows a small FoundationDB cost.
Chart of monthly data plane database spending across three cloud providers from January 2025 to October 2026, relative to the May 2025 peak. Postgres costs decline as database groups move to object storage and FoundationDB; the final month shows a small FoundationDB cost.

Figure 7. Monthly spending fell as each database group left Postgres. The chart includes FDB’s nodes and disks from its first full month operating independently.

The migration’s broader lesson is specific to Pinecone’s workload. Its metadata access patterns were already key-based, the number of namespaces was growing, and BYOC made cloud portability more valuable. Object storage suited data that could be organized into files; FDB suited frequently accessed metadata and movable key ranges. Neither the latency results nor the cost savings establish that the same split fits every system. Teams considering a similar move would need to account for the application work of maintaining indexes, the operational burden of running FDB, and the need to rate-limit bulk migrations against storage capacity.

For Pinecone, the payoff was a data plane with fewer managed database services to tune across cloud providers, a metadata layer it could run in customer environments, and a much lower database bill. Its experience also puts a concrete boundary around the decision: Postgres remained a useful tool elsewhere, but its role as the data plane’s metadata store no longer matched the workload.

Source: Richard Miller · www.pinecone.io
Arrived · Hpjadul

Also departing from this gate