开发者

If I kill a delete query in mysql, will the rows all be saved?

Suppose I'm halfway through running an import, and instead of running

SELECT COUNT(*) FROM table_being_imported

I hit ctrl+R, type table_being_im and hit return, only to find to my horror that I've just issued

DELETE FROM table_being_imported

Oops. So I hit ctrl+C and get told:

Ctrl-C -- sending "KILL QUERY 627" to serve开发者_StackOverflowr ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted

Would it have deleted any of the rows? Just hypothetically, of course...


hypothetically,... some of those rows are now gone.

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.

Not that this is the time to mention it, but this is why Transactional queries are best when dealing with business-critical data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜