4

I've executed an INSERT INTO ... SELECT as a job on my MySQL instance and then I realized that number of records that is selected by the WHERE condition is more than my patience. It's already taken 12 hours and there's no sign of the job being done.

My previous experience tells me that there's a big chance to corrupt the data if I just kill / stop the MySQL instance. And I know no other way to do so! Does anyone know a safe way to gracefully ask MySQL to stop whatever it is doing?

And I'm using InnoDb and MySQL 5.6 on Ubuntu.

Mehran
  • 145
  • 1
  • 6

1 Answers1

2

Do you mean by "kill / stop the MySQL instance" the linux command kill -9 ...?
Yes, this might lead to corrupt data.

Which instead should not leave corrupt data is the build-in kill command of MySQL. See the lower part of the page, which states that it might take the thread some time to actually notice the presence of the kill flag. The part which states it does not roll back updates when transactions are not used (which implies that it rolls back updates if transactions are used), etc. I therefore assume this does not corrupt any data (besides killing repair and optimize as noted there).

You can find out the thread id you need for this command with the command show processlist.

Ulrich Thomas Gabor
  • 2,694
  • 1
  • 18
  • 20