文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 73%

28.4.21 INFORMATION_SCHEMA INNODB_METRICS 表28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table

INNODB_METRICS 表提供了各种各样的 InnoDB 性能信息,补充了 Performance Schema 表对 InnoDB 的特定关注领域。通过简单的查询,您可以检查系统的整体健康状况。通过更详细的查询,您可以诊断诸如性能瓶颈、资源短缺和应用程序问题等问题。The INNODB_METRICS table provides a wide variety of InnoDB performance information, complementing the specific focus areas of the Performance Schema tables for InnoDB. With simple queries, you can check the overall health of the system. With more detailed queries, you can diagnose issues such as performance bottlenecks, resource shortages, and application issues.

每个监控器代表 InnoDB 源代码中的一个点,该点被仪器化以收集计数器信息。每个计数器可以启动、停止和重置。您还可以使用它们的公共模块名称对一组计数器执行这些操作。Each monitor represents a point within the InnoDB source code that is instrumented to gather counter information. Each counter can be started, stopped, and reset. You can also perform these actions for a group of counters using their common module name.

默认情况下,收集的数据相对较少。要启动、停止和重置计数器,请设置以下系统变量之一 innodb_monitor_enable、innodb_monitor_disable、innodb_monitor_reset 或 innodb_monitor_reset_all,使用计数器名称、模块名称、使用 “%” 字符的通配符匹配名称,或使用特殊关键字 all。By default, relatively little data is collected. To start, stop, and reset counters, set one of the system variables innodb_monitor_enable, innodb_monitor_disable, innodb_monitor_reset, or innodb_monitor_reset_all, using the name of the counter, the name of the module, a wildcard match for such a name using the “%” character, or the special keyword all.

有关使用信息,请参阅 第 17.15.6 节,“InnoDB INFORMATION_SCHEMA 指标表”。For usage information, see Section 17.15.6, “InnoDB INFORMATION_SCHEMA Metrics Table”.

INNODB_METRICS 表具有以下列:The INNODB_METRICS table has these columns:

  • NAMENAME

    计数器的唯一名称。A unique name for the counter.

  • SUBSYSTEM

    指标所适用的 InnoDB 方面。The aspect of InnoDB that the metric applies to.

  • COUNTCOUNT

    自计数器启用以来的值。The value since the counter was enabled.

  • MAX_COUNT

    自计数器启用以来的最大值。The maximum value since the counter was enabled.

  • MIN_COUNT

    自计数器启用以来的最小值。The minimum value since the counter was enabled.

  • AVG_COUNT

    自计数器启用以来的平均值。The average value since the counter was enabled.

  • COUNT_RESET

    自上次重置以来的计数器值。(带有 _RESET 的列就像秒表上的圈数计数器:您可以测量某个时间间隔内的活动,同时累积数据仍然可以在 COUNT、MAX_COUNT 等列中查看。)The counter value since it was last reset. (The _RESET columns act like the lap counter on a stopwatch: you can measure the activity during some time interval, while the cumulative figures are still available in COUNT, MAX_COUNT, and so on.)

  • MAX_COUNT_RESET

    自上次重置以来的计数器最大值。The maximum counter value since it was last reset.

  • MIN_COUNT_RESET

    自上次重置以来的计数器最小值。The minimum counter value since it was last reset.

  • AVG_COUNT_RESET

    自上次重置以来的计数器平均值。The average counter value since it was last reset.

  • TIME_ENABLED

    上次启动的时间戳。The timestamp of the last start.

  • TIME_DISABLED

    上一次停止的时间戳。The timestamp of the last stop.

  • TIME_ELAPSED

    计数器启动以来经过的秒数。The elapsed time in seconds since the counter started.

  • TIME_RESET

    上一次重置的时间戳。The timestamp of the last reset.

  • STATUSSTATUS

    计数器是否仍在运行(enabled)或已停止(disabled)。Whether the counter is still running (enabled) or stopped (disabled).

  • TYPETYPE

    项目是累积计数器,还是测量某个资源的当前值。Whether the item is a cumulative counter, or measures the current value of some resource.

  • COMMENTCOMMENT

    计数器描述。The counter description.

示例Example

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME='dml_inserts'\G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 3
      MAX_COUNT: 3
      MIN_COUNT: NULL
      AVG_COUNT: 0.046153846153846156
    COUNT_RESET: 3
MAX_COUNT_RESET: 3
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: 2014-12-04 14:18:28
  TIME_DISABLED: NULL
   TIME_ELAPSED: 65
     TIME_RESET: NULL
         STATUS: enabled
           TYPE: status_counter
        COMMENT: Number of rows inserted

备注Notes

  • 你必须拥有 PROCESS 权限才能查询此表。You must have the PROCESS privilege to query this table.

  • 使用 INFORMATION_SCHEMA COLUMNS 表或 SHOW COLUMNS 语句查看关于此表列的更多信息,包括数据类型和默认值。Use the INFORMATION_SCHEMA COLUMNS table or the SHOW COLUMNS statement to view additional information about the columns of this table, including data types and default values.

  • 事务计数器 COUNT 的值可能与性能模式 EVENTS_TRANSACTIONS_SUMMARY 表中报告的事务事件数量不同。InnoDB 仅计算其执行的事务,而性能模式收集服务器发起的所有未中止事务的事件,包括空事务。Transaction counter COUNT values may differ from the number of transaction events reported in Performance Schema EVENTS_TRANSACTIONS_SUMMARY tables. InnoDB counts only those transactions that it executes, whereas Performance Schema collects events for all non-aborted transactions initiated by the server, including empty transactions.