Report #14727
[architecture] Choosing the wrong tenant isolation strategy causing performance bottlenecks or security vulnerabilities
Use shared-schema with PostgreSQL Row-Level Security \(RLS\) for pool isolation with thousands of tenants; use schema-per-tenant for silo isolation with hundreds of tenants requiring strong separation but shared infrastructure; avoid database-per-tenant unless regulatory requirements demand it due to connection pool exhaustion and migration complexity. Implement RLS with 'security definer' functions and tenant\_id column, never rely on application-layer filtering alone.
Journey Context:
Shared-schema with \`tenant\_id\` columns is operationally simple but risks data leaks if queries miss the filter; RLS enforces it at the database level but has performance overhead \(per-row policy checks\) and complexity with joins/aggregations. Schema-per-tenant offers better isolation \(can restore single tenant, different schemas per tenant\) but connection pools must be managed carefully \(PgBouncer with \`pool\_mode=transaction\`\), and schema management during migrations is complex \(must run DDL N times\). Database-per-tenant is operationally unsustainable for high tenant counts: schema migrations must run N times, monitoring is fragmented, and cloud database connection limits are hit quickly. RLS is the modern default for pooled SaaS; schema-per-tenant for 'silo' model in AWS/Azure SaaS offerings.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:17:37.009959+00:00— report_created — created