Joseph Leporati

Engineering notes

Writing: multi-tenant

Notes on building and running production systems: payments and ledgers, multi-tenant architecture, reliability and performance, and applied AI. By Joseph Leporati, software engineer and technical program manager in Monroe, Louisiana.

· 7 min read · multi-tenant

Multi-Tenant Data Isolation: Shared Schema, RLS, or Separate DBs

For most multi-client portals and SaaS products, use one shared schema with a tenantid column on every tenant-owned table, and enforce PostgreSQL row-level security (RLS) under it so the database, not each developer, filters every query by tenant. Choose database-per-tenant only when a contract or regulation requires physical separation. Schema-per-tenant rarely justifies its migration overhead. RLS is only a real backstop if you configure FORCE, WITH CHECK and CI checks correctly.

Read the article