Data Architecture for SaaS applications:-

SaaS applications are frequently required to have a secured data structure per client in addition to the database being robust. Thus, a SaaS application data structure varies from being a single database to a multi database solution. Broadly, there can be four approaches to designing database based on the requirements.

  • One database per client and a master database for the application holding general details e.g. Clients information.
  • Single database for all the clients with separate tables for clients.
  • Single database for all the clients with shared tables.
  • A multi-database solution with a few clients sharing the database based on data load and security factors.

Solutions for creating SaaS data architecture:-

Data can be stored in a single database for all the clients or it can be stored in a different database per client. Other options are a transition state, the transition between multi database and single database is fuzzy. The data can be stored in multiple transition states as described below depending on the volume, security and load factors

Above two pictures depict how the transition happens. So, the data can be stored in “separate DB”, “Separate Schema”, “Shared schema” (One database) or Multiple shared database.

Separate Databases

Storing tenant data in separate databases is simple. Along with this if needed, you can create a master application database holding client details with the database name (assigned dynamically on client creation) for each client.

Shared Database, Separate Schemas

Another approach involves creating separate tables in the same database for each clients.

Shared Database, Shared Schema

Third approach involves using the same database and the same set of tables to host multiple tenants’ data. A given table can include records from multiple tenants stored in any order; a Tenant ID column associates every record with the appropriate tenant.

Conditional DB sharing

Other approach involves using the same database or multiple database to host multiple tenants’ data. A given database can include records from multiple tenants or from single tenant depending on the requirements.

How this works:-
If client needs more security then we can house his data in separate DB.
Clients who do not have very critical data and have less load can be housed in single database.
This approach helps you enjoy the benefits of not increasing the unnecessary load on server with separating clients/data into single/multiple databases.

Ref :- http://msdn.microsoft.com/en-us/library/aa479086.aspx