A multi-tenant SaaS platform runs thousands of tenants on a shared relational database, but a handful of tenants now hold most of the data. Should it use shared tables, tenant partitioning, dedicated databases, sharding or a hybrid?
Show the full answer Hide the answer
The answer is hybrid, and the reasoning matters more than the answer
The tenant distribution is the deciding fact. Thousands of small tenants and a handful of enormous ones are two different workloads, and any single model optimises for one at the expense of the other.
- Shared tables with a tenant column are correct for the long tail: cheap, one schema to migrate, one connection pool, high density. Thousands of small tenants cost almost nothing each.
- Dedicated databases are correct for the largest tenants: they get isolation, predictable performance, independent scaling, and — often decisive commercially — the ability to be restored, migrated or given residency guarantees independently.
- The hybrid is the architecture, with a routing layer that resolves tenant to placement and the ability to migrate a tenant from shared to dedicated without a rewrite. That migration capability is the real design requirement; everything else follows from it.
What the routing layer must provide
- Tenant resolution on every request, at the edge, before any data access.
- Connection management per placement, since a shared pool across placements reintroduces the coupling.
- The same application code against both, or you have two products.
- A migration path that is online: dual-write or CDC-based replication into the new placement, a verification pass, a cutover with a brief write pause, and a rollback.
The isolation that must exist regardless of placement
Placement alone does not stop a noisy neighbour within the shared tier. You still need per-tenant quotas on queries, connections, storage and background jobs, and a way to identify which tenant caused a spike. Without that, one aggressive tenant in the shared tier degrades hundreds of others, and the fix — moving them to dedicated — is reactive and slow.
The mistake in both directions
All-shared means the largest customers, who represent most of the revenue, get the worst performance and the least isolation. All-dedicated means thousands of databases to patch, migrate, back up and monitor, which is an operational cost that grows linearly with customer count and is the reason small SaaS businesses drown in infrastructure.
The hybrid's cost is that you operate two models, and that is a genuine, permanent burden — justified only because the alternatives are worse at the extremes of the distribution.