Skip to content
Databricks Blog (Postgres / Lakebase)·· 7d ago

Rethinking Read Replicas for the Lakebase Architecture

Rethinking read replicas for the lakebase architecture

Key Takeaway

Databricks' Lakebase Postgres attaches read replicas as extra compute to the primary's existing storage, so a replica copies no data, is ready in seconds, adds no storage cost, and scales to zero when idle.

Why It Matters

Separating compute from durable storage gives heavy reads their own compute and cache, while reads that need to see their own writes stay on the primary.

Technical Breakdown · Distilled from the original source

How multiple compute nodes share storage

  • The PostgreSQL compute layer plans and executes queries, enforces MVCC, and generates WAL. It uses shared buffers in memory and a local NVMe cache but owns no durable state. Safekeepers replicate WAL using a Paxos-based protocol, and transactions commit after a quorum acknowledges them.
  • Pageservers turn WAL into pages and can reconstruct a page at a specified log position via GetPage@LSN. Object storage retains the long-term, immutable history. Compute nodes on the same branch use those pages rather than maintaining separate full database copies.

How replicas start and catch up

  • The control plane starts a read-only compute on the same branch and initializes it from a slim base backup served by a pageserver. The replica streams WAL directly from Safekeepers and fetches pages from the same pageservers as the primary, so the primary does not have to stream WAL to it.
  • A replica starts with an empty local cache and fills it on demand. It applies WAL only to cached pages and fetches other pages from a pageserver at its own WAL position.

Read routing and workload isolation

  • Keep writes and reads requiring read-your-writes behavior on the primary. Reporting scans, ad hoc investigations, and batch exports can use replica compute without competing for the primary's CPU or cache.
  • Each replica can have autoscaling bounds independent of the primary. A dedicated replica for intermittent jobs can suspend when idle and resume on the next query.
Source: Databricks Blog (Postgres / Lakebase)· databricks.com

PG Radar summarizes verified changes and impact. Read the original post for full technical details and code samples.

Read Official Source

Related PostgreSQL Reference