Every SaaS product has to decide how customers’ data is separated. The choice affects security, cost, performance and how easily you can meet enterprise customers’ requirements, and it is expensive to change later.
Shared database, shared tables
Every table carries a tenant ID. This is the cheapest and simplest model to run, and it scales to many small customers. The risk is a missing filter that shows one customer another’s data, so enforce tenant scoping centrally, for example with row-level security in PostgreSQL, rather than trusting every query.
Schema per tenant
Each customer gets its own schema in a shared database. Isolation is stronger and backing up or restoring one customer is easier, but every migration must run across every schema, and very large numbers of schemas become hard to manage.
Database per tenant
The strongest isolation, independent scaling and the option to place data in a customer’s preferred region. It also costs the most, and needs automation for provisioning, migrations and monitoring.
A common hybrid
- Shared tables for most customers
- Dedicated databases for large or regulated customers who pay for them
- One codebase and one deployment process for both
Our engineers and consultants write about what they see in real projects. Have a question about your own systems?






