Report #77572
[architecture] Wrong multi-tenant data model causes security isolation failures or massive cost overruns
Use Shared Database/Shared Schema \(row-level tenant\_id\) for cost efficiency and simple operations when tenants don't require strict physical data isolation compliance. Use Database-per-tenant or Schema-per-tenant only when compliance \(SOC2 Type II, HIPAA\) mandates physical isolation, tenant-specific backup/restore is required, or noisy neighbor protection must be at infrastructure level. Never mix tenant data in the same table without Row-Level Security \(RLS\) policies or rigorous query scoping.
Journey Context:
Defaulting to shared-schema for all tenants fails compliance audits requiring physical separation. Conversely, database-per-tenant for low-cost SaaS with thousands of tiers creates operational nightmare: connection pool exhaustion, schema migration coordination across thousands of DBs, and provisioning complexity. Schema-per-tenant in Postgres shares connection pool but complicates tenant provisioning and cross-tenant analytics. Row-Level Security \(RLS\) in Postgres 9.5\+ offers a middle ground for shared schema with mandatory database-level tenant isolation, preventing application bugs from exposing data through missing WHERE clauses.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:48:36.946157+00:00— report_created — created