Skip to content

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

Neon 7 min read Opinion easyNovice

Multi-tenancy and Database-per-User Design in Postgres

Postgres multi-tenancy comes in three main designs: shared schema, schema-per-user and database-per-user. Shared schema is cheapest but raises the risk and impact of isolation failures. Schema-per-user adds operational burden without strong isolation and is rarely worth it today. Database-per-user gives full isolation, data residency control and a fix for noisy neighbors, and it can pair with either isolated or shared application environments, each with tradeoffs in onboarding, versioning and complexity. Running it at scale requires a control plane to automate onboarding, monitoring and schema upgrades across the database fleet.

Related posts

  • Database-per-User Architecture With Shared Application Environments: How and Why

    Neon mediumAdept

    A single shared application environment serving many per-customer Neon Postgres databases keeps deployment simple, but every tenant database must stay at the same schema version and data residency is hard to offer. Tenant identification can come from a login field, a per-customer subdomain, or a lookup from the user's credentials. A catalog database maps users or JWT-carried customer IDs to Neon project IDs for connection routing, and it also holds tier and feature-flag context. Schema changes need either slow, backward-compatible rollouts using views and triggers, or pre-upgrade testing of each tenant database on branches. The control plane should be kept separate from the app so failures don't take both down.

  • The Many-Database Architecture: Should You Give Every Tenant Their Own Database?

    Turso mediumAdept

    Shared schema with row-level security, schema per tenant, and database per tenant trade off isolation strength against operational cost. Shared schema stays simplest for many small tenants and cross-tenant analytics, but its isolation is only logical. Schema-per-tenant takes on most of the overhead of separate databases for only part of the isolation. Database-per-tenant gives structural isolation, trivial per-tenant deletion and placement in a chosen region. Cheap SQLite-based databases make it affordable, though routing, monitoring and cross-tenant analytics (via ETL or CDC) become operational work. A TypeScript example shows provisioning from a template database and scoping tokens per tenant.

  • Database-per-User Architecture With Isolated Application Environments

    Neon mediumAdept

    Deploying a full copy of the application and its own Neon Postgres project per customer is justified mainly by data residency requirements and by letting customers control upgrade timing, not by per-customer customization, which turns each deployment into a separate product. Complexity moves from runtime routing into provisioning, a central control plane and catalog database that track feature enablement and deployed versions, and per-customer networking such as subdomains or custom URLs. The hardest part is versioning: when fixes are backported across release series, upgrades should be linearized through each minor series, and schema migrations should be idempotent (checking for existing columns and constraints) so backported changes don't conflict with later upgrades.

  • One Postgres, a database per user, or both?

    Turso easyNovice

    Choosing between one Postgres database, a Turso database per user, or both comes down to where data must live, who owns it, and how many features need to read across users. Early-stage web apps default to a single Supabase Postgres with row-level security and a self-hosting exit. Local-first apps like Sample Vault give each user a Turso database synced to their machine, which provides isolation by construction and data ownership if the product disappears. Hybrid apps use Supabase to govern accounts, auth and storage while per-user Turso databases hold user data. Because database-per-user is "a bet against cross-user features", teams should list every cross-user read before adopting it; the agent delegation case shows the cost, since delegated tasks must be copied into a central database.

  • The Noisy Neighbor Problem in Multitenant Architectures

    Neon easyNovice

    Noisy neighbors in a shared Postgres instance such as AWS RDS degrade performance for every tenant through CPU saturation, work_mem and shared_buffers pressure, disk I/O contention on EBS, exhaustion of max_connections, and lock contention from long transactions. Within RDS, the mitigations range from per-tier statement_timeout values, PgBouncer connection quotas per tenant and application-level rate limiting, to schema-per-tenant throttling, up to full database-per-tenant isolation, which is costly and operationally heavy. Neon's pitch is a project per tenant: storage is shared while each tenant gets isolated compute that autoscales and scales to zero, which makes per-tenant isolation affordable.

The quest for software engineering knowledge.

Look:
Layout: