View Full Version : Compare two very large tables

02-11-2013, 12:52 PM
So im looking to compare two very large tables.

TableA + TableB

TableA is the table used by the site, and TableB is imported data.

I want to compare the two, and if a row is found in TableA, that matches a row in TableB, I want to delete it (from TableA)

Anyone got any ideas?

Thanks Calum

02-11-2013, 01:56 PM
delete A.* from A join B on A.key = B.key

something like that.

Old Pedant
02-11-2013, 07:22 PM
But it's important that the two keys shown in that query are each an index on their respective tables. Else the query will run really slowly.