1000 databases or 1 database with 10000 tables?

Discussion in 'Programming' started by goscript, Jan 9, 2008.

  1. #1
    Hi,
    I am in the need of getting 1000 sites up.
    Usually every site has a db with 10 tables.

    Now, what would be better, to set 1000 databases, or to set one database and use table prefix for each site? This would lead to a db with 10000 tables.

    Would there be any performance slow down if I set them all into one db and use table prefix for each site?

    Let me know your thoughts on this.

    Thanks
     
    goscript, Jan 9, 2008 IP
  2. daringtakers

    daringtakers Well-Known Member

    Messages:
    808
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #2
    You can go with either, most of the databases will not hav any probs with this.
     
    daringtakers, Jan 9, 2008 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    Same thing.

    Peace,
     
    Barti1987, Jan 9, 2008 IP
  4. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #4
    There are other factors to consider... for example with shared hosting most hosts limit the maximum number of concurrent connections per db so by splitting them you will get X per site rather than sharing X across all of them. Likewise for data integrity, if someone hacked one db they could only damage that one site rather than all of the sites plus depending on which SQL server it is it may have one file per db so again by splitting you dont risk corruption taking out all the sites.

    Personally I would split them unless you are likely to want some shared data between the sites.
     
    AstarothSolutions, Jan 9, 2008 IP
  5. goscript

    goscript Prominent Member

    Messages:
    2,753
    Likes Received:
    306
    Best Answers:
    0
    Trophy Points:
    315
    #5
    It's a dedicated box, no way to host 1000 sites on a shared.

    From what I know, the db on Mysql Server has each table on a file, so there would be no problem with getting it corrupted.

    I am thinking to use a single db as I have to connect to all sites regularly, so instead of starting and ending connections 1000 times, I will only do it once, and here I think would be the big performance improvement.
     
    goscript, Jan 9, 2008 IP
  6. hostingcoupon

    hostingcoupon Peon

    Messages:
    447
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The same thing, but personally I'd prefer 100 db, and 100 tables with each db.
     
    hostingcoupon, Jan 9, 2008 IP
  7. chrissyj

    chrissyj Peon

    Messages:
    56
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If you are using MySQL and running on a Linux box, then there will be no speed difference, because MySQL creates a directory for each db and 2 files for each table. Because of Linux's excellent directory caching, it should make no difference speed-wise. The controlling factor would then be the DB connections.
     
    chrissyj, Jan 10, 2008 IP
    goscript likes this.