Skip to content
All termsENGINEERING & ARCHITECTURE

Multi-Tenancy

DEFINITION

A single application serving multiple customer organisations (tenants), with data isolation between them.

In depth

Three common shapes: shared database + tenant ID on every row (cheapest, most common), database per tenant (more isolation, more ops), instance per tenant (highest isolation, highest cost — only for regulated enterprise).

Shared-DB is correct for 95% of SaaS. Put tenant ID on every query, test isolation in CI, and sleep easy.

Formula & example

EXAMPLEA SaaS stores all customers in one Postgres database. Every table has a tenant_id column, every query filters by it, and row-level security policies block any query that forgets. One deploy serves every customer while their data stays separate.

Rules of thumb

  • Put a tenant ID on every tenant-owned row from day one.
  • Enforce isolation in one place (middleware or row-level security), not in each query.
  • Shared database with tenant IDs suits most early SaaS.
  • Offer dedicated databases only when large customers require it.

Common mistakes

  • Forgetting the tenant filter in a single query and leaking data.
  • One noisy tenant slowing everyone, with no per-tenant limits.
  • Database-per-tenant from the start, which multiplies migrations and costs.

FAQ

What are the main multi-tenancy models?

Shared database with tenant IDs, schema per tenant, and database per tenant. Isolation and cost both rise as you move from the first to the last.

How do I prevent data leaks between tenants?

Scope every query by tenant automatically, use row-level security where available, and test cross-tenant access in your test suite.

Can I move a tenant to its own database later?

Yes, if every row carries a tenant ID. That makes it possible to export one tenant's data and migrate it cleanly.

Related terms

USE THIS IN A REAL PLAN

Turn concepts into a real SaaS blueprint

PlanMySaaS runs Multi-Tenancy and every other SaaS metric for your idea — part of a full blueprint with architecture, feature specs, 21 docs, and Cursor-ready prompts.

Last reviewed 14 April 2026 by Abhi Verma.