Per this post, in order to optimize the storage of a MyISAM table, you need to:
OPTIMIZE TABLE ;
ALTER TABLE ENGINE=MyISAM ;
ANALYZE TABLE ;
It's obvious what OPTIMIZE does for disk space but what does ALTER and ANALYZE do when used after OPTIMIZE? I am asking specifically about disk storage, so for example, I don't care that ANALYZE improves join performance, etc.
Best Answer
That was my old ServerFault post from two years ago. Forgive me, it is slightly misworded. It should read:
OK, I just fixed it in ServerFault.
CLARIFICATION
OPTIMIZE TABLE tblname;
performs the following:According to the MySQL Documentation on
OPTIMIZE TABLE
The last part on the table's statistics is what
ANALYZE TABLE
does.If you do not want
OPTIMIZE TABLE tblname;
to performANALYZE TABLE tblname;
, then you must executeALTER TABLE tblname ENGINE=MyISAM;
instead.WARNING : This may not be a good idea for a MyISAM that has heavy INSERTs, UPDATEs, and DELETEs because
Please just stick with
OPTIMIZE TABLE
.