BTW: Have just tried "clean" (without any foreign keys constraints) peformance of
"delete from tbl where field not in (select)"
vs
"create temporary table tmp(id) as select distinct field from tbl; delete from tmp where id in (select); delete from tbl where field in (select id from tmp)".
both tbl and select are huge.
tbl cardinality is ~5 million, select is ~1 milliion. Number of records to delete is small.
select is simply "select id from table2".
First (simple) one could not do in a night, second did in few seconds.