The Reddit threads are full of strong opinions. One engineer managing an ERP system with separate databases per tenant is considering the switch to a shared model. Others swear by row-level security. A few have built elaborate custom systems to keep hundreds of databases in sync. Everyone’s confident. Nobody agrees.
Here’s what I’ve learned from digging through the trenches: the “right” answer depends less on technical purity and more on your tenant demographics, your contract obligations, and how much operational pain you’re willing to absorb.

The Three Models: Pool, Bridge, and Silo
The AWS SaaS architecture whitepaper calls them pool, bridge, and silo models. Most products mix them, small tenants pooled, large ones siloed. But understanding where each model breaks requires looking at the trade-offs systematically.
| Shared schema | Schema per tenant | Database per tenant | |
|---|---|---|---|
| Isolation | Logical, enforced by keys and policies | Namespaced, shared server | Strongest, separate database |
| Cost per tenant | Lowest | Low | Highest |
| Migrations | One run for everyone | One run per schema | One run per database |
| Noisy neighbors | Possible | Possible | Isolated |
| Per-tenant restore | Hard | Moderate | Easy |
| Tenant count it suits | Thousands and up | Tens to hundreds | Few, high-value |
Schema-per-tenant sits awkwardly in the middle. One experienced database engineer put it bluntly: “Schema-per-tenant has most of the hassle and little of the benefits of database-per-tenant.” You get the migration nightmare without the isolation benefits. Unless a contract specifically requires schema-level separation, it’s hard to justify.
The Database-Per-Tenant Trap
Multiple identical databases sound clean in theory. Each tenant gets their own sandbox. No cross-tenant leakage possible. But practitioners who’ve lived through it tell a different story.
One developer described their experience: “Multiple identical databases can easily become a nightmare especially with deploying migrations and maintenance, debugging etc.” The pattern repeats across teams: you start with five databases, then fifty, then five hundred. Each one needs migrations applied, monitoring configured, backups verified.
The operational overhead compounds in ways that don’t show up in architecture diagrams. Migration tooling becomes a fleet management problem. Liquibase or similar database versioning tools become mandatory within mature CI/CD pipelines. You’ll occasionally need to move a tenant database between servers or cloud clusters when it outgrows its host.
Then there’s the scaling question. One engineer raised the perennial problem: “How do you scale a single tenant that needs 10x the performance?” With database-per-tenant, you can move that one tenant to a beefier server. But now you’re managing heterogeneous infrastructure. That expensive enterprise customer just became your personal infrastructure project.
The migration path from per-tenant databases to a shared architecture gets worse the longer you wait. Moving a tenant from shared tables into its own database requires an inventory of every tenant-owned record, files, events, search documents, cached objects, and external identifiers. You need a consistent snapshot or change-data-capture process, reconciliation of row counts and business totals, referential integrity testing, authorization validation, and a rollback plan.
Why Shared Schemas Actually Scale
The shared model with row-level security (RLS) has emerged as the pragmatic default for teams building at scale. Not because it’s perfect, but because it eliminates entire categories of operational pain.
The Citus multi-tenant data modeling guide covers this in depth. The core principles are straightforward: every tenant-owned table gets a tenant_id column including join tables. Primary keys become composite. Foreign keys include the tenant. Unique constraints scope per tenant. Indexes lead with tenant.
Here’s the schema pattern that makes shared multi-tenancy safe:
CREATE TABLE customers (
tenant_id UUID NOT NULL,
id BIGINT GENERATED ALWAYS AS IDENTITY,
email TEXT NOT NULL,
name TEXT NOT NULL,
PRIMARY KEY (tenant_id, id),
UNIQUE (tenant_id, email)
);
CREATE TABLE invoices (
tenant_id UUID NOT NULL,
id BIGINT GENERATED ALWAYS AS IDENTITY,
customer_id BIGINT NOT NULL,
amount_cents BIGINT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (tenant_id, id),
-- The tenant is part of the key, so an invoice cannot reference another tenant's customer.
FOREIGN KEY (tenant_id, customer_id) REFERENCES customers (tenant_id, id)
);
CREATE INDEX invoices_by_tenant_time ON invoices (tenant_id, created_at DESC);
The composite foreign key is the killer feature here. An invoice physically cannot point at another tenant’s customer. The database enforces the boundary even when application code makes mistakes.
But this only works if you layer row-level security as a backstop. A missing WHERE tenant_id = ? in application code should return nothing, not everything. RLS policies become the safety net that catches the bugs your code review missed.
The RLS Skepticism Problem
The most common pushback to shared schemas is security anxiety. The concern is fair, but it mostly comes down to a few specific mistakes people make.
First, the app connection shouldn’t own the tables. In Postgres, the owner skips RLS unless you force it. Create a dedicated login that doesn’t own anything. Second, put tenant_id in your foreign keys so a row can’t point at another tenant’s data by accident. Third, maintain a test that signs in as tenant A and tries to read tenant B. While that comes back empty, you’re in good shape.
One engineer who’s done both models summed it up: “With multi-tenant database, RLS imo is superior to DIY id per table. In both cases discipline is needed, but RLS enforced that discipline a little better and possibly in a single place as opposed to each and every query.”
The tenant ID must come from the authenticated session, never from a request parameter. The auth handler resolves the token to a user and tenant, and handlers read the tenant from that context. If a client can send its own tenant_id, you’ve already lost.
The Hybrid Model Nobody Talks About
Here’s where the conversation gets interesting: you don’t have to pick one. The most pragmatic architecture is a hybrid.
Start everyone on a shared schema with RLS. Design your tenant resolution layer so switching a tenant between models is a configuration change, not a rewrite. When a large enterprise customer signs a contract requiring dedicated infrastructure, provision their database and move them. When a regulated industry customer needs data residency in a specific region, spin up a dedicated instance.
“Starting shared and moving the few tenants who need it is much easier than starting siloed and consolidating later, as long as the shared design keeps tenants cleanly separable.”
This is the path that many experienced teams recommend. The hybrid approach acknowledges that your tenant base isn’t homogeneous. Some customers pay enough to justify dedicated infrastructure. Most don’t. Your architecture should reflect that economic reality.
The database-per-user model works exceptionally well for local-first apps and AI agent platforms where each user’s data genuinely never needs to cross boundaries. But it’s a bet against cross-user features. The moment you need to query across tenants for analytics, search, or admin tooling, you’re either querying hundreds of databases or building ETL jobs to aggregate data into a central store.
Where AI Agents Break the Model
AI agents add a new wrinkle to the database-per-tenant debate. Agent platforms often have enterprise customers who need data to stay in their own cloud account. Solutions like Turso Cloud BYOC run the database-per-user model in the customer’s AWS or GCP account, so data never leaves infrastructure the customer controls.
But agents also need to coordinate. When a user delegates a task to an AI agent, the server has to find every delegated task across every user and work out which agent it belongs to. With each user’s tasks in a separate database, the only direct route is to query every database one by one.
The common workaround is copying delegated tasks into a master database. As one CTO candidly admitted: “There is a little bit of a breach of what Turso is there to solve, like a separation of concerns and separation of data.”
This is the fundamental tension. Database-per-tenant gives you isolation by construction. But it sacrifices the ability to query across tenants. If you need that capability, and most SaaS products eventually do, you end up duplicating data or building complex aggregation pipelines.
The Cost Reality Check
Cloud costs tell a brutal story. A shared database with a single large instance serves thousands of tenants. Database-per-tenant means you’re paying for at least a minimum instance size per tenant, even if they’re using 1% of it. The math rarely works out for the “fewer, high-value” tenants that database-per-tenant suits.
The cost analysis from Encore’s guide is unambiguous: shared schema is cheapest per tenant, database-per-tenant is most expensive. The operational overhead of running migrations across hundreds of schemas or databases, fragmenting connection pools, and managing tenant counts in the thousands strains catalogs and tooling.
There’s also the scalability ceiling on managed cloud databases. As one engineer noted, on AWS you’re “essentially required to keep doubling the size of the server.” Database-per-tenant lets you scale out by adding new servers. But now you’re running a fleet, and fleet management is its own product.
What Actually Decides It
The decision framework comes down to four questions:
- What does the product need? If most features work on one tenant’s data, database-per-tenant fits. If many features need to read across tenants, a shared database fits better.
- What do your contracts require? Customer contracts requiring isolation, one tenant’s data volume dominating shared tables, or per-customer restore capability all point toward dedicated infrastructure.
- How many tenants do you have? Thousands of small tenants demand shared. A handful of enterprise customers can justify dedicated.
- What’s the exit strategy? Early products pivot. Every recommendation should come with a way out, whether that’s RLS policies designed for clean migration or a tenant resolution layer that makes switching a configuration change.
The consequences of missing tenant isolation are severe, but so are the consequences of over-engineering isolation you don’t need. The teams that succeed are the ones who design for the tenant distribution they actually have, not the one they fantasize about.
The Boring Answer
The shared schema with RLS, partitioned by tenant ID, with composite foreign keys is the right starting point for most SaaS products. Not because it’s elegant, but because it’s operationally sustainable. One migration for everyone. One monitoring setup. One backup strategy. The database enforces the tenant boundary even when your code forgets.
Database-per-tenant is the right answer for a specific subset: enterprise contracts requiring isolation, data residency requirements, or products where tenant data genuinely never needs to cross boundaries. The operational cost is real, but it’s the cost of doing business with those customers.
Schema-per-tenant is the awkward middle child. Most of the operational hassle of database-per-tenant with few of the isolation benefits. Choose it only when a contract explicitly requires schema-level separation.
And if you’re starting fresh, remember: moving the few tenants who need dedicated databases out of your shared schema is far easier than consolidating hundreds of siloed databases back into one. Design for the outcome you want, not the one you’re afraid of.


