System design · interactive
Multi-tenancy
A SaaS app serves many companies from one system. Their data can share tables, get a schema each, or a database each. The choice decides cost, isolation, and what happens when a developer forgets a WHERE tenant_id clause.
logged in as acme
SELECT * FROM invoices; -- forgot tenant filter
- Acme invoice #12
- Acme invoice #13
- Globex invoice #7 (another customer!)
- Initech invoice #3 (another customer!)
- Isolation
- ●○○
- Cost per tenant
- cents
- Migrations
- one migration
- Noisy neighbours
- high
One missing WHERE clause and acme sees every customer's invoices. With shared tables, isolation depends on every query being right.
Model
Developer forgets the filter
Row-level security
Step 1 of 4 · read left to right
In production
Tools and technologies
SaaS platforms choose a tenancy model early.
Not tied to one language — use these names when you search docs or design a system.