Report #76591
[architecture] Multi-tenant data isolation strategy selection balancing compliance and operational overhead
Use PostgreSQL Row-Level Security \(RLS\) with tenant\_id columns for the majority of tenants; reserve separate schemas only for tenants requiring physical isolation \(e.g., HIPAA\), and separate databases only for tenants requiring infrastructure isolation \(e.g., different backup SLAs\).
Journey Context:
Database-per-tenant provides perfect isolation but exhausts connection pools and complicates schema migrations \(N migrations\). Schema-per-tenant shares connection pools but still requires N migration runs and suffers from 'noisy neighbor' table bloat issues. Row-Level Security \(RLS\) in PostgreSQL enforces tenant isolation at the database layer via policy functions attached to tables, allowing true shared tables with connection pooling efficiency. Critical caveat: RLS policies must be exhaustively tested as they bypass application logic—security definer functions can accidentally expose data if misconfigured. Performance impact is minimal if tenant\_id is indexed and policies are simple equality checks. For compliance regimes requiring physical separation \(e.g., certain healthcare or financial regulations\), schema-per-tenant or database-per-tenant remains necessary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:09:00.506155+00:00— report_created — created