Multi-tenancy: the SaaS decision you cannot defer
Codexa Engineering · Sep 4, 2026 · 2 min read
Most early SaaS decisions are reversible. Pricing changes, features get cut, the interface gets rebuilt. Multi-tenancy is the exception, and it is routinely deferred because on day one, with one customer, it looks like premature architecture.
It is not. It is the shape of every query you will ever write.
What it actually means
Several customers — tenants — using one running system while being completely unable to see each other's data. Simple to state, and every single query has to honour it.
The failure mode is not subtle. One missing filter in one endpoint shows Customer A the records of Customer B, and that is an incident you disclose, not a bug you quietly patch.
The three approaches
- Shared database with a tenant column — cheapest to run and to operate, and depends entirely on discipline in every query.
- Schema per tenant — stronger separation, and migrations now run N times.
- Database per tenant — strongest isolation and the answer enterprise buyers want to hear, with operational cost that grows linearly with customers.
Most products should start with the first and be built so the choice can change. Most products that fail at this did not make a choice at all.
Make isolation structural, not remembered
The mistake is treating the tenant filter as something developers must remember. People forget, especially on a Friday, especially in a query written in a hurry.
Enforce it below the application: row-level security in the database, a query layer that cannot execute without a tenant scope, or an ORM configured so the filter is not optional. The goal is that forgetting it fails loudly rather than leaking quietly.
Things that leak at the edges
Even with the data layer right, tenancy leaks in the places nobody audits:
- Background jobs, which often run without a user context.
- Search indexes, which are usually a separate system with its own permissions.
- File storage, where predictable URLs let one tenant guess another's paths.
- Caches keyed without the tenant, serving one customer's data to another.
- Exports and reports, frequently written fast and reviewed least.
Why it cannot wait
Retrofitting tenancy means touching every table, every query, every job and every cache key, on a live system, with real customer data in it, while continuing to ship.
It is among the most expensive rewrites in commercial software, and it is entirely avoidable by spending a week on it before the first customer.
For how this lands in a budget alongside billing, roles and admin tooling, see our SaaS cost breakdown.
What is multi-tenancy in SaaS?
Several customers using one running system while being completely unable to see each other's data. Simple to state, and every single query has to honour it. The failure mode is not subtle: one missing filter in one endpoint shows Customer A the records of Customer B, which is an incident you disclose rather than a bug you quietly patch.
Can we add multi-tenancy later?
You can, and it is among the most expensive rewrites in commercial software. Retrofitting means touching every table, query, background job and cache key, on a live system, with real customer data in it, while continuing to ship. Spending a week on it before the first customer avoids all of that.
Enjoyed this? Let's work together.
Start a project