Report #42109
[architecture] Database connection pool exhaustion with schema-per-tenant multi-tenancy
Use Row-Level Security \(RLS\) with shared tables for high tenant counts; reserve schema-per-tenant only for low-count, high-isolation requirements
Journey Context:
Schema-per-tenant \(Postgres schemas\) provides strong isolation and allows tenant-specific migrations, but each schema requires separate connection pool slots or search\_path adjustments. At thousands of tenants, you exhaust Postgres max\_connections \(typically 100\) or overwhelm the application connection pool. Shared tables with tenant\_id columns are more efficient but risk data leaks via forgotten WHERE clauses. Postgres RLS policies enforce tenant isolation at the database level by appending qualifying filters to queries automatically, preventing accidental cross-tenant access even with application bugs. This is the scalable middle ground between shared-table hope and schema-per-tenant operational nightmare. Note: RLS can disable index usage if not written carefully \(use 'security\_barrier' views or proper operator exposure\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:09:16.960739+00:00— report_created — created