Skip to content

Latest commit

 

History

History
27 lines (15 loc) · 2.36 KB

8.9-controlling-optimizer.md

File metadata and controls

27 lines (15 loc) · 2.36 KB

8.9 Controlling the Query Optimizer

8.9 查询计划调优(MySQL 8.0)

Table of Contents

目录

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.

The server maintains histogram statistics about column values in the column_statistics data dictionary table (see Section 8.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.

要调整和控制MySQL的优化器, 可以通过查询计划评估方式相关的系统变量、可切换优化、优化器提示和索引提示,以及优化器成本模型来进行。

服务器在 column_statistics 数据字典表中维护关于列值的直方图统计信息(参见 8.9.6 优化器统计信息(Optimizer Statistics) )。 与其他数据字典表一样,用户不能直接访问该表。 但我们可以通过查询 INFORMATION_SCHEMA.COLUMN_STATISTICS 来获取直方图统计信息, 这是作为数据字典表的视图来实现的。 我们还可以使用 ANALYZE TABLE 语句来进行直方图管理。

https://dev.mysql.com/doc/refman/8.0/en/controlling-optimizer.html