I'm going to gather data which I will need in multiple websites hosted on the same server. The data is very general; f.e. country codes and their names in different languages. The data will only be updated by use of a script which requests the data from other servers (which might be down or slow sometimes which is why I need to keep it locally).
I'm now doubting which structure to use in order to have as little difficulties as possible maintaining the data. Some options I'm considering are:
- Adding a seperate database and connecting to it when needed.
Advantages: Data is always up-to-date and doesn't need to be synchronized
Disadvantages: Multiple database connections needed for a single website
- Adding a seperate database and exporting it regularly
Advantages: Single connection per website
Disadvantages: Requires manual work
- Some kind of API which returns the needed data in XML format
Advantages: Single connection per website, Data is always up-to-date and doesn't need to be synchronized
Disadvantages: Requires a lot of effort to build
- Having tables in all databases and have these updated by a seperate script
Advantages: Only the script requires multiple DB connections
Disadvantages: Table structure modifications will have to be made twice
What would you do?
Should I use multiple databases?
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Under typical circumstances, there's little reason to ever use more than one. As developers we are likely to use several, however. Mostly due to having code and data in various development stages that need proof-of-concept testing before plowing further.JellyFish wrote:I've been always using one database. I don't know when I should use another. When would be a good time to use more then one database?
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
califdon summed up my thinking. Also bear in mind the necessity of maintenance if changes are made to basic database design. Do changes need to be replicated across the multiple databases. If so can you automate this so you don't miss any. It can be really annoying when databases become out of sync because you missed an update on one.