MySQL 通过系统变量提供优化器控制,这些变量影响查询计划的评估,还可以切换优化、使用优化器和索引提示,以及优化器成本模型。MySQL provides optimizer control through system variables that affect how query plans are evaluated, switchable optimizations, optimizer and index hints, and the optimizer cost model.
服务器在 column_statistics 数据字典表中维护有关列值的直方图统计信息(参见 第 10.9.6 节,“优化器统计信息”)。与其他数据字典表类似,用户无法直接访问此表。相反,您可以通过查询 INFORMATION_SCHEMA.COLUMN_STATISTICS 获取直方图信息,该表是数据字典表的视图实现。您还可以使用 ANALYZE TABLE 语句进行直方图管理。The server maintains histogram statistics about column values in
the column_statistics data dictionary table
(see Section 10.9.6, “Optimizer Statistics”). Like other data
dictionary tables, this table is not directly accessible by users.
Instead, you can obtain histogram information by querying
INFORMATION_SCHEMA.COLUMN_STATISTICS,
which is implemented as a view on the data dictionary table. You
can also perform histogram management using the
ANALYZE TABLE statement.