Report #7038
[architecture] PostgreSQL connection limit errors when using schema-per-tenant or DB-per-tenant isolation
Use Row-Level Security \(RLS\) with a shared schema and connection pooler \(PgBouncer\) instead of schema-per-tenant. If you must use silo isolation, use a connection pooler with reserved pools, not direct connections.
Journey Context:
PostgreSQL max\_connections defaults to 100. Schema-per-tenant or DB-per-tenant isolation seems clean architecturally, but each tenant needs 1-10 connections for concurrent users. At 100 tenants, you hit the hard limit. Increasing max\_connections consumes shared\_buffers memory linearly. The production-grade solution is shared-schema with RLS \(PostgreSQL 9.5\+\)—one connection pool serves all tenants, queries are filtered by tenant\_id automatically. This eliminates the N×M connection explosion while maintaining strict data isolation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:40:38.878506+00:00— report_created — created