#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2007
    Posts
    83
    Rep Power
    27

    Simple Minisite Service DB Strategy


    If you have a service that allows people to create their own minisites, is it best to have each site's data in a separate database, or in a single database?

    I'm in the process of moving to a new server, and thought now would be a really good time to re-evaluate my database strategy.

    Right now I have 100 customers running on a single database and it's running great. I really like to be able to make changes to the database structure one time, rather than 100 times, when I need to do so.

    The number of rows for each table:
    230
    800
    5500
    218
    230
    522

    But, I realize the more minisites I get, the slower queries will be. I'm just wondering where that tipping point is. My goal is only 5 or 600 sites on this thing, so that would mean the biggest table would have around 30,000 rows and the smallest would have around 1,200.

    Does anyone have any advice? Should I split up the databases now before it grows any more, or is the scale of the service small enough to be able to run everything on one db?

    Thanks!
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    There are a lot of disadvantages and advantages to both designs, but since your code is already designed to support multi-tenancy and it's working well for you I recommend leaving it as is. If, in the future, you need to move to a multi-instance model you can do so relatively easily. It's a lot harder to take code that is designed to be multi-instance and change it to be multi-tenant.

    As long as your database is properly designed and properly indexed there should be no performance issues with only 30,000 rows. Database systems are capable of handling tables many times that size without performance issues.

    Remember that a binary search can search 4 billion records in only 32 steps, and could search 18 quintillion records in only 64 steps. Single database tables are thus extremely scalable if properly indexed.
    Last edited by E-Oreo; September 13th, 2011 at 10:17 PM.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2007
    Posts
    83
    Rep Power
    27
    Thanks! That's good news, puts things into perspective a bit. Really appreciate it.

IMN logo majestic logo threadwatch logo seochat tools logo