Report #24523
[architecture] Database isolation strategy for multi-tenant SaaS \(shared vs schema vs database per tenant\)
Use schema-per-tenant for strong isolation with manageable operational overhead; reserve database-per-tenant only for strict compliance requirements that justify the connection pool exhaustion \(Postgres default max\_connections is 100\); avoid shared-table unless you can guarantee row-level security performance and tenant-aware indexing on every query.
Journey Context:
Shared tables \(tenant\_id column\) suffer from cross-tenant index pollution—every index must include tenant\_id or you leak data, and the query planner can struggle with cardinality estimates. Database-per-tenant offers perfect isolation and tenant-specific backups but exhausts connection pools and complicates schema migrations \(you must run DDL thousands of times\). Schema-per-tenant hits the sweet spot: isolation via Postgres schemas \(namespaces\), single database connection pool, ability to restore one tenant via schema-level backup, and efficient schema migration via shared DDL scripts. The tradeoff is that schemas share the same WAL and buffer cache, so a noisy neighbor can impact I/O, but this is manageable with connection pooling \(PgBouncer\) and resource groups.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:34:26.484853+00:00— report_created — created