On server S1 there is database A. I have read-only-access to it and can only perform SELECT statements.
On server S2 there is database B, with full access.
In database A there is a table, i.e. users with around 100.000 users and I want to save some additional information for each user in database B.
If I want to get all users in A.users which do not have additional information in B, what's the best way to do it?
This is not possible because we have different database servers:
SELECT id FROM A.users WHERE id NOT IN (SELECT id FROM B.info)
I can use PHP or any language to generate a CSV list of the statement
SELECT id FROM B.info
while ($data = mysql_fetch_object($result)) $ids[] = $data->id;
"SELECT id FROM A.users WHERE id NOT IN (" . implode(',', $ids) . ")"
This should work but I guess there will be problems if many rows exist in B.info. Perhaps there is some maximum query length? Perhaps some performance issues?
Is there any other method to solve this problem?