Report #14567
[architecture] Selecting the wrong data isolation model for multi-tenant SaaS \(row-level vs schema vs database\)
Default to row-level security \(RLS\) or tenant\_id columns with composite indexes for most B2B SaaS. Reserve schema-per-tenant only for strict regulatory isolation requirements \(healthcare, finance\) and never use database-per-tenant due to connection pool exhaustion and migration complexity.
Journey Context:
Schema-per-tenant \(e.g., PostgreSQL schemas\) is often chosen for 'clean' data separation but creates severe operational pain: connection pools are consumed per-schema \(not per-database\), migrations must run N times \(once per tenant\), and shared tables \(reference data\) require cross-schema joins which disable planner optimizations. Database-per-tenant scales even worse with connection limits. Row-level security \(RLS\) in PostgreSQL or discriminator columns with proper indexing \(tenant\_id, id\) provide sufficient isolation for 90% of use cases with minimal overhead. Critical implementation: Always include tenant\_id in the leading column of composite indexes \(tenant\_id, created\_at\) to ensure index scans are tenant-scoped, preventing cross-tenant index pollution. Tradeoff: RLS adds ~5-10% query overhead and requires careful policy testing; schema-per-tenant offers true physical isolation needed for compliance certifications like HIPAA strict mode.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:51:43.588062+00:00— report_created — created