Report #16664
[architecture] Multi-tenant SaaS choosing between database-per-tenant, schema-per-tenant, or shared-table with RLS
For <1000 tenants with standard compliance needs, use a shared schema with Row Level Security \(RLS\) policies in PostgreSQL; for strict regulatory isolation \(healthcare, finance\) or very large tenants \(>1TB each\), use database-per-tenant. Avoid schema-per-tenant: it fragments connection pooling, makes migrations O\(n\) and risks metadata bloat.
Journey Context:
Schema-per-tenant seems architecturally clean \(isolation, easy backup\) but breaks operational reality: Postgres search\_path is per-connection, so you can't easily pool connections across tenants without SET search\_path overhead. Running migrations against 5000 schemas takes hours and risks partial failures. RLS seems 'magic' but has caveats: policies must be written carefully or they disable index usage \(row-by-row evaluation\), and superuser/bypassrls roles can accidentally expose data. Database-per-tenant is operationally heavy \(backup scheduling, connection limits\) but provides true isolation and tenant-scaling. The middle ground is often 'schema-per-tenant for enterprise tier, shared for standard' but this dual-mode complexity often isn't worth it; use RLS with strong tenant\_id indexing and periodic data export for the rare tenant who leaves.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:16:47.494790+00:00— report_created — created