NYCPHP Meetup

NYPHP.org

[nycphp-talk] [ot] Multiple DB selects (host <-> host)

Carlos A Hoyos cahoyos at us.ibm.com
Wed Mar 1 19:53:23 EST 2006


There's a lot to be said on this topic, so let me just put a few bullets as
food for thought.

- You can't use the "ip.database.table" notation. The "database.table"
notation is correct.

- You can connect to a mysql database in a different host, so long you have
the right permissions, and it's pretty much straightforward.

- Running queries that merge data from tables located in different hosts
can be done through "data federation".  It requires additional
configuration and it can be tricky... I know big players support it (i.e.
db2), I don't think mysql does yet (but I might be wrong, starting 5.0.3
there's --with-federated-storage-engine option).

- On the other hand having master / slave settings is a very common
practice, specially in mysql. Not only for data backups, but for database
scalability. This "horizontal scalability" model is used by many big
traffic sites (flickr comes to mind). Inserts/updates/deletes are done in
one master DB, and are replicated to a bunch of slaves to run the selects.
This works on all of the sites that are read intensive (which pretty much
are most of them).

- The article is a little long, but the whole part of setting up a
master-slave combo is pretty straight forward. The mysql manual has a whole
chapter on this.
http://dev.mysql.com/doc/refman/5.0/en/replication-howto.html

- As usual the main question is: What do you want to achieve with this?
Usually your requirements and architecture will guide you to a simple
solution.


regards,
Carlos






More information about the talk mailing list