intermediateDatabase Design — Normalization, Denormalization & Multi-Tenant
You're building a SaaS product for 5000 tenants. Each tenant has different data (orders, customers, products). Which database isolation model do you use?
Shared Database, Shared Schema with Row-Level Security for 5000 tenants. Rationale: Separate DB (5000 databases) = impossible to manage, hugely expensive. Separate Schema (5000 schemas) = planner overhead, connection pool complexity. Shared Schema = single manageable database, cost-effective, RLS enforces isolation. Implementation: 1) Add UUID tenant_id to every table. 2) CREATE INDEX on (tenant_i
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response