Search code examples
mysqlsql-deletekill

Killing safely a delete large no. of records in mysql


I'm erasing 7M records on a db containing 22M records. I started deleting using a classical DELETE FROM db WHERE.

I forgot to paginate :/

If I kill it, do I corrupt data? By saying corrupt I don't mean that I don't recover the deleted rows. I don't care about them. I just want the query to complete the deletion it is doing and stop there.

table Engine is MyISAM.


Solution

  • See KILL

    During UPDATE or DELETE operations, the kill flag is checked after each block read and after each updated or deleted row. If the kill flag is set, the statement is aborted. Note that if you are not using transactions, the changes are not rolled back.

    It won't corrupt data. Your changes will be gone until kill(deletion stopped). And you are not bothering it at all. If you bother it then use transactions.