Reply
Looking for some opinions (mysql/php websites)
Old 04-01-2008, 10:47 PM Looking for some opinions (mysql/php websites)
Average Talker

Posts: 21
Name: Carl
I'm looking for an opinion.

I have 5 websites that all run on php/mysql.

They all have very similar database tables (most of them are exactly the same).

Which option would you choose and why?

1. Each site has it's own database

2. All sites use the same database and each table would have a sitename column which tells you to which site the row belongs.

Looking forward to your opinions.
carlg is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-01-2008, 11:03 PM Re: Looking for some opinions (mysql/php websites)
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
Wireless Audio
Posts: 2,320
Name: Keith Marshall
Location: West Hartford, CT
All though you could do either, it does not give you any more benifit to share the same database unless you want an easier way to share same data content. The downside to that is the possible chance to have a very large database that will be more difficult to backup, restore, maintain, etc.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 04-02-2008, 01:14 AM Re: Looking for some opinions (mysql/php websites)
mtishetsky's Avatar
King Spam Talker

Posts: 1,044
Name: Mike
Location: Mataro, Spain
Graphic, what do you mean with "very large"? mysqldump does not bother even if your db size is 10G.
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 04-02-2008, 03:23 AM Re: Looking for some opinions (mysql/php websites)
mork29's Avatar
Extreme Talker

Posts: 243
Name: Keith Yelnick
Quote:
Originally Posted by carlg View Post
2. All sites use the same database and each table would have a sitename column which tells you to which site the row belongs.
That would only be neccessary if tables were shared between sites. The more common practice for this would be to prefix your table names with the same thing for each site, example table names:

site1_users
site1_products
site1_stuff
site2_users
site2_products
site2_whatever
mork29 is offline
Reply With Quote
View Public Profile
 
Old 04-02-2008, 03:52 AM Re: Looking for some opinions (mysql/php websites)
vectorialpx's Avatar
Super Talker

Posts: 128
Name: irimia octavian
Location: Romania
Each site has it's own database - is more faster and more better for the mysql server...
__________________
my photos, my website, creation lab
vectorial pixel web services :: and, sorry for my English !
vectorialpx is offline
Reply With Quote
View Public Profile Visit vectorialpx's homepage!
 
Old 04-02-2008, 12:20 PM Re: Looking for some opinions (mysql/php websites)
rogem002's Avatar
Webmaster Talker

Posts: 607
Name: Mike
Location: United Kingdom
"Each site has it's own database" is the best option, imagination if a hacker was annoyed at your website and decided they wanted to attack the database. If they did get in, they only take out one website
__________________
Website Services
PHP Code:
if(Added_Talkupation($post) == TRUE){iHug($you);} 
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 04-03-2008, 12:33 AM Re: Looking for some opinions (mysql/php websites)
mtishetsky's Avatar
King Spam Talker

Posts: 1,044
Name: Mike
Location: Mataro, Spain
How many times your databases were hacked? How many people do you know who's databases were hacked? Talking about hacking databases you should always remember that it takes time and efforts to hack anything and it will only be done if the data inside is valueable enough to spend time and efforts on it. Hacking just for fun usually (in 99% cases) means that website developer or db administrator or somebody else was too stupid to setup database access privileges properly. And obviously it cannot be called "hack" when some account has 123 or qwerty as password or no password at all.
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 04-03-2008, 12:36 AM Re: Looking for some opinions (mysql/php websites)
mtishetsky's Avatar
King Spam Talker

Posts: 1,044
Name: Mike
Location: Mataro, Spain
Quote:
Originally Posted by vectorialpx View Post
Each site has it's own database - is more faster and more better for the mysql server...
Do you still run your webserver on P-III 500MHz with 64M RAM?
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 04-03-2008, 12:12 PM Re: Looking for some opinions (mysql/php websites)
vectorialpx's Avatar
Super Talker

Posts: 128
Name: irimia octavian
Location: Romania
at 3000 visitors per day and 12000 records you can have a PVIII
and, it depend of the project... at 30 users per day and 1000 records you can make 8 sites in one database... not just 2 but you must think, it you get something to work you need more than that and big sites have more than 2 databases for one project [security, usability and... it's faster]

and, the security problem remains
__________________
my photos, my website, creation lab
vectorial pixel web services :: and, sorry for my English !
vectorialpx is offline
Reply With Quote
View Public Profile Visit vectorialpx's homepage!
 
Old 04-05-2008, 01:02 AM Re: Looking for some opinions (mysql/php websites)
Ultra Talker

Posts: 307
I think it would be better to keep databases separate for each site unless you want to share content . First of all it is logical. Second, lets say due to a bug in code of one of your websites, you managed to corrupt records for one of your website, imagine the efforts you'd have to put to restore the correct for that particular site. What if in future you decide to change the way the data is stord for a particular site, again you'd have to put unneccssary extra effort. Also, what's the need to add an extra lookup (even if it is based on an index), when you can easily avoid it.
__________________
tiny url
dman_2007 is offline
Reply With Quote
View Public Profile Visit dman_2007's homepage!
 
Old 04-05-2008, 04:22 AM Re: Looking for some opinions (mysql/php websites)
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 984
Name: Jeremy Miller
Location: Reno, NV
I would choose "Each site has it's own database" for these reasons:

1) Less data for the MySQL engine to have to sift through to compose a page, thereby increasing maximum load speed.

2) If customizations are made to a specific site, one does not necessarily have to consider the effect on any other site.

3) Sites which do not store data that is used in other sites would have blank data in the table, thereby wasting space with virtually no gain.

4) Data which is used for statistical calculations could be stored in a table with the same structure so that data could be exported from the live server, recomposed on a data mining server, and then queried using MERGE table so that data mining does not impact the live server and during the data mining process, only necessary data is parsed.

5) If you have to move one site to another server (due to excessive bandwidth usage, for example), then such move does not need to consider the other sites and unnecessary data does not also have to be moved in order to maintain your functional structure.
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 04-07-2008, 12:17 PM Re: Looking for some opinions (mysql/php websites)
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,166
Name: Dan
Location: Swindon
I have to agree with the above, keep them seperate unless you want to share anything, so if you wanted to have the user system shared then it might be okay to do it else no point.
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 04-07-2008, 08:06 PM Re: Looking for some opinions (mysql/php websites)
Novice Talker

Posts: 7
I agree with the two above.
GallaUK is offline
Reply With Quote
View Public Profile Visit GallaUK's homepage!
 
Old 04-08-2008, 05:31 PM Re: Looking for some opinions (mysql/php websites)
Novice Talker

Posts: 11
Name: Tortoise
I'd go with different databases, unless the sites are more-or-less exactly the same.
Tortoise is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Looking for some opinions (mysql/php websites)
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.19808 seconds with 12 queries