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

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 29 MySQL Performance Schema / 29.6 Performance Schema Instrument Naming Conventions
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 81%

29.6 性能模式工具命名约定29.6 Performance Schema Instrument Naming Conventions

工具名称由由 '/'' 字符分隔的一系列元素组成。示例名称:An instrument name consists of a sequence of elements separated by '/' characters. Example names:

wait/io/file/myisam/log
wait/io/file/mysys/charset
wait/lock/table/sql/handler
wait/synch/cond/mysys/COND_alarm
wait/synch/cond/sql/BINLOG::update_cond
wait/synch/mutex/mysys/BITMAP_mutex
wait/synch/mutex/sql/LOCK_delete
wait/synch/rwlock/sql/Query_cache_query::lock
stage/sql/closing tables
stage/sql/Sorting result
statement/com/Execute
statement/com/Query
statement/sql/create_table
statement/sql/lock_tables
errors

仪器名称空间具有树状结构。仪器名称的各个元素从左到右提供了从一般到具体的渐进。名称中元素的数量取决于仪器的类型。The instrument name space has a tree-like structure. The elements of an instrument name from left to right provide a progression from more general to more specific. The number of elements a name has depends on the type of instrument.

The interpretation of a given element in a name depends on the elements to the left of it. For example, myisam appears in both of the following names, but myisam in the first name is related to file I/O, whereas in the second it is related to a synchronization instrument:

wait/io/file/myisam/log
wait/synch/cond/myisam/MI_SORT_INFO::cond

仪器名称由前缀和后缀组成,前缀的结构由 Performance Schema 实现定义,后缀由实现仪器代码的开发者定义。仪器前缀的顶层元素表示仪器的类型。该元素还决定了 performance_timers 表中的哪一个事件计时器适用于该仪器。对于仪器名称的前缀部分,顶层表示仪器类型。Instrument names consist of a prefix with a structure defined by the Performance Schema implementation and a suffix defined by the developer implementing the instrument code. The top-level element of an instrument prefix indicates the type of instrument. This element also determines which event timer in the performance_timers table applies to the instrument. For the prefix part of instrument names, the top level indicates the type of instrument.

仪器名称的后缀部分来自仪器本身的代码。后缀可能包括以下级别:The suffix part of instrument names comes from the code for the instruments themselves. Suffixes may include levels such as these:

  • 主要元素的名称(一个服务器模块,如 myisam、innodb、mysys 或 sql)或插件名称。A name for the major element (a server module such as myisam, innodb, mysys, or sql) or a plugin name.

  • 代码中变量的名称,形式为 XXX(全局变量)或 CCC::MMM(类 CCC 的成员 MMM)。示例:COND_thread_cache、THR_LOCK_myisam、BINLOG::LOCK_index。The name of a variable in the code, in the form XXX (a global variable) or CCC::MMM (a member MMM in class CCC). Examples: COND_thread_cache, THR_LOCK_myisam, BINLOG::LOCK_index.

顶级仪器元素Top-Level Instrument Elements

  • idle:一个被监控的空闲事件。该仪器没有进一步的元素。idle: An instrumented idle event. This instrument has no further elements.

  • error:一个被监控的错误事件。该仪器没有进一步的元素。error: An instrumented error event. This instrument has no further elements.

  • memory:一个被监控的内存事件。memory: An instrumented memory event.

  • stage:一个被监控的阶段事件。stage: An instrumented stage event.

  • statement:一个被监控的语句事件。statement: An instrumented statement event.

  • transaction:一个带有监测的事务事件。该监测没有其他元素。transaction: An instrumented transaction event. This instrument has no further elements.

  • wait:一个带有监测的等待事件。wait: An instrumented wait event.

空闲监测元素Idle Instrument Elements

idle 监测用于空闲事件,性能模式生成这些事件,如在 第 29.12.3.5 节,“socket_instances 表” 中 socket_instances.STATE 列的描述中所讨论。The idle instrument is used for idle events, which The Performance Schema generates as discussed in the description of the socket_instances.STATE column in Section 29.12.3.5, “The socket_instances Table”.

错误监测元素Error Instrument Elements

该error instrument indicates whether to collect information for server errors and warnings. This instrument is enabled by default. The TIMED column for the error row in the setup_instruments table is inapplicable because timing information is not collected.The error instrument indicates whether to collect information for server errors and warnings. This instrument is enabled by default. The TIMED column for the error row in the setup_instruments table is inapplicable because timing information is not collected.

内存工具元素Memory Instrument Elements

内存监控默认已启用。内存监控可以在启动时启用或禁用,也可以在运行时通过更新setup_instruments表中相关监控项的ENABLED列来动态启用或禁用。内存监控器的名称形式为memory/code_area/instrument_name,其中code_area是类似sql或myisam的值,而instrument_name是监控器的详细信息。Memory instrumentation is enabled by default. Memory instrumentation can be enabled or disabled at startup, or dynamically at runtime by updating the ENABLED column of the relevant instruments in the setup_instruments table. Memory instruments have names of the form memory/code_area/instrument_name where code_area is a value such as sql or myisam, and instrument_name is the instrument detail.

以 memory/performance_schema/ 为前缀命名的仪器显示了性能模式中为内部缓冲区分配了多少内存。memory/performance_schema/ 仪器是内置的,总是启用的,且在启动或运行时无法禁用。内置内存仪器仅显示在 memory_summary_global_by_event_name 表中。更多信息,请参见 第 29.17 节,“性能模式内存分配模型”。Instruments named with the prefix memory/performance_schema/ expose how much memory is allocated for internal buffers in the Performance Schema. The memory/performance_schema/ instruments are built in, always enabled, and cannot be disabled at startup or runtime. Built-in memory instruments are displayed only in the memory_summary_global_by_event_name table. For more information, see Section 29.17, “The Performance Schema Memory-Allocation Model”.

阶段仪器元素Stage Instrument Elements

舞台工具的名称形式为 stage/code_area/stage_name,其中 code_area 的值例如 sql 或 myisam,而 stage_name 表示语句处理的阶段,例如 Sorting result 或 Sending data。这些阶段对应于 SHOW PROCESSLIST 显示的线程状态,或者在 Information Schema PROCESSLIST 表中可见的线程状态。Stage instruments have names of the form stage/code_area/stage_name, where code_area is a value such as sql or myisam, and stage_name indicates the stage of statement processing, such as Sorting result or Sending data. Stages correspond to the thread states displayed by SHOW PROCESSLIST or that are visible in the Information Schema PROCESSLIST table.

语句工具元素Statement Instrument Elements

  • statement/abstract/*:一种用于语句操作的抽象工具。在语句分类的早期阶段使用抽象工具,当确切的语句类型未知时使用,随后在类型已知时会更改为更具体的语句工具。有关此过程的描述,请参见 第 29.12.6 节,“性能模式语句事件表”。statement/abstract/*: An abstract instrument for statement operations. Abstract instruments are used during the early stages of statement classification before the exact statement type is known, then changed to a more specific statement instrument when the type is known. For a description of this process, see Section 29.12.6, “Performance Schema Statement Event Tables”.

  • statement/com:一个已加工具的命令操作。这些操作的名称对应于 COM_xxx 操作(参见 mysql_com.h 头文件和 sql/sql_parse.cc)。例如,statement/com/Connect 和 statement/com/Init DB 加工具对应于 COM_CONNECT 和 COM_INIT_DB 命令。statement/com: An instrumented command operation. These have names corresponding to COM_xxx operations (see the mysql_com.h header file and sql/sql_parse.cc. For example, the statement/com/Connect and statement/com/Init DB instruments correspond to the COM_CONNECT and COM_INIT_DB commands.

  • statement/scheduler/event:一个用于追踪事件调度器执行的所有事件的单一加工具。这个加工具在调度事件开始执行时发挥作用。statement/scheduler/event: A single instrument to track all events executed by the Event Scheduler. This instrument comes into play when a scheduled event begins executing.

  • statement/sp:由存储程序执行的带有监视功能的内部指令。例如,statement/sp/cfetch 和 statement/sp/freturn 工具用于游标获取和函数返回指令。statement/sp: An instrumented internal instruction executed by a stored program. For example, the statement/sp/cfetch and statement/sp/freturn instruments are used cursor fetch and function return instructions.

  • statement/sql:带有监视功能的 SQL 语句操作。例如,statement/sql/create_db 和 statement/sql/select 工具用于 CREATE DATABASE 和 SELECT 语句。statement/sql: An instrumented SQL statement operation. For example, the statement/sql/create_db and statement/sql/select instruments are used for CREATE DATABASE and SELECT statements.

线程监视工具元素Thread Instrument Elements

在 setup_threads 表中显示已插装的线程,该表展示了线程类名称和属性。Instrumented threads are displayed in the setup_threads table, which exposes thread class names and attributes.

线程插装以 thread 开头(例如,thread/sql/parser_service 或 thread/performance_schema/setup)。Thread instruments begin with thread (for example, thread/sql/parser_service or thread/performance_schema/setup).

ndbcluster 插件线程的线程插装名称以 thread/ndbcluster/ 开头;有关这些的更多信息,请参见 ndbcluster 插件线程。The names of thread instruments for ndbcluster plugin threads begin with thread/ndbcluster/; for more information about these, see ndbcluster Plugin Threads.

等待插装元素Wait Instrument Elements

  • wait/io

    一个已插装的 I/O 操作。An instrumented I/O operation.

    • wait/io/file

      一个已插装的文件 I/O 操作。对于文件来说,等待时间是指等待文件操作完成的时间(例如,调用 fwrite())。由于缓存的原因,磁盘上的实际文件 I/O 可能不会在此调用中发生。An instrumented file I/O operation. For files, the wait is the time waiting for the file operation to complete (for example, a call to fwrite()). Due to caching, the physical file I/O on the disk might not happen within this call.

    • wait/io/socket

      一个已插装的套接字操作。套接字插装器的名称格式为 wait/io/socket/sql/socket_type。服务器为其支持的每种网络协议都有一个监听套接字。与 TCP/IP 或 Unix 套接字文件连接的监听套接字相关联的插装器,其 socket_type 值分别为 server_tcpip_socket 或 server_unix_socket。当监听套接字检测到连接时,服务器将该连接转移到由单独线程管理的新套接字。新连接线程的插装器的 socket_type 值为 client_connection。An instrumented socket operation. Socket instruments have names of the form wait/io/socket/sql/socket_type. The server has a listening socket for each network protocol that it supports. The instruments associated with listening sockets for TCP/IP or Unix socket file connections have a socket_type value of server_tcpip_socket or server_unix_socket, respectively. When a listening socket detects a connection, the server transfers the connection to a new socket managed by a separate thread. The instrument for the new connection thread has a socket_type value of client_connection.

    • wait/io/table

      一个带有监测的表 I/O 操作。这些操作包括对持久性基础表或临时表的行级访问。影响行的操作有提取、插入、更新和删除。对于视图,等待与视图引用的基础表相关联。An instrumented table I/O operation. These include row-level accesses to persistent base tables or temporary tables. Operations that affect rows are fetch, insert, update, and delete. For a view, waits are associated with base tables referenced by the view.

      与大多数等待不同,表 I/O 等待可以包含其他等待。例如,表 I/O 可能包括文件 I/O 或内存操作。因此,events_waits_current 中的表 I/O 等待通常有两行。有关更多信息,请参见 第 29.8 节,“性能模式原子和分子事件”。Unlike most waits, a table I/O wait can include other waits. For example, table I/O might include file I/O or memory operations. Thus, events_waits_current for a table I/O wait usually has two rows. For more information, see Section 29.8, “Performance Schema Atom and Molecule Events”.

      某些行操作可能会导致多次表 I/O 等待。例如,插入操作可能会触发导致更新的触发器。Some row operations might cause multiple table I/O waits. For example, an insert might activate a trigger that causes an update.

  • wait/lock

    一个带有监控的锁操作。An instrumented lock operation.

    • wait/lock/table

      一个带有监控的表锁操作。An instrumented table lock operation.

    • wait/lock/metadata/sql/mdl

      一个带有监控的元数据锁操作。An instrumented metadata lock operation.

  • wait/synch

    一个带有监控的同步对象。对于同步对象,TIMER_WAIT 时间包括尝试获取对象锁时被阻塞的时间(如果有的话)。An instrumented synchronization object. For synchronization objects, the TIMER_WAIT time includes the amount of time blocked while attempting to acquire a lock on the object, if any.

    • wait/synch/cond

      条件用于让一个线程向其他线程发出信号,表示它们正在等待的某件事情已经发生。如果只有一个线程在等待条件,它可以被唤醒并继续执行。如果有多个线程在等待,它们都可以被唤醒并竞争它们所等待的资源。A condition is used by one thread to signal to other threads that something they were waiting for has happened. If a single thread was waiting for a condition, it can wake up and proceed with its execution. If several threads were waiting, they can all wake up and compete for the resource for which they were waiting.

    • wait/synch/mutex

      互斥对象用于允许访问资源(例如一段可执行代码)同时防止其他线程访问该资源。A mutual exclusion object used to permit access to a resource (such as a section of executable code) while preventing other threads from accessing the resource.

    • wait/synch/prlock

      一个优先级读写锁对象。A priority rwlock lock object.

    • wait/synch/rwlock

      一个普通的读/写锁对象,用于锁定特定变量以便访问,同时防止其他线程使用它。共享读锁可以被多个线程同时获取。排他写锁一次只能被一个线程获取。A plain read/write lock object used to lock a specific variable for access while preventing its use by other threads. A shared read lock can be acquired simultaneously by multiple threads. An exclusive write lock can be acquired by only one thread at a time.

    • wait/synch/sxlock

      共享-排他(SX)锁是一种读/写锁对象,它在允许其他线程进行不一致读取的同时提供对公共资源的写访问。sxlocks优化并发性并提高读写工作负载的可扩展性。A shared-exclusive (SX) lock is a type of rwlock lock object that provides write access to a common resource while permitting inconsistent reads by other threads. sxlocks optimize concurrency and improve scalability for read-write workloads.