Hosted App SAAS - Database Structure

I am wondering... if you were going to create a hosted application for your clients... similar to a 37Signals app or SalesForce.com, how would you structure the database and seperation of the accounts?

Would everyone's data be in the same database (relying on the code to make sure the data does not overflow) or something else? Pointing me to any resources on the topic will be much appreciated.

~ mel

I am working on a SaaS solution as well. My design has one database and most tables in the database has an organization_id to segregate data.

Mel,

Think of it this way. What kind of a maintenance headache would you have if you created a new db for every customer?

Assuming you want lots of customers then you are probably going to want to minimise your operational overhead & store all data in a single db.

Look at the facebook API as guide, they probably have way more users than your app will, & you can see that they seem to keep all their user data in one db. Although you never know what is going on under the hood.

In its simplest form you probably want two tables, organisations & users & have the following relationships.

Organisation - has many users

User - belongs to organisation

rgds, - matt.

Tickex - the search engine for concert, theatre, and sports tickets http://www.tickex.com

Thanks for the feedback. I'm keep it in mind.