Jump to content

Opinion: Multiple websites same data: Individual db's or single db?


Go to solution Solved by CroNiX,

Recommended Posts

Hello!

 

I have five websites on a single server, and each website uses the same geographic data, for instance US zip codes and city/state latitudes and longitudes. Each website uses it's own copy of these "large" tables.

 

I would like to avoid having to maintain the same data in 5 databases, but I am more concerned with database performance, e.g., the speed at which the data is retrieved for each website.

 

Question: Should I set up a new separate database that contains the shared tables for all websites and allow each website to connect to this new database for shared data? Or is it better for each website have it's own copy of the duplicate tables?

 

Thanks for any info!

 

Cheers

Shared. MySQL isn't going to look at your data and say "oh, this is the exact same as off in this other table" and then reuse results. That's your job, and by that I mean not having the same data in multiple tables.

  • Like 1
  • 3 weeks later...

Shared. MySQL isn't going to look at your data and say "oh, this is the exact same as off in this other table" and then reuse results. That's your job, and by that I mean not having the same data in multiple tables.

Thanks for that info.

 

I left out an important part of my question:

 

While each of the websites uses the same geographic data (zip codes, city/state geocodes, etc.) each website has it's own version of data specific to that website. For instance, one site maintains a list of grow stores and has a table 'locations' that contains all of those locations. Another site maintains a list of motorsports shops with it's own, structurally different version of the table 'locations'.

 

If each site has it's own db and also pulls from a shared db, two MySQL db connections would often be required instead of one.

 

Is the processing cost of 2 PDO/MySQL connections substantial enough to warrant keeping multiple copies of the same data in multiple databases? Or is the cost of 2 db connections so insignificant that it makes sense for 4 or 5 sites to use a shared database AND have their own unique database?

 

My concerns are 1. Additional processing required to use 2 database connections per site and 2. Possible delays due to multiple sites sharing the same database tables vs. each site using it's own copy.

 

Thanks for your input!

  • Solution

I have over 160 websites using the same codebase and same shared database. We get over 6M hits/month. No issues or "slowness". It comes down to query optimization and properly indexed fields.

  • Like 1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.