I have a delete query which is potentially going to delete tens of thousands of rows.
Currently it's taking quite a long time in the more extreme case (over 100000 rows to delete) using this:
DELETE FROM tablename WHERE id IN (?, ?, ?...)
However, I was wondering whether it might be better to create a transaction and use php to loop through each of the deletes.
Something like...
START TRANSACTION;
DELETE FROM tablename WHERE id=?;
DELETE FROM tablename WHERE id=?;
DELETE FROM tablename WHERE id=?;
.....
COMMIT;
I hope this makes sense... I'm not the best at using the correct terminology.
Thanks