Report #93066
[architecture] Multi-tenant data isolation: separate databases per tenant cause connection pool exhaustion, while shared table with app-level filtering risks row leakage
Use schema-per-tenant \(PostgreSQL\) for namespace isolation with shared connection pool, or Row-Level Security \(RLS\) policies with tenant\_id for database-enforced filtering
Journey Context:
Database-per-tenant provides perfect isolation but operational nightmare: schema migrations across N databases, connection limits, and backup complexity. Shared table with \`WHERE tenant\_id = ?\` in application code is error-prone \(easy to miss WHERE clause, causing data leaks\). Schema-per-tenant offers middle ground: isolated namespaces, single database, but migration tools must iterate schemas \(e.g., \`SET search\_path\`\). RLS is modern approach: policies enforce \`tenant\_id = current\_setting\('app.current\_tenant'\)\` automatically, but adds per-row check overhead and requires careful policy testing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:47:57.853455+00:00— report_created — created