Yesterday I ran CHECK TABLE
on a table that is read very frequently. I scanned the MySQL documentation for CHECK TABLE
for any mentions of "lock" (and found none) and also noticed that only SELECT
privilege was required to run the command. I therefor concluded that the command did not do any read lock and was safe to run even in production.
Sadly, running the command took 1 minute and 37 seconds and seemed to block all read access. My question is therefor, does CHECK TABLE
do any read lock? Any other reason why I experienced a read block on the table?
Thanks
The problem was most certainly that there was a big slow
SELECT
running through the table andUPDATE
ing individual rows. Therefor,CHECK TABLE
was locked on individual rows and took a long time.The verdict; Never run
CHECK TABLE
if you are updating a whole lot of rows.