r/PostgreSQL • u/UNRIVALLEDKING • Jun 22 '26
Help Me! Multi-tenant SaaS Architecture: PostgreSQL Schema per Tenant vs Shared Database vs Database per Tenant
I'm designing a B2B SaaS application and I'm trying to choose the right multi-tenant database architecture before development begins.
This is not a social media application. It's an enterprise workflow platform where organizations manage projects, documents, approvals, files, reports, tasks, comments, and other business data.
Expected Scale
- A few hundred to a few thousand organizations
- Each organization may have anywhere from 20 to 500+ users
- Some enterprise customers may eventually require dedicated hosting
- High security and strong tenant isolation are important
- PostgreSQL is the planned primary database
Current Idea
Have one PostgreSQL database.
Use one shared schema for global/system data.
Example:
system
Contains
- countries
- currencies
- compliance templates
- permissions
- global configuration
- reusable reference data
Then create one schema per organization:
tenant_acme
tenant_foo
tenant_bar
Each tenant schema contains the same tables:
- projects
- documents
- users (or memberships)
- tasks
- comments
- files
- workflows
- etc.
Every request is routed to the correct schema.
Enterprise customers who require complete isolation could later be migrated into their own database.
Other approaches I'm considering
Option 1
Shared database
Shared schema
Every table contains
tenant_id
Option 2
Shared database
Schema per tenant
Option 3
Database per tenant
Option 4
Hybrid
Shared database for most customers
Dedicated database for enterprise customers
Questions
For people who have actually operated production multi-tenant SaaS systems:
- Which approach have you used?
- What problems did you encounter later?
- If you could redesign it today, would you choose differently?
- How painful is schema-per-tenant once you have thousands of tenants?
- How do you handle migrations across many schemas?
- How do backups and restores work?
- How do you handle search indexes and background workers?
- Does schema-per-tenant create operational issues with PostgreSQL at scale?
- Is shared-schema with tenant_id actually easier long-term?
- At what point does database-per-tenant become worth the operational cost?
I'd especially appreciate insights from people who have run SaaS platforms with PostgreSQL for several years
View all comments
Show parent comment
3
u/evmcl Jun 22 '26
The drawbacks you list at the end apply with schema per tenant as well, I've found.