Reputation: 1054
I'm working on SaaS application that uses the one DB per client model. It also has common "accounts" database where some basic information about the account is kept and also provides log-in functionality.
My question - is it worth creating new database user for each client database that has permissions only on that database or a single database user with access to all client databases makes more sense (i.e. "account\_%
.*")?
Upvotes: 6
Views: 3014
Reputation: 32841
It's easy to think about creating all those databases.
But also please think about how you are going to maintain them all in the long run.
I'm not saying don't create multiple databases. I'm just suggesting that you think about the consequences.
Upvotes: 3
Reputation: 14519
I would create new databases, but it depends. Basically whatever floats your boat :)
one database per user:
+ security is easier
+ async parallel requests (if your server can handle it)
- a bit heavier on disk
one database:
+ one file to handle instead of a bunch (if that's even a +)
+ little bit more space efficient
- slow when data reaches big amounts
- no simultaneous connections meaning a heavy sql request from one user will dos all other
Upvotes: 2
Reputation: 38378
If security is the concern, user per database is a way to go.
Upvotes: 4