Skip to content
Zutra HyperSaaS — 6 languages, auth UI, dashboard, 69 tests
Get it on Gumroad

Zutra v1.3.0 — 6 languages, auth UI, dashboard, 69 tests. Saves 80+ hours.

See what's included
All articles
architecturedatabaseperformanceedge

Edge Databases: Why Sub-5ms Latency Changes Everything

MFMax Ferreira
October 30, 20249 min read

The round-trip problem

Every database query your server makes is a synchronous blocking operation. Your user sends a request. Your server receives it. Your server asks your database a question. Your database answers. Your server responds.

In a traditional single-region deployment, that database round-trip adds 20–80ms on a good day. In multi-region, it’s worse — your application server is in us-east-1, your database is in us-east-1, but your user is in Tokyo. They’re 160ms away from your application. And then your application is 2ms away from its database. So 162ms total for a single query before any compute.

What edge databases change

An edge database replicates your data to nodes geographically close to your users. When a user in Tokyo reads data, they read from the Tokyo replica — not the US primary. The query runs in under 5ms.

Writes still go to the primary (consistency requires it), but reads — which constitute 80-95% of typical SaaS traffic — are served locally.

Zutra’s approach

Zutra’s database layer is built on globally replicated Postgres. You get:

  • Read replicas in 10+ regions, automatically selected by proximity
  • Connection pooling handled at the infrastructure layer — no PgBouncer configuration required
  • Row-level security enforced at the database level for multi-tenant isolation
  • Migrations via version-controlled schema files, applied atomically

The connection string is a single environment variable. The replication topology is invisible to your application code.

A concrete example

// This query runs on the nearest read replica automatically.
// No client configuration required.
const { data } = await db
  .from('analytics_events')
  .select('*')
  .eq('tenant_id', session.tenantId)
  .gte('created_at', startDate)
  .order('created_at', { ascending: false })
  .limit(1000);

That’s it. The client knows your user’s region. It routes to the nearest replica. Sub-5ms.

When this matters most

The performance improvement is most pronounced for:

  1. Read-heavy analytics dashboards — every page load fires multiple queries
  2. Globally distributed user bases — users in every timezone
  3. Real-time interfaces — sub-50ms total response time requirements

For write-heavy workloads (e.g., high-frequency event ingestion), you still need to think carefully about write amplification and replica lag. Edge reads solve the read problem, not the write problem.

Benchmarks

We ran a simple benchmark: a dashboard page load that fires 6 queries against a 10M-row dataset.

Setup P50 P99
Single-region Postgres (same region) 45ms 180ms
Single-region Postgres (cross-region user) 210ms 640ms
Zutra edge database (Tokyo user) 18ms 52ms

The cross-region improvement is 11x at P50. That’s not a micro-optimization. That’s the difference between a product that feels fast and one that feels broken.

The architectural takeaway

Database latency is a distributed systems problem dressed as a performance problem. Solving it at the infrastructure layer — rather than by caching, denormalizing, or limiting query expressiveness — keeps your application code clean and correct.

This is why Zutra treats the database as a first-class infrastructure primitive rather than an afterthought.