Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 3 min read How-to mediumAdept

Scaling Prisma applications with Neon read-only replicas

Neon read-only replicas are independent compute instances that read from the same shared storage as the read-write compute. Because no data is copied via WAL replay as in traditional Postgres, they add no storage cost and are up to date at startup. Prisma apps can route reads to them with the @prisma/extension-read-replicas Client extension, which picks a random replica when several URLs are given. Writes and $transaction queries go to the primary, and $primary() forces a read against the primary when fresh data is required.

Assumes: Prisma ORM basicsPostgreSQL

Related posts

  • Rethinking read replicas for the lakebase architecture

    Neon mediumAdept

    Lakebase Postgres implements read replicas as additional read-only computes attached to the same disaggregated storage as the primary, rather than as physical clones with their own volumes. Each replica boots from a slim base backup from the pageserver, streams WAL from Paxos-replicated safekeepers instead of the primary, and reads pages via GetPage@LSN. As a result, creation takes seconds regardless of database size, N replicas still means one copy of the data, and replicas autoscale and scale to zero with no WAL backlog to replay on wake. The post contrasts this with RDS replica provisioning (snapshot, volume hydration, streaming replication catch-up) and lists per-workload uses such as analytics, investigations, read-only agent access and background jobs.

  • Introducing Read Replicas

    Supabase mediumAdept

    Supabase now supports Postgres read replicas in 12 regions, up to two per project, for offloading reads and analytics, serving data closer to users, and redundancy. Replication combines native streaming replication for low lag with file-based WAL shipping as a fallback, reusing their PITR pipeline (WAL-G archiving to S3) so replicas that fall behind past wal_keep_size can still catch up. Each replica gets its own Supavisor connection pool and PostgREST instance, with a round-robin load-balancing endpoint. Pricing covers replica compute and disk plus $0.09/GB WAL transfer, and automatic failover, geo-routing and Supavisor read/write splitting are planned.

  • When to use Read Replicas vs. bigger compute

    Supabase mediumAdept

    Choosing between vertical scaling and Postgres Read Replicas comes down to diagnosing the bottleneck first, using pg_stat_statements, read/write ratio queries, CPU utilization and EXPLAIN ANALYZE. Upgrade compute for write-heavy workloads, simple fixes with no code changes, or when tier headroom remains. Add replicas to isolate analytics, serve distant regions, or scale reads past the 16XL ceiling. Worked cost comparisons show replicas becoming more cost-effective at higher tiers. Long analytics queries on replicas need tuning of max_standby_streaming_delay, with hot_standby_feedback as a last resort because it bloats the primary. Connection pooling, CDC-based Pipelines and Multigres sharding are covered as alternatives.

  • A Deep Dive Into Neon’s Instant PITR

    Neon mediumAdept

    Neon's point-in-time restore is instant because its storage is copy-on-write: compute nodes stream WAL to Paxos-replicated safekeepers, and pageservers reconstruct any page at any past LSN from image and delta layers kept in object storage. A restore maps the requested timestamp to an LSN and creates a new branch that references existing layers through GetPage@LSN, so no data is copied. That makes restores take under a second regardless of database size, compared with RDS-style restores that load a snapshot into a new instance and replay WAL, which can take hours for multi-TB databases.

  • Architecture decisions in Neon

    Neon mediumAdept

    Neon built serverless Postgres by separating storage from compute without forking Postgres. Postgres streams WAL over the network to a separate WAL service of safekeeper nodes, which use consensus for durability and to prevent split-brain. Multi-tenant pageservers rebuild any page version on request. All historical page versions are kept in immutable, LSM-inspired files that are compressed and offloaded to object storage like S3, which replaces traditional backups and WAL archives and makes point-in-time recovery and branching cheap.

The quest for software engineering knowledge.

Look:
Layout: