Databases · Senior · Question 38 of 75
What are the trade-offs of 'shared tables with tenant_id' versus 'a schema or database per tenant' in a SaaS app?
- ✓Correct answer: Shared tables are simplest to run and scale to many tenants but need strict filtering (e.g. RLS); per-tenant schemas isolate better but complicate migrations and connections
- 2Shared tables make cross-tenant data leaks impossible
- 3Per-tenant databases are always cheaper
Explanation
Many SaaS apps start shared with RLS and move large or regulated tenants to dedicated databases later. Index on (tenant_id, ...).