Meaning
Software architecture strategies where each customer shares a database instance but holds a distinct database schema with its own separate tables and views balance security and cost. Using a schema-per-tenant architecture allows application developers to provide data isolation without the high infrastructure overhead of dedicated database servers. This approach sits between shared and fully isolated models.
Database Architecture
Database setups using this model utilize the native user permissions and schema namespaces of the database engine to isolate customer data. In a schema-per-tenant pattern, SQL queries specify the schema name of the active tenant, preventing users from accessing or modifying records belonging to another account. This isolation protects the tenant against accidental data leaks caused by poorly written application queries.
It provides a reliable barrier that satisfies most corporate security policies while allowing the application to run on a single shared database engine.
Resource Allocation
Resources are utilized more efficiently compared to having separate database servers because the underlying operating system manages a single pool of memory and connection threads. This sharing reduces hosting costs and simplifies database scale-out. Adding new customers simply requires creating a new schema, which runs in seconds.
Software Maintenance
Maintenance tasks require automated update scripts to apply structural changes across all schemas in sequential order. When a table structure is modified, the migration engine runs the alteration commands across all tenant schemas to ensure compatibility. This approach keeps all customers on the same software version.