1

can i create as many as 500000000 databases in Mysql??

If yes, is it efficient??

here, each database holds user data with 6 tables in it containing user info in it..

please explain me the pros and cons of this idea with respect to performance and implementation..

5
  • 3
    Why create a unique database for each user, rathe rthan a single table for all users? Commented Feb 1, 2011 at 15:37
  • 1
    Well, for one, that's an excellent way to fill up your disk drives and kill any indexing algorithm your DBMS might have... Commented Feb 1, 2011 at 15:40
  • 2
    datacharmer.blogspot.com/2009/03/normalization-and-smoking.html Commented Feb 1, 2011 at 15:44
  • + 100 to Mchl's link.. u gave an excellent analogy for it.. Commented Feb 1, 2011 at 17:25
  • Not me: that's Giuseppe Maxia's blog Commented Feb 2, 2011 at 7:46

3 Answers 3

6

Please Don't!

Whatever you're thinking, whatever the reason. There is absolutely no way that creating that many databases is a good idea.

If you're looking for storing data per user, or for every X. Then please take a look again at what a relational database is "A relational database matches data by using common characteristics found within the data set."

Let's say you're createing an image service and want each user to have their own images. One way is to give each user their own database. This is wrong, because the data for each user contains the same characteristics, the only thing that is different is the relation (user A has picture A, user B has picture B), (1 user has 0...* pictures, and 1 picture belongs to 1 user). So instead of creating that many databases, you create a user table, and relate that to a picture table, this way you've efficiently used a database.

To answer your more direct question. Create a table with 50.000 entries is surely more efficient then creating 50.000 databases.

Edit a related answer on mysql.com: http://forums.mysql.com/read.php?20,74692,74705#msg-74705

Sign up to request clarification or add additional context in comments.

Comments

0

Creating a complete database for each unique user is less than ideal. You're now forcing SQL to store each database and independently reference each table. Not to mention, the database has to now work harder at retrieving and storing this information as it's going between databases.

For normalization purposes, you're better off making a "user" column in each table that you can call upon for your CRUD operations. This keeps everything all in one place, and keeps the strain off of the database.

Comments

0

i suspect he is wondering this for performance reasons - not because he knows no better.

lookups in a unique db for each user will not get slower as the db grows - because, simply, it wont.

However, if you are willing to go to these lengths to improve performance, my personal opinion would be consider a different DBMS first. My personal experience with mySQL is that its a very good DBMS if speed is not a concern - I've personally found MSSQL much much faster.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.