MySQL 服务器维护着许多系统变量,这些变量指示其配置情况(参见 第 7.1.8 节,“服务器系统变量”)。这些性能模式表中提供了系统变量信息:The MySQL server maintains many system variables that indicate how it is configured (see Section 7.1.8, “Server System Variables”). System variable information is available in these Performance Schema tables:
global_variables:全局系统变量。仅想要全局值的应用程序应使用此表。global_variables: Global system variables. An application that wants only global values should use this table.session_variables:当前会话的系统变量。希望获取自身会话的所有系统变量值的应用程序应使用此表。它包括该会话的会话变量,以及没有会话对应项的全局变量值。session_variables: System variables for the current session. An application that wants all system variable values for its own session should use this table. It includes the session variables for its session, as well as the values of global variables that have no session counterpart.variables_by_thread:每个活动会话的会话系统变量。希望了解特定会话的会话变量值的应用程序应使用此表。它仅包括会话变量,由线程 ID 标识。variables_by_thread: Session system variables for each active session. An application that wants to know the session variable values for specific sessions should use this table. It includes session variables only, identified by thread ID.persisted_variables:提供了一个 SQL 界面,用于访问存储持久化全局系统变量设置的mysqld-auto.cnf文件。参见 第 29.12.14.1 节,“Performance Schema persisted_variables 表”。persisted_variables: Provides a SQL interface to themysqld-auto.cnffile that stores persisted global system variable settings. See Section 29.12.14.1, “Performance Schema persisted_variables Table”.variables_info:显示每个系统变量最近一次设置的来源及其取值范围。见 第 29.12.14.2 节,“Performance Schema variables_info 表”。variables_info: Shows, for each system variable, the source from which it was most recently set, and its range of values. See Section 29.12.14.2, “Performance Schema variables_info Table”.
查看这些表中敏感系统变量的值需要 SENSITIVE_VARIABLES_OBSERVER 权限。The SENSITIVE_VARIABLES_OBSERVER
privilege is required to view the values of sensitive system
variables in these tables.
会话变量表(session_variables,variables_by_thread)仅包含活动会话的信息,不包括已终止的会话。The session variable tables
(session_variables,
variables_by_thread) contain
information only for active sessions, not terminated sessions.
global_variables 和 session_variables 表具有以下列:The global_variables and
session_variables tables have these
columns:
VARIABLE_NAME系统变量名称。The system variable name.
VARIABLE_VALUE系统变量值。对于
global_variables,此列包含全局值。对于session_variables,此列包含当前会话生效的变量值。The system variable value. Forglobal_variables, this column contains the global value. Forsession_variables, this column contains the variable value in effect for the current session.
global_variables 和 session_variables 表具有以下索引:The global_variables and
session_variables tables have these
indexes:
主键在 (
VARIABLE_NAME) 上Primary key on (VARIABLE_NAME)
variables_by_thread 表具有以下列:The variables_by_thread table has
these columns:
THREAD_ID定义系统变量的会话的线程标识符。The thread identifier of the session in which the system variable is defined.
VARIABLE_NAME系统变量名称。The system variable name.
VARIABLE_VALUE由
THREAD_ID列命名的会话的会话变量值。The session variable value for the session named by theTHREAD_IDcolumn.
variables_by_thread 表具有以下索引:The variables_by_thread table has
these indexes:
主键在 (
THREAD_ID,VARIABLE_NAME) 上Primary key on (THREAD_ID,VARIABLE_NAME)
variables_by_thread 表仅包含关于前台线程的系统变量信息。如果性能模式未对所有线程进行监控,则该表会缺少一些行。在这种情况下,Performance_schema_thread_instances_lost 状态变量大于零。The variables_by_thread table
contains system variable information only about foreground
threads. If not all threads are instrumented by the Performance
Schema, this table misses some rows. In this case, the
Performance_schema_thread_instances_lost
status variable is greater than zero.
TRUNCATE TABLE 不支持性能模式系统变量表。TRUNCATE TABLE is not supported
for Performance Schema system variable tables.