ANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE
ANALYZE TABLE analyzes and stores
the key distribution for a table. During the analysis, the table
is locked with a read lock for
statement works with
NDB tables. For
tables, this statement is equivalent to using myisamchk
For more information on how the analysis works within
Section 14.2.14, “Limits on InnoDB Tables”.
MySQL uses the stored key distribution to decide the order in which tables should be joined when you perform a join on something other than a constant. In addition, key distributions can be used when deciding which indexes to use for a specific table within a query.
ANALYZE TABLE returns a result
set with the following columns.
|The table name|
|An informational message|
If the table has not changed since the last
ANALYZE TABLE statement, the
table is not analyzed again.
By default, the server writes
TABLE statements to the binary log so that they
replicate to replication slaves. To suppress logging, specify
NO_WRITE_TO_BINLOG keyword or