Report #57998
[architecture] Using separate databases per tenant in SaaS for data isolation
Use PostgreSQL Row Level Security \(RLS\) with a tenant\_id column for true isolation at scale; use Schema-per-tenant only if tenants require heavy customization; never use Database-per-tenant beyond hundreds of tenants
Journey Context:
Database-per-tenant hits connection pool limits, makes migrations O\(n\) complexity \(running DDL across thousands of databases\), and prevents efficient resource sharing. Shared table with RLS enforces isolation at the database engine level \(not application code\), preventing data leaks from query bugs. RLS has a 10-20% performance overhead and requires careful indexing \(tenant\_id must be the leading column in composite indexes\). Schema-per-tenant is a middle ground but complicates migrations \(need to run DDL across all schemas\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:50:19.564601+00:00— report_created — created