Report #38319
[architecture] Multi-tenant SaaS data isolation strategy choice
Start with shared schema \(row-level security\) for simplicity; move to schema-per-tenant only if you need strong isolation but cannot afford DB-per-tenant connection overhead; use database-per-tenant only for enterprise tiers with strict compliance \(HIPAA\). Never use schema-per-tenant on PostgreSQL without planning for connection pool exhaustion and shared catalog bloat \(pg\_class limits\).
Journey Context:
Shared schema: simplest migrations, but risk of data leakage \(must enforce tenant\_id on every query\). Schema-per-tenant: feels like middle ground, but in Postgres each schema is in the shared catalog; 1000\+ tenants causes pg\_class bloat and slow autovacuum. Connection pooling breaks because you cannot SET search\_path on a shared PgBouncer connection easily. DB-per-tenant: ultimate isolation, but migrations are a nightmare \(schema drift across thousands of DBs\), and connection limits \(Postgres default 100\) kill you. Many choose schema-per-tenant thinking it's safe middle ground, but for Postgres it's often the worst of both worlds; Citus \(now Azure Cosmos DB for PostgreSQL\) recommends shared-schema with tenant\_id sharding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:47:52.980586+00:00— report_created — created