SuperComputing
IS-IT--Management
I have a local psql database and a remotely stored mysql database. They both have a 'Customer' table with a 'CustomerNumber' column.
I am currently comparing each customer in the local table with the customers in the remote table, and if the remote customer is missing, I list that customer from the local table. Like such:
'abbreviated code'
As you can see, this sends hundreds of queries to the remote. There has to be a way to do it with just one. When under load, or certain times during the day, the operation can time out, it takes forever as it is. If I do a simple, 'select all from remote and display' it's fast.
Is there a way that I can:
Select my customers from the local table
Select my customers from the remote table
Compare the results locally
Display the differences?
Thank you in advance.
I am currently comparing each customer in the local table with the customers in the remote table, and if the remote customer is missing, I list that customer from the local table. Like such:
'abbreviated code'
Code:
Customers = "SELECT CustomerNumber, [etc..] FROM Customer WHERE [...] ORDER BY [...]"
Set rsCustomers = LocalConn.Execute(Customers)
do until rsCustomers.EOF
compare = "SELECT CustomerNumber FROM Dealers WHERE CustomerNumber = '" & Replace(rsCustomers("CustomerNumber"), "'", "''") & "' "
Set rscompare = RemoteConn.Execute(compare)
IF rscompare.EOF = TRUE THEN
for each x in rsCustomers.Fields
Response.Write(x.name)
next
END IF
rsCustomers.MoveNext
loop
As you can see, this sends hundreds of queries to the remote. There has to be a way to do it with just one. When under load, or certain times during the day, the operation can time out, it takes forever as it is. If I do a simple, 'select all from remote and display' it's fast.
Is there a way that I can:
Select my customers from the local table
Select my customers from the remote table
Compare the results locally
Display the differences?
Thank you in advance.