Querying tables on multiple hosts in a single query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All

The situation is thus:

We are building an application (using a PHP frontend - 4.3.3 ) that processes large amounts of customer data (in some cases GB). During the processing we run queries where we compare the customer data to a number of rules tables (in a number of rules databases), e.g :

INSERT INTO customer_db.customer_table_2
SELECT a.field_one, b.field_two
FROM customer_db.customer_table_1 a, rules_db.rules_table_1 b
WHERE a.field_id = b.field_id

Originally, we kept all the DBs on a single database. However, of late, I decided to split the customer data as some customers have GB of data and take a lot longer than others. Therefore, I decided to split the customer databases to multiple boxes each running an installation of MySQL (4.0.15) with the rules databases on a seperate machine (also running MySQL 4.0.15). The idea being that I would only need to maintain a single copy of each of the rules db which would make updating  and maintenance easier. Unfortunately, this means that the above query then must look like this:

INSERT INTO customer_host.customer_db.customer_table_2
SELECT a.field_one, b.field_two
FROM customer_host.customer_db.customer_table_1 a, rules_host.rules_db.rules_table_1 b
WHERE a.field_id = b.field_id

Added to this I would have a seperate connection for each of the customer db and the rules db.

Currently, I have no idea how to achieve the above query given the new situation - mysql_query only accepts a single connection link. 

Does anyone know if there is anyway that I can perform the above query?

If I cannot - I have some alternatives but I hope someone will have a solution.

TIA

Rory McKinley
Nebula Solutions
+27 82 857 2391
rorym@nebula.co.za
"There are 10 kinds of people in this world, 
those who understand binary and those who don't" (Unknown)

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux