The popular summary of Figma’s database story is that the company “built its own Vitess for Postgres.” That is accurate as a description and useless as a lesson. Read the dozen primary sources together, from the 2019 infrastructure post to the 2026 connection-pooler post, and a more useful pattern shows up. Over five years Figma never made a large irreversible bet on its data layer. A PgBouncer split, a vertical partition, a logical shard and a physical shard were each built with a rollback path (for logical sharding, a config change that takes seconds; for a physical split, reverse replication), and each reused the fencing primitive of the step before it. The thesis of this case: Figma did not out-engineer the distributed-SQL vendors. It out-sequenced its own 3x-a-year growth curve. It bought each increment of runway with the cheapest reversible move available, and it paid for that with a permanently narrower SQL dialect, non-atomic cross-shard writes, and a proxy tier it will own for the life of the company.
~3x / yr
DB traffic growth, 2020 [S2]
~100x
DB stack growth since 2020 [S3]
~9 mo
to shard the first table [S3]
10 s
partial primary impact, first physical failover [S3]
Source tags like [S3] refer to the list in Section 12. Talk and podcast quotes (S4, S5) come from auto-captions or published transcripts and are marked where transcription matters. Anything labelled Our analysis, Reconstruction or Counterfactual is ours, not Figma’s.
Figma was founded in 2012 and, by Sammy Steele’s account, ran on a single Postgres instance “without even connection pooling or replicas until 2020”[S4]. In November 2019, Samir Goel, who led Figma’s infrastructure team, described the company as “backed by a single database instance running on one of the beefiest machine in AWS” and said plainly that Figma needed “a new database layer that scales horizontally”[S1]. So the destination was named about four years before the first horizontally sharded table shipped. The interesting question is not what Figma decided but why it took four years, and why that was the right amount of time.
The database was the metadata store (“permissions, file information, and comments”) on a single Amazon RDS Postgres, fronted mainly by a Ruby/ActiveRecord application[S2]. By 2024 the callers were 10 to 15 applications, Go services and “a large Ruby monolith” among them, and before DBProxy each one had to know where its databases lived[S4]. The detail that matters more than any database number is that Steele called the monolith “kind of single threaded”[S5]. A single-threaded request tier has no slack for a slow dependency: an EBS latency spike that “most customers don’t notice, but we were really hitting”[S5] fills every worker, and a storage hiccup becomes a site-wide outage. The data layer’s tail latency was the product’s availability, which is why, in our reading, replica hedging (Section 4) belongs in the same story as sharding.
Read the cascade as a design constraint (our analysis). Saturating a thread-per-request tier is a cliff, not a gradual degradation. Below the knee, a slow database costs latency. Above it, the slow database costs availability on every route, including routes that never touch it. So the right metric for “is the data layer healthy enough?” is not median or even P99 query latency. It is worker occupancy under the worst plausible stall, and it links two numbers architects usually track separately: the share of requests that touch any single database, and that database’s worst-case stall duration. Sharding and hedging both reduce the first number, which is why a program sold as capacity work also paid off as availability work.
Growth set the clock. In 2020, “database traffic grows approximately 3x annually”[S2]; in 2024 Steele said “we were going 3x every single year for the last four years”[S4]. The single RDS instance was running “upwards of 65% CPU utilization during peak traffic”, latencies near the limit were becoming “increasingly unpredictable”, and the failure mode was stated flatly: “If our database became completely saturated, Figma would stop working.”[S2] Steele’s version of the counterfactual is “hours long outages at Peak traffic every single night”[S4].
The 2020 response was a set of tactical fixes: upgrade from r5.12xlarge to r5.24xlarge, “the largest instance available”; add read replicas; put new use cases on new databases; and add PgBouncer because connections “were in the thousands”[S2]. Tim Liang credits these with securing “an additional year of runway”[S2]. Replicas had a hard limit, though: “not all reads or data fetching could be moved to replicas due to application sensitivity to replication lag”, and writes were a significant share of the load anyway[S2]. Steele’s talk gives a bleaker figure for a moment in the same period: after replicas and caching, “at that point we had 6 months of Runway”, and three of those months went into evaluating a NewSQL database that “we just couldn’t get it to work at our scale”[S4]. The sources don’t say exactly when that was, and “a year” and “six months” describe different moments, so read both as honest snapshots of a clock that kept being wound back.
2012
Figma founded on a single Postgres; no connection pooling or replicas until 2020
S4
Nov 2019
Infra lead: one instance on “one of the beefiest machine in AWS”; a horizontally scaling layer is needed
S1
2020
Peak CPU above 65%. r5.12xlarge → r5.24xlarge, read replicas, PgBouncer. “An additional year of runway”
S2
2020 – Oct 2022
Vertical partitioning: first op moves 2 tables, the last (Oct 2022) moves 50
S2
End 2022
About a dozen vertically partitioned databases, plus caching and read replicas
S3
Late 2022
Horizontal sharding programme starts (“18 months ago” as of March 2024)
S3
Sep 2023
First horizontally sharded table after ~9 months; 10 s partial availability on primaries
S3
Dec 2023
LiveGraph redesign talk posted: invalidators sharded like the DBs, topology left to DBProxy
S8
Mar 2024
Sharding post published; “increasingly complex databases” next
S3
~Apr 2024
Whole fleet on PG13; legacy PG11 boxes were the reason the upgrade workflow was built
S5
May 2025
New CDC + snapshot analytics pipeline, built first for the sharded DBs
S10
Q4 2025
PGKeeper (PgBouncer replacement) “prevented more than 20 incidents”
S11
May 2026
Stack is DBProxy (hundreds of replicas) → PGKeeper → Postgres, sharded both ways
S11
The arithmetic of that clock deserves more attention than it usually gets, because it explains almost every sequencing decision that followed. At a steady growth rate g per year, a capacity multiplier m buys logg(m) years. At 3x a year, doubling the hardware buys log₃2 ≈ 0.63 years, about 7.6 months. On the largest RDS instance there is no further doubling to buy.
Assumptions: load grows 3x/year from 65% of an r5.12xlarge in 2020 (both reported); the 24xlarge is treated as 2x the 12xlarge; the blue line assumes a dozen vertical DBs each on the largest box with load split perfectly evenly, which never happens. Runway from any capacity multiplier m at 3x/year is log₃(m) years, so doubling hardware buys about 7.6 months.
Our analysis — the runway arithmetic checks out
The rest of this case study reads the program as a sequence of runway purchases. Each purchase had to be deliverable inside the runway the previous one bought, and each had to be reversible, because a failed irreversible migration at 3x a year leaves no time to try again. Keep that constraint in mind when judging any alternative, including the ones in Section 3.
Between 2020 and October 2022 Figma moved groups of tables such as “Figma files” and “Organizations” off the main database onto their own RDS instances[S2][S3]. The first operation moved 2 high-traffic tables and the last, in October 2022, moved 50[S2]. By the end of 2022 the result was “a distributed architecture with caching, read replicas, and a dozen vertically partitioned databases”[S3]. This phase is usually skimmed as a prelude, which is a mistake. Nearly every mechanism that made horizontal sharding safe was built and hardened here, on a problem that was much more forgiving.
Measure coupling before you cut. Candidate groups were ranked on two axes[S2]. Impact was Average Active Sessions per table, from sampling pg_stat_activity every 10 ms. Isolation came from runtime validators hooked into ActiveRecord, which logged the caller and the set of tables touched per query and per transaction to Snowflake. That gave the team an empirical join graph of the application before any migration: which tables are actually read together, in which transactions, from which call sites. It is the same instrument, applied at a finer grain, that later drove shard-key selection (Section 6). Most organisations that try partitioning skip this step and find the coupling during the cutover.
Logical, not streaming, replication, for three stated reasons[S2]. It can move a subset of tables. It works across major versions. And it allows reverse replication after cutover, so the old database stays current and rollback is a routing change, not a restore. AWS blue/green was “not yet available for RDS Postgres” at the time[S2]. Initial copies were slow because Postgres logical replication “inefficiently updates indexes one row at a time”. Dropping indexes on the destination and rebuilding them after the copy took it from “days, if not weeks” to “a matter of hours”[S2]. In 2024 Steele put it as “from weeks to a day for a multi-terabyte data copy when you drop all of your indexes and foreign keys”[S5]. The two magnitudes differ, probably because they describe different tables or eras, but the direction is the same.
De-risk the router before you move the data. Before any data moved, the team split PgBouncer into separate services that all still pointed at the same database, and used security groups so that only PgBouncers could reach it[S2]. Routing mistakes during that phase were visible, because traffic showed up in the wrong pooler, but harmless, because every pooler led to the same data. This is the exact move that horizontal sharding would later make with Postgres views, one layer lower. Figma rehearsed its routing change in production with the data movement taken out.
T−days
Logical replication
Copy the moved tables to the new RDS instance with indexes dropped, rebuild them, then stream until lag ≈ 0
T0
PgBouncer pause
New connections are held at a handful of PgBouncer nodes, not thousands of app processes
T0+
Revoke privileges
Clients lose query rights on the moved tables in the old DB, so stray writes fail instead of forking
T0+grace
Cancel stragglers
In-flight queries still running are cancelled (“a little under 10” per op)
T0+ε
LSN fence
Sample the source LSN and wait for the replica to replay past it
T0+ε
Promote + reverse
Stop replication, promote, start reverse replication to the old DB for rollback
≤ 30 s
Resume
PgBouncer resumes pointed at the new DB. ~2% of requests dropped in the window
hours to days, zero user impact
pause → sync → reroute → resume “complete within seconds”; the goal was under one minute of impact
The cutover[S2] is drawn above; read it as a protocol, not a runbook. The observed cost was a “~30 second period of partial availability impact (~2% of requests dropped)” against a sub-minute goal[S2]. What made seconds achievable is that coordination was pushed down to “a handful of PgBouncer nodes” instead of “thousands of application backend instances”[S2]. Fan-in is the variable that matters: a pause that has to be acknowledged by every app process has a tail set by the slowest of thousands; a pause at a handful of poolers has a tail set by the slowest of a handful.
Our analysis — the revoke is the real fence
The vertical program had two costs that it could not engineer away. First, before a central router existed, every split meant rewriting “every single one of our 10 to 15 applications” to point at the new database[S4], and after a dozen splits “routing complexity scales multiplicatively”[S2]. Liang’s April 2023 post mentions that a “new query routing service” had since been introduced, without naming it[S2]. It is reasonable to infer that this was DBProxy or its precursor, but no source says so. Second, and decisively: “the smallest unit of partitioning is a single table”[S3].
That second limit is what forced the horizontal program. Figma’s own capacity data showed individual tables of “several terabytes and billions of rows” becoming too large for a single database[S3]. Steele says the largest “at one point was 16 terabytes”[S4]; the Postgres.FM transcript renders a similar sentence as “a 116 terabyte table today”, which reads like a captioning error for “a 16”, and we use the 16 TB figure. Three distinct per-table failure modes appear across the sources. Vacuum and wraparound: reliability impact during vacuums that protect against transaction-ID wraparound[S3]. Steele adds a pathology they diagnosed by reading the Postgres source, in which CPU pinned at 100% at the end of vacuum/analyze, causing “downtime for a minute or two”. They traced it to a single contended lock tied to invalidated query plans and “figured out workarounds”, which are not specified[S4]. On tables above 4 TB, after ANALYZE cleared the plan cache, custom plans became “5x more expensive” and CPU spiked to 100% “for a few seconds”[S5]. IOPS: the highest-write tables “would soon exceed the maximum IO operations per second (IOPS) supported by” RDS[S3], and index builds, which can’t be throttled, had spiked IOPS “to basically the RDS limits”[S5]. Tail latency from EBS at the storage layer, amplified by the single-threaded monolith[S5].
Right-hand labels are our arithmetic: the minimum physical split that brings each size under the ~1 TB target. Not drawn because no number was published: the RDS IOPS ceiling the hottest-write tables were approaching [S3], the unthrottleable index builds that pushed IOPS “to basically the RDS limits” [S5], and the end-of-vacuum lock that pinned CPU at 100% for a minute or two [S4]. Every one of these scales with table size, which is exactly what vertical partitioning cannot reduce.
Our analysis — it wasn’t CPU anymore
Figma made the “don’t migrate to a distributed database” decision twice, for somewhat different reasons, and it helps to separate them.
2020 (vertical era). Liang lists the objections[S2]. Moving to a cloud-managed distributed Postgres would have made Figma one of “the largest single-cluster footprints” for such a product, and the team did not want to be “the first customer to hit certain scaling issues”. Self-hosting meant large retraining and operational cost. Vitess or NoSQL would require a “complex double read and write migration”. The objection is to being the frontier, not to the technology.
2022 (horizontal era). Steele’s post says the team “explored CockroachDB, TiDB, Spanner, and Vitess”[S3]. Switching would have required “a complex data migration to ensure consistency and reliability across two different database stores”, the team would have had to “rebuild our domain expertise from scratch”, and “we had only months of runway remaining”. The summary sentence is the decision rule: “We favored known low-risk solutions over potentially easier options with much higher uncertainty, where we had less control over the outcome.”[S3] NoSQL was ruled out separately because of a “very complex relational data model” that would mean “rewriting almost our entire backend application”[S3]; the application relies on joins, unique indexes and relational modelling[S4]. In the talk, Steele adds that one candidate, unnamed, was tested for three months and produced “reliability issues that no one had seen before” and write-throughput problems. She calls running databases at scale “one of the most unsolved problems in cloud computing”[S4].
What Figma chose instead was deliberately narrow: “It didn’t make sense for our small team to re-implement a generic horizontally sharded relational database in-house”[S3], or in the talk, “we did not want to reinvent postgress we didn’t want to reinvent cockroach”[S4]. The seven stated goals[S3] are, in order: minimise developer impact; scale out transparently; skip expensive backfills (which “would have taken months”); make incremental progress; avoid one-way migrations; keep strong data consistency by avoiding double-writes; and play to existing strengths. Five of the seven are about how to migrate, not what to end up with. This was a migration strategy that happened to require a sharding layer, not a sharding design that needed a migration plan.
Status
Data migration
Keeps RDS expertise
Reversible at each step
Relief inside runway
Long-term ownership cost
Bigger box / more replicas
done 2020 [S2]
none
✓
✓
✗ ~1 yr max
low
More vertical partitions
done 2020–22 [S2]
per table
✓
✓
✗ table is the floor
low
NewSQL (CockroachDB, TiDB, Spanner)
explored [S3]; one tested 3 mo [S4]
full, cross-store
✗
✗ after write cutover
✗ tested one failed
vendor + ops relearn
Vitess
explored [S3]
engine change
✗
✗
✗
new engine
NoSQL
rejected [S3]
rewrite backend
✗
✗
✗
rewrite
Citus
never mentioned by Figma
engine/extension
partial
?
?
—
In-house on RDS (DBProxy)
chosen [S3]
none (views, then copy)
✓
✓ incl. after physical op
✓ 9 mo to first table
permanent team + proxy
Counterfactual — had they bought in 2022
One nuance about “play to strengths”. Staying on RDS meant keeping RDS as the storage and operations substrate: backups, instance management and the team’s accumulated tuning knowledge. It did not mean keeping RDS’s orchestration features. Figma built its own failover tooling when RDS Blue/Green was “not yet available for RDS Postgres”[S2]. By mid-2024 the objection to RDS Blue/Green was no longer availability but rollback: it offered no rollback path, which in Steele’s words “means data loss”, whereas owning the tooling also allowed zero-downtime replica failovers[S5]. In practice the strategy was to own the control plane and rent the data plane, which is a more specific and more portable rule than “use what you know.” Steele’s post ends with a promise that shows the decision was contingent: “NewSQL stores have continued to evolve and mature. We will finally have bandwidth to reevaluate”[S3]. No public follow-up has reported the outcome.
No Figma source draws the whole system in one picture, so the figure below combines S3 (DBProxy components), S4 (protocol, planners, transactions), S5 (hedging, replicas, shard sizing), S7/S8 (LiveGraph) and S11 (the 2026 pooler layer).
Applications · 10–15 of them [S4]
Ruby monolith
ActiveRecord · “kind of single threaded” [S5]
Go services
“a number of large go services” [S4]
Other apps
must supply a shard key, nothing else [S4]
DBProxy · Go · stateless · hundreds of replicas by 2026 [S3][S11]
Parser
SQL → AST; CockroachDB's PG parser, lightly modified [S4][S5]
Logical planner
query type + logical shard IDs [S3]
Physical planner
logical → physical DB; rewrites SQL [S3]
Topology library
table→key, shard→DB; updates in under 1 s [S3]
Scatter / gather
fan-out when no shard key [S3]
Multi-shard txn
SELECT 1 probe, parallel commit [S4]
Replica hedging
2 replicas, first success wins [S5]
Load shedding
+ observability [S3]
RDS Postgres fleet · PG13 [S5]
Vertical DB
unsharded table groups
Colo · UserID
shards 1..n
Colo · FileID
shards 1..n
Colo · OrgID
shards 1..n
each: primary + replicas on io2 EBS [S5]; target ≤ ~1 TB per shard [S5]
Readers of the physical DBs
LiveGraph invalidators
tail WAL, one per physical shard [S7][S8]
Analytics pipeline
RDS snapshot → S3; CDC via Kafka Connect on MSK → Snowflake [S10]
Failover tooling
logical replication, pause/revoke/resume [S3][S4]
These bypass DBProxy and see physical topology directly. LiveGraph and the analytics pipeline each had to be reworked after sharding [S7][S10].
The components are in the figure; what follows is only what the figure can’t carry. The application contract is one sentence: “our application doesn’t have to know anything about how our backend is actually sharded beyond the fact that there’s a Shard key”[S4]. That is the fix for the 10–15-application rewrite from Section 2, and Steele’s “high-level orchestrator role”[S5] is the honest job description. The parser is borrowed (CockroachDB’s Postgres parser “with the few modifications”, per the talk and podcast but not S3[S4][S5]); both planners are “built in-house”[S4]. The team that declined to adopt CockroachDB adopted the one piece of it with no operational surface. Non-production keeps the same logical topology on “many fewer physical databases”[S3], so tests hit the same routing, scatter decisions and unplannable-query errors as production without production’s instance count.
Our analysis — an eventually consistent topology is safe only because of the fence
What DBProxy will run. S3 states the core rule: “all range scan and point queries are allowed, but joins are only allowed when joining two tables in the same colo and the join is on the sharding key”, which covers “the most common 90% of queries”. The talk gives a fuller list: any single-shard query is allowed; nested SQL is not; multi-shard writes, aggregations and GROUP BY are allowed but discouraged; joins only on the shard key; together this “supported 90 plus% of the queries in our code base with no changes”[S4]. Foreign keys are allowed on the sharding key[S5]. The team deliberately avoided in-memory joins and pushed work down to Postgres[S4]. The stated reason is scope: full SQL would make DBProxy “look a lot like the Postgres database query engine”[S3]. There is a latency reason too, which Figma doesn’t state but its own numbers imply (our analysis). The 2026 post reports “P95 of our queries complete within 2 ms” and “P99 of our queries return fewer than 5 rows”[S11]. Against a 2 ms query, an extra network hop (app → DBProxy, before the pooler) plus a parse and two planning passes is a meaningful fraction of the total, not noise. A router that also buffered and joined rows in memory would add work proportional to row counts on exactly the path whose defining property is that it returns almost none. A thin, push-down-only proxy is the kind that fits in that budget.
Single-shard (the design centre)
SELECT … FROM t WHERE file_id = $1
Joins inside a colo on the shard key and full transactions are allowed here [S3].
Scatter-gather
SELECT … FROM t WHERE created_at > $1
Each one “contributes the same amount of load as it would if the database was unsharded” [S3].
Unplannable → rewrite the app
nested SQL · cross-colo join · join not on shard key
Aggregations, GROUP BY and multi-shard writes allowed but discouraged [S4]; no in-memory joins [S4].
Replicas and hedging. DBProxy is also where Figma’s availability strategy lives. For P0 user workflows, “99% of reads” go to replicas, and writes are removed from business-critical routes wherever possible[S5]. Reads are hedged: “every request hits 2 replicas and returns the first results that are successful”[S5]. Developers are told replicas are stale-read only, “hopefully it’ll be up to date within 10 milliseconds 100 milliseconds”[S4]. As of June 2024 there were “only 2 large replicas”, with a plan to move to more, smaller ones, and the move to io2 EBS was “a game changer for EBS reliability”[S5]. Steele credits replica hedging with getting the backend databases to “basically … four nines”[S4], and in the podcast describes the goal as “trying to move towards 4 nines globally”[S5].
Our analysis — what hedging buys, and what it costs
Several shard keys, not one. Figma chose “a handful of sharding keys like UserID, FileID, or OrgID”, noting that “almost every table at Figma could be sharded using one of these keys”[S3]. A single unified key was rejected because it would have required a composite key, a new column on many tables, backfills and application refactoring[S3], all of which conflicted with the “skip expensive backfills” goal. The obvious alternative for a B2B SaaS product, sharding everything by organisation (the Notion model, which Steele discussed on the same Postgres.FM panel), didn’t fit because “we have a lot of data not associated with an org and data moves quite frequently between orgs”[S5]. The approach instead was, for each table, “picking a set of a few shard keys that would be more optimal”[S5].
Colos. Tables that share a shard key are grouped into a colocation, or colo, and share a physical layout. Within a colo, “cross-table joins and full transactions” are supported “when restricted to a single sharding key”[S3]. A diagram caption in S3 says “Tables sharded by UserID and by FileID are each colocated together”. Figma has not published the full list of colos or which tables belong to which, so the table names below are placeholders.
Hash, not range, on the key. Many of Figma’s keys were auto-incrementing or Snowflake-style timestamp-prefixed IDs. Range routing on those would send all new writes to the last shard. So routing uses a hash of the shard key, at the cost of less efficient range scans on the key, which the team judged “not common in our codebase”[S3]. The hash function itself is not published.
Reconstruction (inferred) — ranges over a hash space
hash(shard_key) >= min_shard_range AND hash(shard_key) < max_shard_range. That is range partitioning over the hash space, not hash % N. Its useful property is that splitting a shard is a range split. Moving half of a logical shard’s key space to a new instance changes one boundary and relocates only that half. A modulo scheme would change N and remap nearly every key. Combined with many logical shards per physical instance[S4], resharding becomes a topology edit plus a copy of the affected ranges. That fits S3’s roadmap item of “fully automated reshard operations that can run shard splits with the click of a button”. Figma has not said how many logical shards exist per table, or whether any reshard beyond the initial split has happened.Our analysis — what multiple keys actually cost
The central idea of the rollout is to split sharding into two independently reversible steps. A logical shard is a virtual shard, and several can live on one physical Postgres instance[S4]. Figma first sharded tables logically while every row stayed exactly where it was, and only later moved data physically. Logical sharding was rolled out by percentage behind feature flags, and rollback was “a simple configuration change”[S3], done “within seconds by just rerouting traffic back to the main table”[S3]. Steele describes sending 5% of reads through the logical path while writes still went unsharded, then running at 100% “for weeks or months” before the first physical operation[S4].
The implementation uses plain Postgres views[S3]:
-- logical shard N of a table, on the still-unsharded instance [S3]
CREATE VIEW table_shard1 AS
SELECT * FROM table
WHERE hash(shard_key) >= min_shard_range
AND hash(shard_key) < max_shard_range;All reads and writes for a sharded table go through its views. Each view is reached through its own “sharded connection pooler service” that still points at the unsharded instance[S3]. Separate Postgres databases or schemas were rejected as the logical-shard mechanism because they “would have required physical data changes”[S3]. The views were validated two ways. A load test on a corpus of sanitized production queries, run with and without views, showed overhead of “less than 10% in the worst cases”. A “shadow reads framework” sent live reads through the views and compared performance and correctness[S3].
0 · Unsharded
one table on one RDS instance
table
all rows
Where the vertical partitions left each hot table.
1 · Logical
same instance; reads/writes via views; per-view pooler service
table_shard1
hash ∈ [0, a)
table_shard2
hash ∈ [a, b)
table_shard3
hash ∈ [b, c)
table_shard4
hash ∈ [c, max)
Rolled out by % behind flags (e.g. 5% of reads while writes stay unsharded) and held at 100% “for weeks or months” [S4]. View overhead: <10% worst case [S3].
Rollback: config change, seconds [S3].
2 · Physical
full logical replication to N instances, then fence and flip topology
RDS #1
shard1 (+ copy of rest)
RDS #2
shard2 (+ copy of rest)
RDS #3
shard3 (+ copy of rest)
RDS #4
shard4 (+ copy of rest)
Only a topology change for the application. 10 s partial availability on primaries, none on replicas [S3].
Rollback: reverse replication keeps the source current [S4].
Four shards are drawn for legibility; Figma has not published shard counts, the hash function, or how rows outside a shard's range are cleaned up after the full copy.
Our analysis — why the views trick is better than it looks
Shadow planning, which S3 calls “shadow application readiness”, is how Figma picked shard keys and colos without guessing. The team defined candidate sharding schemes, ran the logical planner in shadow against live production traffic, and logged queries and plans to Snowflake for offline analysis[S3]. Steele lists the metrics: “how many queries are unplannable how many queries are scatter gathers how many queries are now a cross Shard transaction”, producing results like “rewrite 30 application queries or 50”[S4]. This is the vertical program’s ActiveRecord validators taken one level deeper. There, the question was which tables are touched together. Here, it is which rows, by which key.
The shadow metrics that matter most are scatter-gathers, and S3 is unusually candid about why: “each scatter-gather contributes the same amount of load as it would if the database was unsharded.” That sentence defines a hard ceiling on what sharding can deliver.
Model: a single-shard query costs 1/N of the unsharded load per shard; a scatter query costs every shard as much as it cost the unsharded database, which is how S3 characterises it. The ceiling is 1/f regardless of N: at 5% scatter you can never get past 20x. The fraction that matters is of load, not of distinct query shapes.
Our analysis — Amdahl’s law for shards
The first horizontally sharded table went live in September 2023. “End to end, it took our team roughly nine months to shard our first table”[S3]. The failover caused “only ten seconds of partial availability on database primaries and no availability impact on replicas”[S3]. The sources reconcile on timing: S3 (March 2024) says the journey started “18 months ago”, around September 2022, and also that “in late 2022” the team set out to unlock scalability. If the nine months ended in September 2023, the first-table effort began around December 2022, so the first few months of the journey appear to have gone into design and evaluation. Note too that the final vertical partition (50 tables, October 2022) was happening while horizontal work began. The two programs overlapped rather than running in sequence.
The physical tooling is the vertical tooling generalised from 1→1 to 1→N, with a new failure mode to handle: “the sharding operation could succeed on only a subset of our databases”[S3]. The copy uses full logical replication: the entire dataset goes to every target, and each target is then restricted to its own subset of shards, which avoids having to implement “filtered logical replication”[S3]. The same tooling performs vertical splits and major and minor version upgrades[S4]. The fleet was fully on PG13 by about April 2024, and the legacy PG11 boxes, the earliest and largest databases, were the main reason the upgrade workflow was built[S5].
The failover[S4] is the vertical protocol unchanged (pause, revoke, kill, sync, reverse-replicate; see the figure), with the reverse path kept so that “at any point if something goes wrong … we can go back to the unsharded database.” What the talk adds is the explicit statement of which step carries correctness: “we are relying on RDS for correctness not PG bouncer”, because “if something goes wrong at that layer it’s not going to mean we have split brain”[S4]. Primary failovers prioritise consistency and take about 10 seconds; replica failovers take none[S4]. By mid-2024: “everything on the failover’s PgPause, PgResume side has been flawless”[S5].
Prepare
days
Soak
weeks–months
Fence
≈10 s total on primaries
Flip
Hold
until confident
First physical op [S4]: after the switch, CPU on one replica went to 100%. An index creation had failed and nothing checked for it on that replica. Rolled back with no production impact, index recreated, failed over again successfully.
The one failure story in the sources is useful precisely because it is mundane[S4]. On the first physical shard operation, CPU on one replica went to 100% after the switch. An index creation had failed and no check caught it on that replica. The team rolled back with “no production impact”, recreated the index and failed over again successfully. S4 does not say whether this was the September 2023 table. What the story shows is that the drop-indexes-then-rebuild optimisation from Section 2 creates a new invariant: the target must end up with exactly the source’s index set, on every node, before traffic arrives. The failure was not caught by the planner, the topology service or the fence. It was caught by the rollback path.
Our analysis — the price of not filtering
Our analysis — fence at the resource, not at the router
The downtime figures are frequently conflated (Section 10). Vertical operations cost about 30 seconds with about 2% of requests dropped[S2], which pganalyze noted is “not zero”[S15]; horizontal primaries are “down to 10 seconds”, against what Steele characterises as “minutes to like half an hour for major version upgrades” with RDS’s own tooling[S4]. The two are measured differently (requests dropped versus partial availability), so don’t read them as a 3x improvement.
From September 2023 to March 2024 the work focused on “relatively simple shards from our highest write rate databases”; the stated plan for 2024 was to shard “increasingly complex databases, which have dozens of tables and thousands of code call-sites”[S3]. The order was deliberate: “Since we were operating under tight deadline pressure… we favored approaches that could be rolled out incrementally on our fastest growing tables.”[S3] It follows the runway logic from Section 1. Shard what is about to break first, even if it is not what is architecturally cleanest.
The blog post’s version is short: “we chose not to support atomic cross-shard transactions because we could work around cross-shard transaction failures”[S3]. The talk shows there is more to it[S4]. DBProxy does execute multi-shard transactions. It opens a transaction on every participating database; just before commit it sends SELECT 1 to every one of them; then it issues the commits in parallel. That leaves “only about five milliseconds where the database could actually die and have a partial commit failure”, which at Figma’s volume works out to “two or three of these a year”. Two-phase commit was considered and dropped. The team then tried asking application engineers to write failure-resilient code, but after an hour a room of senior engineers “couldn’t figure it out”. So they moved to a data-driven approach: fix only “the really data critical bad transactions that could corrupt user data”, and “everything else we just let it be”[S4]. Atomic cross-shard transactions for business-critical cases stay on the roadmap[S3].
Our analysis — what the probe buys, and the risk it leaves
SELECT 1 probe turns any shard that is already dead, disconnected or wedged into a clean abort before anything commits. That handles most real failures, which are rarely instantaneous. What remains is a shard failing inside the parallel-commit window. Two properties of that residual risk matter more than its size. It is correlated, not independent. Tears happen per failure event: when a primary dies, every multi-shard transaction currently in its commit window with that shard tears together. At an illustrative 1,000 multi-shard commits per second touching a shard, one death inside the window tears about five transactions at once. “Two or three a year” is best read as the number of events, each of which can produce a small cluster of partial commits, and those events arrive during an infrastructure incident, when attention is elsewhere. Some outcomes are ambiguous, not just partial. If a COMMIT is sent and the connection drops before the acknowledgement, the proxy cannot know whether that shard committed. The repair tooling has to reconcile from the data, not from the proxy’s logs. The sensible design, and what “fix the data-critical paths” implies, is idempotent, re-runnable multi-shard writes with a reconciler for the operations where a tear corrupts user-visible state. Figma has not described how it fixed those paths.Our analysis — why 2PC was probably not worth it here
Sharding also removes several guarantees the application used to get from Postgres for free[S3]. Some SQL becomes inefficient or impossible. Applications must supply routing information. Schema changes have to be coordinated across shards. Postgres no longer enforces foreign keys or globally unique indexes. Transactions can partially commit. S3 lists horizontally sharded schema updates, globally unique ID generation and distributed globally unique indexes among the open problems (unique indexes were then supported only when they include the sharding key), and no later source says how these are handled today. In a design review these are the costs that bite a year later. Every unique constraint on a non-shard-key column needs a new owner, whether a lookup table, an application-level check or a reconciler, and each of those is its own small distributed system.
Guarantee
Unsharded Postgres
After sharding (sources)
New owner (our analysis)
If nobody owns it (our analysis)
Transactions
ACID on one box
Atomic within one shard of a colo; multi-shard commits non-atomic, ~5 ms tear window [S3][S4]
Idempotent multi-shard writes + reconciler on data-critical paths
“half their data was missing” [S3]
Foreign keys
Engine-enforced
Allowed on the sharding key [S5]; otherwise no longer enforced by Postgres [S3]
App-level checks + periodic orphan scans across colos
Orphans found by users, not by constraints
Unique indexes
Global
Only when they include the sharding key; distributed unique indexes an open problem [S3]
Lookup table keyed by the unique value, or detect-and-merge
Duplicates discovered late, merged by hand
ID generation
One sequence per table
Globally unique ID generation listed as an open problem [S3]
An ID service, or IDs with embedded shard/time bits
Collisions surface on the first reshard or merge
Schema changes
One DDL statement
Must be coordinated across shards; open problem [S3]
Migration orchestrator with per-shard state and resume
Mixed schemas: a query valid on some shards only
Arbitrary SQL
Full planner
~90% of queries unchanged; nested SQL refused [S3][S4]
Shadow planner in CI on every new query
Unplannable query first seen in production
Every row in the gold column is a small distributed system with its own failure modes and on-call. Figma has not published how it resolved rows 3–5; S3 lists them as open as of March 2024.
Our analysis — the ledger is the real migration cost
The Figma posts published after 2024 are, taken together, a record of the systems that assumed the database was one thing. Each had to be rebuilt. This is the part of the story that the sharding post itself could not tell, and it is where most of the long-run cost of a sharding program sits.
LiveGraph, Figma’s real-time data layer, tails the Postgres replication stream to invalidate subscriptions, so “all LiveGraph queries hit the primary database”[S7]. In 2021 the stream was “on the order of 10,000 writes/second”, and sharded DB support was on the roadmap[S6]. Vertical partitioning had already broken its main assumption, a single globally ordered stream. The stopgap was “artificially combining all replication streams into one” to keep that ordering, and it had two defects: excessive fan-in, and “if one shard was unavailable, all optimistic updates stalled”. The post’s own example: “no comments could be made!”[S7] The redesign, described in a talk whose video was posted in December 2023 and written up in May 2024, shards invalidators “the same way as the physical databases”, each tailing a single stream, with caches sharded by query hash[S7][S8]. Invalidators “don’t need to participate in any sort of resharding process”[S8]. The team explicitly declined to make LiveGraph topology-aware, because that “is exactly what another service at Figma, dbproxy, does”[S7]. Growth kept pressure on: LiveGraph sessions tripled since 2021, and view requests grew 5x “in just the last year”; only 11 of roughly 700 queries were classified as “hard”[S7].
Stopgap after vertical partitioning
DB 1 WAL
DB 2 WAL
DB 3 WAL
DB n WAL
Merge into one stream
keeps a global order
LiveGraph
all queries hit primaries
Excessive fan-in, and “if one shard was unavailable, all optimistic updates stalled” [S7]. One DB's outage became a product-wide write freeze in the real-time layer.
Redesign (2023–24)
shard 1 WAL
invalidator
one per physical shard
shard 2 WAL
invalidator
one per physical shard
shard n WAL
invalidator
one per physical shard
Caches sharded by query hash · topology left to DBProxy
invalidators “don't need to participate in any sort of resharding process” [S8]
Topology knowledge stays in one place: making LiveGraph topology-aware would duplicate “exactly what … dbproxy does” [S7].
Our analysis — the merged stream was a hidden global dependency
Analytics. By 2023 the daily sync to Snowflake took about 6 hours, and the largest tables took “several days or more”; the extra replicas used for exports cost “millions of dollars”[S10]. The replacement (RDS snapshot export to S3, CDC via Kafka Connect on MSK, and a merge in Snowflake) was built first for the horizontally sharded databases, because they “had fewer tables but utilized more database machines—each with its own batch replica”[S10]. Freshness went from 30 hours to at most 3, with “multimillion-dollar annual savings”[S10]. Put simply, sharding multiplied the number of batch replicas, and the old export pattern’s cost grew with the machine count rather than with data size, so it had to go. The Data Engineering track’s CDC chapter covers that pattern and its pitfalls.
Permissions. Permission checks were “around 20%” of database load at one point, and the permissions DSL was built alongside “vertical and horizontal sharding”[S9]. A workload that large is exactly what the scatter analysis in Section 6 warns about. The post frames the DSL as giving backend engineers more control over the permissions data layer; our reading, not Figma’s statement, is that making permission evaluation cheaper and shard-friendly also helped sharding pay off.
Connection pooling. The 2026 PGKeeper post is the clearest look at the stack after sharding: DBProxy (“hundreds of stateless DBProxy replicas”) → PGKeeper → Postgres, with “horizontal and vertical sharding across our database fleet”[S11]. PgBouncer had become the weak link. It is single-threaded, which caused load skew across replicas. It had no prioritisation, backpressure or CoDel, so under sustained overload nothing dropped stale requests, and “naive recovery after an overload incident can itself overwhelm the database”[S11]. A Postgres upgrade from 13.21 to 13.22 showed a CPU spike caused by mass connection closure[S11]. PGCat was considered in 2024 (“might use PGCAT”[S5]) and rejected in 2026 because it would have needed a fork[S11]. Pooling was not folded into DBProxy for a simple arithmetic reason: “We typically size each PostgreSQL instance’s connection pool to about 100 connections, but we operate hundreds of stateless DBProxy replicas.”[S11]
PGKeeper’s internals are in the post[S11]; the parts that matter here are three. It takes per-query metadata (traffic tier, user type, source) over gRPC, which in our reading is only useful because DBProxy, the one tier that knows who is asking, sits directly above it. Its admission control (a priority semaphore with “debt”, CoDel with adaptive LIFO, weighted fair share) decides who waits when the ~100-connection pool is full. And its rollout reused the sharding playbook: replicas first, safe because “DBProxy hedges replica requests”, then non-critical primaries, then all, with a sliding-window detector in DBProxy that automatically flipped traffic back to PgBouncer “a few times”[S11]. The reported sizing: one instance at a weekly average peak of 20k QPS with spikes to 45k, and “P95 of our queries complete within 2 ms”[S11]. The post credits PGKeeper with preventing “more than 20 incidents” in Q4 2025 and reports a database SLO above 99.99% “measured against core user experience availability”[S11].
Our analysis — Little’s law says the pool is sized at the spike
What hasn’t been published. There are no public progress numbers after March 2024: how many tables or colos are sharded, how many physical instances exist, or total data and QPS. Nothing public confirms whether atomic cross-shard transactions, the new ORM or push-button automated resharding (all S3 roadmap items) have shipped, or what came of the promised NewSQL re-evaluation. The S-1 shows a renewed, non-cancellable cloud hosting commitment with a third-party provider of at least $545.0M over five years, entered into on 31 May 2025; the filing says elsewhere that Figma’s platform is hosted on AWS[S12]. It does not break out database spend, so it can’t be used to price the sharding decision. What we can say is that as of May 2026 the architecture described in 2024 is still the architecture: DBProxy on top, sharded RDS Postgres underneath[S11].
The March 2024 post drew 568 points and 223 comments on Hacker News[S13] and a small wave of video commentary. Several claims have hardened into received wisdom, and most of them are wrong or oversimplified.
“Figma reinvented Citus.” This is the most common take on HN[S13] and in Denis Magda’s video[S16], and pganalyze drew the comparison too[S14]. Figma’s posts never mention Citus. The reason usually given, that Citus is not available as an RDS extension, comes from commenters, not from Figma. Figma’s stated reasons are migration risk, RDS expertise, runway and control[S3]. Any extension-based answer would still have meant a different operational substrate and a data migration into it, which is exactly what the goals excluded. Don’t attribute the Citus reasoning to Figma. And don’t assume the comparison is apt: Figma built a query router with a deliberately restricted dialect and a migration system, not a distributed query executor.
“They never seriously tried NewSQL.” They explored CockroachDB, TiDB, Spanner and Vitess[S3], and spent three months testing one of them to the point of finding reliability and write-throughput problems[S4]. The sources don’t say which system that was, or whether the 2020 and 2022 evaluations were one exercise or two.
“No cross-shard transactions.” Multi-shard transactions exist and run through DBProxy[S4]. What Figma does not provide is atomicity across shards[S3]. The difference matters for anyone copying the design, because the correct mental model is “best-effort multi-shard commit with a known tear rate”, not “single-shard only”.
“Zero-downtime sharding.” Primary failovers take about 10 seconds of partial availability[S3][S4]; vertical operations took about 30 seconds with about 2% of requests dropped[S2]. Figma claims low downtime and full reversibility, not zero downtime.
“Figma shards by tenant/org.” It doesn’t. It uses per-table keys from a small set (UserID, FileID, OrgID) grouped into colos, precisely because org-sharding doesn’t fit data that moves between orgs[S3][S5].
“DBProxy is a connection pooler.” It’s a query router and planner. Steele: “we wish we had named this something besides dbproxy… PGCAT would not be a replacement for what we have”[S5]. The pooler sat underneath it, PgBouncer in 2024 and PGKeeper by 2026[S11]. Whether DBProxy is open source: no Figma source says it is, and pganalyze’s understanding was that it isn’t[S14].
“They sharded because they ran out of CPU.” True of 2020, not of 2023: the largest vertical partition sat around 10% CPU[S2], and what forced the horizontal work was per-table size, vacuum and IOPS[S3][S4][S5] (Section 2).
“The lesson is: build your own.” The HN cost arguments, such as estimates of RDS IOPS pricing and headcount[S13], are unverified commenter numbers and settle nothing. The more important point is that build-vs-buy is the wrong frame. What made Figma’s approach work was the sequencing: measure coupling, fence at the database, rehearse routing with data unmoved, move data with a reverse path, shard what’s about to break first. Those are transferable whether you end up building a proxy or migrating to a vendor. Suggestions that Aurora Limitless is Figma’s obvious next step[S13][S16] are commentary; Figma has said nothing about it.
Figma’s path is the right one under a fairly specific combination of conditions. Outside that combination it is an expensive way to acquire a permanent platform team.
Copy it when
Do not when
Growth rate vs runway
≥2x/yr with under ~12 months of headroom after vertical moves
Headroom of years; vertical moves still available
Access pattern
≥90% of load already keyed by a small set of entity IDs (measure it)
Heavy ad-hoc filtering, reporting or search on the OLTP store
Cross-entity atomicity
Rare, and partial failure is repairable (design data, social graphs)
Money, inventory, ledgers: a torn commit is an incident
Team
A dedicated DB team that can own a proxy for the life of the company
No one to own the router after the heroes leave
Existing expertise
Deep operational knowledge of your engine and host (RDS, Aurora, self-run PG)
You are already half-migrated to something else
Market
Distributed SQL has not been proven at your footprint and write rate
A managed option is proven at 10x your size on your workload shape
Copy it when all of the following hold. Your growth rate leaves you less than a year of headroom after the cheap vertical moves. At least 90% of your database load (measured, weighted by active sessions, not counted by query shape) is already keyed by a small set of entity IDs. Your cross-entity writes are rare and a torn write is repairable rather than a financial or safety incident. You have a database team that can own a router, a topology service and a pooler for the life of the company. And no managed distributed option has been proven at your footprint and write rate. Figma met all five in 2022. Most companies considering this meet two or three.
The whole program, laid out as a ladder, shows the method more clearly than any single component does.
#
Step
What changes
Rollback
Observed cost
Fence / safety
1
PgBouncer split
Routing only; every pooler still points at the same DB
Point pooler back
Mistakes “visible but harmless”
Security groups: only PgBouncers reach the DB [S2]
2
Vertical partition
Table groups to a new RDS instance
Reverse logical replication, reroute
~30 s partial impact, ~2% requests dropped per op [S2]
Revoke privileges + LSN wait [S2]
3
Logical shard (views)
Routing through hash-range views; data unmoved
Flag back to the main table
“within seconds”, a config change [S3]
None needed: one instance
4
Physical shard
Hash ranges to N instances, full copy
Reverse replication to the source
10 s on primaries, 0 on replicas; rollback “more complex coordination” [S3]
Revoke on RDS, not PgBouncer [S4]
5
Pooler swap (PGKeeper)
PgBouncer → PGKeeper under DBProxy
DBProxy error detector auto-flips back
Flipped back “a few times” [S11]
Replicas first, because DBProxy hedges them [S11]
Our analysis: the steps alternate. A rehearsal that changes routing with data unmoved (1, 3) comes before a data move (2, 4) that reuses the previous fence, so a routing bug and a data-movement bug are never debugged at the same time. Rollback cost rises down the ladder, from a config flip to coordinated reverse replication, which is why each rung soaked before the next.
Copy the method even if you don’t copy the architecture. Five pieces transfer to almost any data-layer migration, including a migration to a vendor database:
pg_stat_activity sampling, plus ORM-level validators recording tables per transaction and call site[S2]. Your partitioning or shard-key choice should come out of this data, not a whiteboard.How copies fail. These are the specific pitfalls, most of them visible in Figma’s own follow-up work:
Counting query shapes instead of load. “90% of queries supported” can still leave a scatter fraction that caps you at 10x. Weight shadow results by AAS or CPU time.
Forgetting the WAL consumers. CDC pipelines, real-time invalidation, search indexers and exports each assume a single ordered stream. Each one either re-centralises the system (LiveGraph’s merged stream[S7]) or multiplies its cost with machine count (the batch replicas[S10]). Inventory them before the first physical split, not after.
Optimising the copy and losing an invariant. Dropping indexes for a faster copy is standard practice[S2][S5], and Figma’s first physical op still failed on a missing index[S4]. Add a gate that diffs the full schema (indexes, constraints, validity) on every target node, replicas included, before traffic moves.
Putting pooling in the router. A stateless, horizontally scaled router and a per-instance connection budget are fundamentally at odds (hundreds of replicas versus about 100 connections[S11]). Plan for a per-instance pooling tier with admission control from day one. Don’t wait for a single-threaded pooler to become the incident source.
Treating the tear rate as a constant. “Two or three a year” holds at Figma’s multi-shard write rate and failure rate. Your number depends on your multi-shard commit volume and how often your primaries die. The tears arrive in clusters during incidents. Build the reconciler for your data-critical paths before you need it.
Letting shards grow. The ~1 TB target[S5] is what keeps each future full-copy reshard cheap. A program that shards once and lets shards grow back to multi-terabyte sizes has rebuilt the original problem, now with a proxy in front of it.
Losing the decision’s contingency. Figma’s own post frames the build as the right call under months of runway and promises to re-evaluate NewSQL once there is bandwidth[S3]. If you copy the decision, copy the review date as well. The Architecture Judgement essays on reversible decisions, and the Technical Leadership essays on owning a platform team’s long tail, go further on that.
Our analysis — questions to ask in the design review
Bottom line
Primary sources are S1–S12 (Figma, Figma engineers, and Figma’s SEC filing); S13–S16 are third-party commentary, cited only for what they claim. Talk and podcast quotes come from auto-captions or published transcripts. A companion Medium post to S16 exists but could not be retrieved. Where sources disagree (runway figures, copy speed-ups, the 16 TB vs “116 TB” table), the text above shows each figure with its own context.
Under the hood of Figma’s infrastructure — Samir Goel, Figma Blog, 21 Nov 2019
The growing pains of database architecture — Tim Liang, Figma Blog, 4 Apr 2023
How Figma’s databases team lived to tell the scale — Sammy Steele, Figma Blog, 14 Mar 2024
5 Lessons from 5 Years of Building Databases at Scale (talk) — Sammy Steele, Systems Distributed ’24, Jun 2024 (video posted 16 Sep 2024)
Postgres.FM episode 100: “To 100TB, and beyond!” — Sammy Steele (guest), Postgres.FM, 7 Jun 2024
LiveGraph: real-time data fetching at Figma — Rudi Chen, Slava Kim, Figma Blog, 14 Oct 2021
Keeping It 100(x) With Real-time Data At Scale — Arushi Bandi, Figma Blog, 17 May 2024
LiveGraph – Scaling Real-Time Data Access (talk) — Braden Walker, @Scale, Dec 2023
How We Built a Custom Permissions DSL at Figma — Jorge Silva, Figma Blog, 13 Mar 2024
From Multi-Day Latency to Near Real-Time Insights: Figma’s Data Pipeline Upgrade — Yichao Zhao, Figma Blog, 29 May 2025
PGKeeper: Building the bouncer we needed for Postgres — Lihao He, Tim Goh, Mehant Baid, Figma Blog, 4 May 2026
Figma, Inc. Form S-1 — SEC EDGAR, 1 Jul 2025
Hacker News discussion of S3 — Hacker News, 14 Mar 2024
How Figma built DBProxy for sharding Postgres (5mins of Postgres) — Lukas Fittl, pganalyze, 15 Mar 2024
How Figma and Notion scaled Postgres (5mins of Postgres) — Lukas Fittl, pganalyze, 8 Jun 2023
Why Has Figma Reinvented the Wheel With PostgreSQL? (video) — Denis Magda, 25 Mar 2024