views:

914

answers:

4

I know that in SQL Server, the maximum number of "objects" in a database is a little over 2 billion. Objects contains tables, views, stored procedures, indexes, among other things . I'm not at all worried about going beyond 2 billion objects. However, what I would like to know, is, does SQL Server suffer a performance hit from having a large number of tables. Does each table you add have a performance hit, or is there basically no difference (assuming constant amount of data). Does anybody have any experience working with databases with thousands of tables? I'm also wondering the same about MySQL.

+1  A: 

No difference, assuming constant amount of data.

Probably a gain in practical terms because of things like reduced maintenance windows (smaller index rebuilds), ability to have read-only file groups etc.

Performance is determined by queries and indexes (at the most basic level): not number of objects

gbn
+1  A: 

I doubt SQL Server will have a performance problem working with thousands of tables, but I sure would.

I've worked on databases with hundreds of tables in SQL Server with no problems, though.

Paul Lefebvre
Had to read your first sentence a couple times. I understand where you're coming from, but these would basically be a lot of tables all with the same structure, and not something that would be managed individually.
Kibbee
A: 

SQl Server can suffer a larger performance hit by using tables with many, many columns instead of breaking out a related table (even one with a one-to_one relationship). Plus a wide table likely can have problems when the data you want to input exceeds the number of bytes that you can store for a column. You can create a table that has the potential to store, for example, 10000 bytes but you will still only be able to store 8060 bytes.

HLGEM
This is useful information, but doesn't at all answer the question being asked.
Kibbee
BUt it does as the reason you ask if too many tables will create a performance problem is that you are considering consolidating them rather than create so many which in fact creates a much larger performance problme and the person should be aware of that.
HLGEM
A: 

In terms of the max number of tables I have had a database with 2 million tables. No performance hit at all. my tables where small around 15MB each.

Andy Ansryan