Name
ANALYZE TABLE
Synopsis
ANALYZE [LOCAL|NO_WRITE_TO_BINLOG] TABLEtable
[,...
]
Use this statement to analyze and
store the key distribution of a table. It works on BDB, InnoDB, and
MyISAM tables. Unless the NO_WRITE_TO_BINLOG
option is given, the statement is written to the binary log file. The
LOCAL
option is synonymous.
ANALYZE TABLE workreq; +----------------------+---------+----------+----------+ | Table | Op | Msg_type | Msg_text | +----------------------+---------+----------+----------+ | workrequests.workreq | analyze | status | OK | +----------------------+---------+----------+----------+
The message type results can be status,
error, info, or
warning. If the table hasn’t
changed since it was last analyzed, the message text will read
"Table is already up to
date" and the table
won’t be analyzed. This statement is equivalent to
using myisamchk -a
at the command line for MyISAM
tables.
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.