Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many is too many databases on SQL Server?

I am working with an application where we store our client data in separate SQL databases for each client. So far this has worked great, there was even a case where some bad code selected the wrong customer ids from the database and since the only data in the database belonged to that client, the damage was not as bad as it could have been. My concerns are about the number of databases you realistically have on an SQL Server.

Is there any additional overhead for each new database you create? We we eventually hit a wall where we have just to many databases on one server? The SQL Server specs say you can have something like 32000 databases but is that possible, does anyone have a large number of database on one server and what are the problems you encounter.

Thanks,

Frank

like image 589
Frank Avatar asked Jul 19 '10 14:07

Frank


2 Answers

The upper limits are

  • disk space
  • memory
  • maintenance

Examples:

  • Rebuilding indexes for 32k databases? When?
  • If 10% of 32k databases each has a active set of 100MB data in memory at one time, you're already at 320GB target server memory
  • knowing what DB you're connected too
  • ...

The effective limit depends on load, usage, database size etc.

Edit: And bandwidth as Wyatt Barnett mentioned.. I forgot about network, the bottleneck everyone forgets about...

like image 88
gbn Avatar answered Oct 06 '22 01:10

gbn


The biggest problem with all the multiple databases is keeping them all in synch as you make schema changes. As far as realistic number of databases you can have and have the system work well, as usual it depends. It depends on how powerful the server is and how large the databases are. Likely you would want to have multiple servers at some point not just because it will be faster for your clients but because it will put fewer clients at risk at one time if something happens to the server. At what point that is, only your company can decide. Certainly if you start getting a lot of time-outs another server might be indicated (or fixing your poor queries might also do it). Big clients will often pay a premium to be on a separate server, so consider that in your pricing. We had one client so paranoid about their data we had to have a separate server that was not even co-located with the other servers. They paid big bucks for that as we had to rent extra space.

like image 35
HLGEM Avatar answered Oct 05 '22 23:10

HLGEM