I have a table containing about 350,000 rows, and I recently switched from MyISAM storage engine to InnoDB.
I am running a query
UPDATE `users` SET `online` = 0
every time my server starts up and there are no problems using MyISAM. Typically, a query only affects a couple of hundred lines. The query execution time was slow, about 1.5 seconds on average, but I could live with something.
Now that I have changed to InnoDB, the request may take several tens of seconds.
Here is the mysql-slow.log part
This particular request will change the online value to 200 lines, the others to 0.
I was able to solve the problem by changing the request to
UPDATE `users` SET `online` = 0 WHERE `online` != 0
This request took about 0.1 seconds
Now, here is my question. Why does time increase significantly when moving from MyISAM to InnoDB?
And how is it that the request is so slow without the WHERE part? As far as I understand, the MySQL query optimizer is quite powerful, but it says the opposite. What could be causing this very slow query execution time?
The MySQL server version is 5.5.31-0.
Lassi source share