Report #47647
[architecture] Multi-tenant data isolation failures and noisy neighbor performance issues
For PostgreSQL, implement Row-Level Security \(RLS\) with tenant\_id columns: CREATE POLICY tenant\_isolation ON orders USING \(tenant\_id = current\_setting\('app.current\_tenant'\)::INT\). Set the tenant context per connection/request. This provides strong isolation without separate schemas/databases while allowing shared connection pooling.
Journey Context:
Schema-per-tenant offers strong isolation but requires connection pooling per schema \(inefficient\) and makes schema migrations O\(n\) with tenant count. Database-per-tenant is operationally heavy and costly. Shared-schema with manual WHERE clauses risks data leakage if developers forget filters. RLS enforces isolation at the database layer—queries without proper tenant context return zero rows, preventing accidental cross-tenant access. Tradeoffs: RLS adds ~5-10% query overhead, requires SET commands on each connection \(use pgbouncer in transaction mode with SET LOCAL\), and debugging is harder \(queries appear to 'lose' data\). Not suitable for cross-tenant analytics \(use ETL to separate warehouse\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:27:43.508161+00:00— report_created — created