EXPLAIN
it. If the explain is unreasonable (for example, using different indexes then it used to or using an index but still scanning millions or rows) then you should try to CHECK TABLE
. One thing that I accidently found out was that
CHECK TABLE
also updates the key statistics. This made many problems magically disappear. A few things that should be noted:
CHECK TABLE
will only update key statistics for MyISAM tables , for InnoDB you must use - If you use
OPTIMIZE TABLE
to update the key statistics you should be aware thatOPTIMIZE TABLE
does other (good) things as well, so it usually takes much longer and it locks your table while doing it. Also, for InnoDB it actually re-builds the table usingALTER TABLE
. - The
CHECK TABLE
have several options. Only theMEDIUM
(the default) orEXTENDED
update the key statistics. (i think).
OPTIMIZE TABLE
.
No comments:
Post a Comment
[Due to much spam, comments are now moderated and will be posted after review]
Note: Only a member of this blog may post a comment.