Notion architecture: how Notion scaled (4 case studies)

Notion runs on PostgreSQL sharded by workspace. Its 2021 post covers splitting the Postgres monolith into a fleet of logical shards keyed by workspace, migrated with double writes and backfills. In 2023 it tripled the Postgres fleet by re-sharding with logical replication and careful PgBouncer cutovers, with zero downtime. Notion also built a CDC data lake (Debezium to Kafka to Apache Hudi on S3, processed with Spark) and caches data in the browser with WASM SQLite.

We track 4 public engineering write-ups by Notion, published between 2021 and 2024. They cover change data capture, client-side caching, data lake and double writes. Stack mentioned most: PostgreSQL (2). Each card below links to our short summary and the original post.

Tech used in Notion's scaling write-ups

Notion scaling timeline: every story, summarized

  1. 2021-10-06

    Herding elephants: Lessons learned from sharding Postgres at Notion

    Notion split its Postgres monolith into a fleet of logical shards keyed by workspace, using double-writes and backfills to migrate.

    horizontal shardingonline migrationdouble writesPostgreSQLAWS RDS

    Read the original post →

  2. 2023-07-17

    The Great Re-shard: adding Postgres capacity (again) with zero downtime

    Notion tripled its Postgres fleet by re-sharding with logical replication and careful PgBouncer cutovers, with no downtime.

    reshardinglogical replicationzero downtimePostgreSQLPgBouncer

    Read the original post →

  3. 2024-07-01

    Building and scaling Notion's data lake

    Notion replaced slow warehouse syncs with a CDC pipeline (Debezium to Kafka to Hudi on S3) processed with Spark.

    change data capturedata lakeincremental ingestionKafkaDebeziumApache HudiSpark

    Read the original post →

  4. 2024-07-10

    How we sped up Notion in the browser with WASM SQLite

    Notion cached data in the browser with WASM SQLite and OPFS, improving page navigation times.

    client-side cachingSQLiteWebAssembly

    Read the original post →

FAQ

What database does Notion use?

PostgreSQL, sharded by workspace, according to Notion's 2021 and 2023 posts. Its data lake uses Debezium, Kafka, Apache Hudi and S3, and the browser app caches data with WASM SQLite.

How did Notion shard Postgres?

Notion split its Postgres monolith into logical shards keyed by workspace and moved data with double writes and backfills (2021). In 2023 it re-sharded to triple the fleet using logical replication and PgBouncer cutovers, with no downtime.

How does Notion's data lake work?

Notion's 2024 post describes replacing slow warehouse syncs with a change-data-capture pipeline: Debezium to Kafka to Apache Hudi on S3, processed with Spark.

The best scaling write-ups, weekly

One email a week. No spam.

Subscribe

Browse all 87 topics →