i am doing this:
delete calibration_2009 from
calibration_2009 join batchinfo_2009
on calibration_2009.rowid = batchinfo_2009.rowid
where batchinfo_2009.reporttime like '%2010%';
both tables have about 500k lines of data i suspect that 250k match the criteria to be deleted
so far it has been running for 2 hours!!! is there something wrong?
dev.mysql.com says i should do this:
If you are deleting many rows from a large table, you may exceed the lock table size for an InnoDB table. To avoid this problem, or simply to minimize the time that the table remains locked, the following strategy (which does not use DELETE at all) might be helpful:
Select the rows not to be deleted into an empty table that has the same structure as the original table:
INSERT INTO t_copy SELECT * FROM t WHERE ... ;
Use RENAME TABLE to atomically move the original table out of the way and rename the copy to the original name:
RENAME TABLE t TO t_old, t_copy TO t;
Drop the original table:
DROP TABLE t_old;
how do i do this with my current statement?