14.6.12Configuring Optimizer Statistics for InnoDB

14.6.12.1 Configuring Persistent Optimizer Statistics Parameters
14.6.12.2 Configuring Non-Persistent Optimizer Statistics Parameters
14.6.12.3 Estimating ANALYZE TABLE Complexity for InnoDB Tables
This section describes how to configure persistent and non-persistent optimizer statistics for InnoDB tables.
本節描述如何爲InnoDB表配置持久性和非持久性優化器統計信息。
Persistent optimizer statistics are persisted across server restarts, allowing for greater plan stability and more consistent query performance. Persistent optimizer statistics also provide control and flexibility with these additional benefits:
持久性優化器統計信息在服務器重新啓動時保持不變,從而實現更高的計劃穩定性和更一致的查詢性能。持久優化器統計數據還提供了這些額外的好處的控制和靈活性:

  • You can use the innodb_stats_auto_recalc configuration option to control whether statistics are updated automatically after substantial changes to a table.
  • 您可以使用innodb_stats_auto_recalc配置選項來控制是否在對錶進行實質性更改後自動更新統計信息。
  • You can use the STATS_PERSISTENT, STATS_AUTO_RECALC, and STATS_SAMPLE_PAGES clauses with CREATE TABLE andALTER TABLE statements to configure optimizer statistics for individual tables.
  • 您可以在CREATE TABLE和ALTER TABLE語句後面加上STATS_PERSISTENT,STATS_AUTO_RECALC和STATS_SAMPLE_PAGES子句以及來爲單個表配置優化器統計信息。
  • You can query optimizer statistics data in the mysql.innodb_table_stats and mysql.innodb_index_stats tables.
  • 您可以查詢 mysql.innodb_table_stats和mysql.innodb_index_stats表中的優化器統計數據。
  • You can view the last_update column of the mysql.innodb_table_stats and mysql.innodb_index_stats tables to see when statistics were last updated.
  • 您可以查看mysql.innodb_table_stats和mysql.innodb_index_stats 表的last_update列,以查看統計信息上次更新的時間。
  • You can manually modify the mysql.innodb_table_stats and mysql.innodb_index_stats tables to force a specific query optimization plan or to test alternative plans without modifying the database.
  • 您可以手動修改 mysql.innodb_table_stats和 mysql.innodb_index_stats表來強制執行特定的查詢優化計劃,或者在不修改數據庫的情況下測試替代計劃。

The persistent optimizer statistics feature is enabled by default (innodb_stats_persistent=ON).
持久優化器統計信息功能默認啓用(innodb_stats_persistent = ON)。
Non-persistent optimizer statistics are cleared on each server restart and after some other operations, and recomputed on the next table access. As a result, different estimates could be produced when recomputing statistics, leading to different choices in execution plans and variations in query performance.
在每次服務器重啓時以及在其他操作之後清除非永久性優化器統計信息,並在下一次表訪問時重新計算,因此,重新計算統計信息時可能會產生不同的估計值,從而導致執行計劃的不同選擇和查詢性能的變化。
This section also provides information about estimating ANALYZE TABLE complexity, which may be useful when attempting to achieve a balance between accurate statistics and ANALYZE TABLE execution time.
本節還提供了有關估計ANALYZE TABLE複雜性的信息,這在嘗試實現精確統計信息和ANALYZE TABLE執行時間之間的平衡時可能很有用

PREV: 14.6.11 Configuring InnoDB Purge Scheduling https://blog.51cto.com/itzhoujun/2358048
NEXT: 14.6.12.1 Configuring Persistent Optimizer Statistics Parameters https://blog.51cto.com/itzhoujun/2359334

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章