如果您已配置非持久化优化器统计信息(非默认配置),
InnoDB会计算索引基数表第一次在启动后被访问时的值,而不是将这些值存储在表中。对于将数据分区到多个表的系统,这个步骤可能会花费大量时间。由于这种开销只适用于初次打开表的操作,要“预热”一个表以供后用,可以在启动后立即通过发出类似的语句来访问它SELECT 1 FROM.If you have configured non-persistent optimizer statistics (a non-default configuration),tbl_nameLIMIT 1InnoDBcomputes index cardinality values for a table the first time that table is accessed after startup, instead of storing such values in the table. This step can take significant time on systems that partition the data into many tables. Since this overhead only applies to the initial table open operation, to “warm up” a table for later use, access it immediately after startup by issuing a statement such asSELECT 1 FROM.tbl_nameLIMIT 1优化器统计信息默认会持久化到磁盘,这由
innodb_stats_persistent配置选项启用。有关持久化优化器统计信息的信息,请参见 第 17.8.10.1 节,“配置持久化优化器统计信息参数”。Optimizer statistics are persisted to disk by default, enabled by theinnodb_stats_persistentconfiguration option. For information about persistent optimizer statistics, see Section 17.8.10.1, “Configuring Persistent Optimizer Statistics Parameters”.