ANALYZE TABLE
Sintassi
ANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE nome_tabella [, nome_tabella] ...
Spiegazione
ANALYZE TABLE
analizza e scrive la distribuzione degli indici di una tabella. Durante l'analisi, se la tabella è MyISAM viene posto un lock. Se è InnoDB viene posto un lock in scrittura. Questa istruzione funziona con MyISAM, Aria e InnoDB. Per le tabelle MyISAM, questo comando equivale a myisamchk --analyze
.
Per ulteriori informazioni su come funziona l'analisi in InnoDB, si veda InnoDB Restrictions
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.
This statement requires SELECT and INSERT privileges for the table.
ANALYZE TABLE
is also supported for partitioned tables. You
can use ALTER TABLE ... ANALYZE PARTITION
to analyze one or
more partitions.