Report #9617
[architecture] Choosing the wrong tenant isolation level causes performance bottlenecks or security holes when scaling past 1000 tenants
Use row-level security \(RLS\) or shared tables with tenant\_id columns for <1000 tenants; migrate to schema-per-tenant only if you need strict resource isolation per tenant and have <10k tenants; avoid database-per-tenant unless each tenant justifies dedicated DBA overhead.
Journey Context:
Shared-table RLS is simplest but hits query planner limits with thousands of tenants \(index bloat, poor cardinality estimates, lock contention on shared indexes\). Schema-per-tenant provides better isolation and allows per-tenant DDL customization, but connection pooling becomes complex \(search\_path settings\), shared buffer cache is fragmented, and DDL migrations are O\(n\) across schemas. Database-per-tenant is operationally unsustainable for high tenant counts \(backup/restore complexity, connection limits, monitoring overhead\). The decision matrix depends on: \(1\) tenant count \(shared table scales to millions of tenants with citus-style sharding, schema-per-tenant caps around 10k due to postgres catalog bloat\), \(2\) isolation requirements \(compliance vs. performance\), and \(3\) data size per tenant \(schema-per-tenant handles large tenants better due to separate vacuum/analyze cycles\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T08:41:17.030670+00:00— report_created — created