首先是analyze table。
ANALYZE TABLE analyzes and stores the key distribution for a table. During the analysis, the table is locked with a read lock for InnoDB
and MyISAM
. This statement works with InnoDB
, NDB
, and MyISAM
tables.
【本语句用于分析和存储表的关键字分布。在分析期间,使用一个读取锁定对表进行锁定。这对于MyISAM, BDB和InnoDB表有作用。对于MyISAM表,本语句与使用myisamchk -a相当。】
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.
【MySQL使用已存储的关键字分布来决定当您对除常数以外的对象执行join时,表按什么顺序进行联合。】