I have one table on on remote database server that uses a primary as “video_id”. It gets updated once a day with stats from another table on another remote database that has a column as “video_id” that should match up (but not primary).
Because of Database failures and such, the stats (second) server is missing about 500 rows of 110K rows that it should have.
I’d like to run a query to add every “video_id” that exists in the first table but does not exist in the other.
Remember each table is in a separate remote database.
I went with the INSERT IGNORE approach, but came up with a way to at least indicate the row was missing from the stats table.
If the primary table that gets updated from the stats table has rows with the stats column still at ‘0’, high likelihood that the row is missing in the stats table. So I did a loop on all rows with a stat number less than ‘10’, and that returned about 600 rows, and did the INSERT IGNORE only then with those video_ids.