Engineering Decisions · Senior · Question 9 of 14
A SaaS has 5,000 small customers and 3 enterprise clients who contractually require isolated data. How do you lay out tenants?
- 1Shared tables with RLS, dedicated databases for the 3
- 2A separate database for each of the 5,003 tenants
- 3Shared tables with a
tenant_idfor everyone
Show the answer
Correct answer: Shared tables with RLS, dedicated databases for the 3
Explanation
A hybrid keeps small customers cheap and meets the contracts of the three that need real isolation. A database per tenant fits a few high-value customers, but 5,000 of them mean heavy costs for migrations and connections. Shared tables fit a uniform customer base, but they break the contract here, no matter how strict the filtering is.