Speed: several DBs; 1 DB-several tables...?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Gath
Forum Newbie
Posts: 20
Joined: Wed May 15, 2002 8:36 pm

Speed: several DBs; 1 DB-several tables...?

Post by Gath »

I looked in the MySQL docs, but could find. If i was only blind, please excuse me, and if possible, point me to the right direction... :)


What would be faster?
Using only 1 db, with several tables, or using several db, with less tables in each?

Now i have like this:
db - users
db - forum
db - info
db - stuff

That could all be put in the same db. But i divided it cause the users db is only used on login, the forum only in the forum, and so on...

Any ideas?

Thank you :)
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

It depends upon table interaction. If the forum tables never talk to the user tables, it would be good theory to have them in separate DBs. If, however, they communicate, they should be in the same DB.

I am not aware of any speed issues between the two schemes, but compartmentilizing stuff is a good idea
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Not sure about the speed issues. Personally I would probably use a single database for these items - one of the reasons being that I'd normally be writing a php application to be compatible with the widest range of server setups, including some shared hosting accounts where the user only has a single database.

Another way to look at it is from the point of view of database permissions. The general rule is that you only give ordinary users the minimum permissions they require. Separate databases might make it easier to set up permissions - depending on your needs. You can also set permissions at the table level of course, within a single database. Not really giving you a definitive answer here - just something you can look at.
Post Reply