Analyze Table analyzes and stores the key distribution for the table. During the analysis, the table is locked with a read lock for MyISAM and BDB. For InnoDB the table is locked with a write lock. Currently, MySQL supports analyzing only for MyISAM, BDB, and InnoDB tables. For MyISAM tables, this statement is equivalent to using myisamchk --analyze.
Hint: Just simply right-click the table and select Maintain Tables -> Analyze Tables.MySQL uses the stored key distribution to decide in which order tables should be joined when one does a join on something else than a constant.
Analyze Table returns a result set with the following columns:
Column |
Value |
Table | The table name. |
Op | Always analyze. |
Msg_type | One of status, error, info, or warning. |
Msg_text | The message. |
You can check the stored key distribution with the SHOW INDEX statement. If the table has not changed since the last Analyze Table statement, the table is not analyzed again.
Related topics:
Check Tables
Optimize Tables
Repair Tables