性能模式实现了几个提供配置信息的系统变量:The Performance Schema implements several system variables that provide configuration information:
mysql> SHOW VARIABLES LIKE 'perf%';
+----------------------------------------------------------+-------+
| Variable_name | Value |
+----------------------------------------------------------+-------+
| performance_schema | ON |
| performance_schema_accounts_size | -1 |
| performance_schema_digests_size | 10000 |
| performance_schema_error_size | 5377 |
| performance_schema_events_stages_history_long_size | 10000 |
| performance_schema_events_stages_history_size | 10 |
| performance_schema_events_statements_history_long_size | 10000 |
| performance_schema_events_statements_history_size | 10 |
| performance_schema_events_transactions_history_long_size | 10000 |
| performance_schema_events_transactions_history_size | 10 |
| performance_schema_events_waits_history_long_size | 10000 |
| performance_schema_events_waits_history_size | 10 |
| performance_schema_hosts_size | -1 |
| performance_schema_max_cond_classes | 150 |
| performance_schema_max_cond_instances | -1 |
| performance_schema_max_digest_length | 1024 |
| performance_schema_max_digest_sample_age | 60 |
| performance_schema_max_file_classes | 80 |
| performance_schema_max_file_handles | 32768 |
| performance_schema_max_file_instances | -1 |
| performance_schema_max_index_stat | -1 |
| performance_schema_max_memory_classes | 470 |
| performance_schema_max_metadata_locks | -1 |
| performance_schema_max_meter_classes | 30 |
| performance_schema_max_metric_classes | 600 |
| performance_schema_max_mutex_classes | 350 |
| performance_schema_max_mutex_instances | -1 |
| performance_schema_max_prepared_statements_instances | -1 |
| performance_schema_max_program_instances | -1 |
| performance_schema_max_rwlock_classes | 100 |
| performance_schema_max_rwlock_instances | -1 |
| performance_schema_max_socket_classes | 10 |
| performance_schema_max_socket_instances | -1 |
| performance_schema_max_sql_text_length | 1024 |
| performance_schema_max_stage_classes | 175 |
| performance_schema_max_statement_classes | 220 |
| performance_schema_max_statement_stack | 10 |
| performance_schema_max_table_handles | -1 |
| performance_schema_max_table_instances | -1 |
| performance_schema_max_table_lock_stat | -1 |
| performance_schema_max_thread_classes | 100 |
| performance_schema_max_thread_instances | -1 |
| performance_schema_session_connect_attrs_size | 512 |
| performance_schema_setup_actors_size | -1 |
| performance_schema_setup_objects_size | -1 |
| performance_schema_show_processlist | OFF |
| performance_schema_users_size | -1 |
+----------------------------------------------------------+-------+
性能模式系统变量可以在服务器启动时通过命令行或选项文件设置,并且许多变量可以在运行时设置。请参见 第 29.13 节,“性能模式选项和变量参考”。Performance Schema system variables can be set at server startup on the command line or in option files, and many can be set at runtime. See Section 29.13, “Performance Schema Option and Variable Reference”.
如果未显式设置,性能模式会在服务器启动时自动调整其多个参数的值。有关详细信息,请参见 第 29.3 节,“性能模式启动配置”。The Performance Schema automatically sizes the values of several of its parameters at server startup if they are not set explicitly. For more information, see Section 29.3, “Performance Schema Startup Configuration”.
性能模式系统变量具有以下含义:Performance Schema system variables have the following meanings:
命令行格式Command-Line Format --performance-schema[={OFF|ON}]系统变量System Variable performance_schema范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 布尔Boolean 默认值Default Value ONON此变量的值为
ON或OFF,用于指示 Performance Schema 是否启用。默认情况下,值为ON。在服务器启动时,可以指定此变量而不赋值,或赋值为ON或 1 以启用它,或者赋值为OFF或 0 以禁用它。The value of this variable isONorOFFto indicate whether the Performance Schema is enabled. By default, the value isON. At server startup, you can specify this variable with no value or a value ofONor 1 to enable it, or with a value ofOFFor 0 to disable it.即使性能模式(Performance Schema)被禁用,它仍然会继续填充
global_variables、session_variables、global_status和session_status表。这样做是为了在必要时允许通过这些表获取SHOW VARIABLES和SHOW STATUS语句的结果。当禁用时,性能模式还会填充部分复制表。Even when the Performance Schema is disabled, it continues to populate theglobal_variables,session_variables,global_status, andsession_statustables. This occurs as necessary to permit the results for theSHOW VARIABLESandSHOW STATUSstatements to be drawn from those tables. The Performance Schema also populates some of the replication tables when disabled.performance_schema_accounts_size命令行格式Command-Line Format --performance-schema-accounts-size=#系统变量System Variable performance_schema_accounts_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576accounts表中的行数。如果该变量为 0,Performance Schema 不会在accounts表中维护连接统计信息,也不会在status_by_account表中维护状态变量信息。The number of rows in theaccountstable. If this variable is 0, the Performance Schema does not maintain connection statistics in theaccountstable or status variable information in thestatus_by_accounttable.performance_schema_digests_size命令行格式Command-Line Format --performance-schema-digests-size=#系统变量System Variable performance_schema_digests_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576events_statements_summary_by_digest表中的最大行数。如果超过此最大值,导致某个摘要无法被检测,Performance Schema 会增加Performance_schema_digest_lost状态变量。The maximum number of rows in theevents_statements_summary_by_digesttable. If this maximum is exceeded such that a digest cannot be instrumented, the Performance Schema increments thePerformance_schema_digest_loststatus variable.有关语句摘要的更多信息,请参见 第 29.10 节,“Performance Schema 语句摘要与采样”。For more information about statement digesting, see Section 29.10, “Performance Schema Statement Digests and Sampling”.
命令行格式Command-Line Format --performance-schema-error-size=#系统变量System Variable performance_schema_error_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value number of server error codesnumber of server error codes最小值Minimum Value 0最大值Maximum Value 1048576已记录的服务器错误代码数量。默认值为实际的服务器错误代码数量。虽然该值可以设置在 0 到最大值之间,但预期用途是将其设置为默认值(记录所有错误)或 0(不记录任何错误)。The number of instrumented server error codes. The default value is the actual number of server error codes. Although the value can be set anywhere from 0 to its maximum, the intended use is to set it to either its default (to instrument all errors) or 0 (to instrument no errors).
错误信息汇总在摘要表中;请参见 第 29.12.20.11 节,“错误摘要表”。如果发生未被监控的错误,该错误的相关信息将汇总到每个摘要表中的
NULL行;也就是说,汇总到ERROR_NUMBER=0、ERROR_NAME=NULL和SQLSTATE=NULL的行。Error information is aggregated in summary tables; see Section 29.12.20.11, “Error Summary Tables”. If an error occurs that is not instrumented, information for the occurrence is aggregated to theNULLrow in each summary table; that is, to the row withERROR_NUMBER=0,ERROR_NAME=NULL, andSQLSTATE=NULL.performance_schema_events_stages_history_long_size命令行格式Command-Line Format --performance-schema-events-stages-history-long-size=#系统变量System Variable performance_schema_events_stages_history_long_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576events_stages_history_long表中的行数。The number of rows in theevents_stages_history_longtable.performance_schema_events_stages_history_size命令行格式Command-Line Format --performance-schema-events-stages-history-size=#系统变量System Variable performance_schema_events_stages_history_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1024events_stages_history表中每个线程的行数。The number of rows per thread in theevents_stages_historytable.performance_schema_events_statements_history_long_size命令行格式Command-Line Format --performance-schema-events-statements-history-long-size=#系统变量System Variable performance_schema_events_statements_history_long_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576events_statements_history_long表中的行数。The number of rows in theevents_statements_history_longtable.performance_schema_events_statements_history_size命令行格式Command-Line Format --performance-schema-events-statements-history-size=#系统变量System Variable performance_schema_events_statements_history_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1024在
events_statements_history表中,每个线程的行数。The number of rows per thread in theevents_statements_historytable.performance_schema_events_transactions_history_long_size命令行格式Command-Line Format --performance-schema-events-transactions-history-long-size=#系统变量System Variable performance_schema_events_transactions_history_long_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576events_transactions_history_long表中的行数。The number of rows in theevents_transactions_history_longtable.performance_schema_events_transactions_history_size命令行格式Command-Line Format --performance-schema-events-transactions-history-size=#系统变量System Variable performance_schema_events_transactions_history_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1024每个线程在
events_transactions_history表中的行数。The number of rows per thread in theevents_transactions_historytable.performance_schema_events_waits_history_long_size命令行格式Command-Line Format --performance-schema-events-waits-history-long-size=#系统变量System Variable performance_schema_events_waits_history_long_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576events_waits_history_long表中的行数。The number of rows in theevents_waits_history_longtable.performance_schema_events_waits_history_size命令行格式Command-Line Format --performance-schema-events-waits-history-size=#系统变量System Variable performance_schema_events_waits_history_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1024events_waits_history表中每个线程的行数。The number of rows per thread in theevents_waits_historytable.命令行格式Command-Line Format --performance-schema-hosts-size=#系统变量System Variable performance_schema_hosts_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576hosts表中的行数。如果该变量为 0,Performance Schema 将不会在hosts表中维护连接统计信息,也不会在status_by_host表中维护状态变量信息。The number of rows in thehoststable. If this variable is 0, the Performance Schema does not maintain connection statistics in thehoststable or status variable information in thestatus_by_hosttable.performance_schema_max_cond_classes命令行格式Command-Line Format --performance-schema-max-cond-classes=#系统变量System Variable performance_schema_max_cond_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 150最小值Minimum Value 0最大值Maximum Value 1024条件工具的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“性能模式状态监控”。The maximum number of condition instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_cond_instances命令行格式Command-Line Format --performance-schema-max-cond-instances=#系统变量System Variable performance_schema_max_cond_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576仪器化条件对象的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。The maximum number of instrumented condition objects. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_digest_length命令行格式Command-Line Format --performance-schema-max-digest-length=#系统变量System Variable performance_schema_max_digest_length范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 1024最小值Minimum Value 0最大值Maximum Value 1048576单位Unit 字节bytes 在 Performance Schema 中,为计算标准化语句摘要值,每条语句保留的最大内存字节数。此变量与
max_digest_length有关;请参阅第 7.1.8 节,“服务器系统变量” 中该变量的描述。The maximum number of bytes of memory reserved per statement for computation of normalized statement digest values in the Performance Schema. This variable is related tomax_digest_length; see the description of that variable in Section 7.1.8, “Server System Variables”.有关语句消化的更多信息,包括内存使用方面的考虑,请参见 第 29.10 节,“性能模式语句消化和采样”。For more information about statement digesting, including considerations regarding memory use, see Section 29.10, “Performance Schema Statement Digests and Sampling”.
performance_schema_max_digest_sample_age命令行格式Command-Line Format --performance-schema-max-digest-sample-age=#系统变量System Variable performance_schema_max_digest_sample_age范围Scope 全球Global 动态Dynamic 是Yes SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 60最小值Minimum Value 0最大值Maximum Value 1048576单位Unit 秒seconds 该变量影响
events_statements_summary_by_digest表的语句采样。当插入新的表行时,生成该行 digest 值的语句会被存储为与该 digest 关联的当前样本语句。此后,当服务器看到具有相同 digest 值的其他语句时,它会决定是否使用新语句替换当前样本语句(即是否重新采样)。重新采样策略基于当前样本语句和新语句的比较等待时间,并可选择考虑当前样本语句的存留时间:This variable affects statement sampling for theevents_statements_summary_by_digesttable. When a new table row is inserted, the statement that produced the row digest value is stored as the current sample statement associated with the digest. Thereafter, when the server sees other statements with the same digest value, it determines whether to use the new statement to replace the current sample statement (that is, whether to resample). Resampling policy is based on the comparative wait times of the current sample statement and new statement and, optionally, the age of the current sample statement:基于等待时间的重新采样:如果新语句的等待时间大于当前示例语句的等待时间,它将成为当前示例语句。Resampling based on wait times: If the new statement wait time has a wait time greater than that of the current sample statement, it becomes the current sample statement.
基于年龄的重采样:如果
performance_schema_max_digest_sample_age系统变量的值大于零,并且当前采样语句的时间超过该秒数,则当前语句被视为“太旧”,并且新语句会替换它。即使新语句的等待时间小于当前采样语句的等待时间,也会发生这种情况。Resampling based on age: If theperformance_schema_max_digest_sample_agesystem variable has a value greater than zero and the current sample statement is more than that many seconds old, the current statement is considered “too old” and the new statement replaces it. This occurs even if the new statement wait time is less than that of the current sample statement.
有关语句采样的信息,请参见 第 29.10 节,“性能模式语句摘要与采样”。For information about statement sampling, see Section 29.10, “Performance Schema Statement Digests and Sampling”.
performance_schema_max_file_classes命令行格式Command-Line Format --performance-schema-max-file-classes=#系统变量System Variable performance_schema_max_file_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 80最小值Minimum Value 0最大值Maximum Value 1024文件工具的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。The maximum number of file instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_file_handles命令行格式Command-Line Format --performance-schema-max-file-handles=#系统变量System Variable performance_schema_max_file_handles范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 32768最小值Minimum Value 0最大值Maximum Value 1048576最大打开的文件对象数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。The maximum number of opened file objects. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_file_handles的值应大于open_files_limit的值:open_files_limit影响服务器可以支持的最大打开文件句柄数,而performance_schema_max_file_handles影响这些文件句柄中可被监测的数量。The value ofperformance_schema_max_file_handlesshould be greater than the value ofopen_files_limit:open_files_limitaffects the maximum number of open file handles the server can support andperformance_schema_max_file_handlesaffects how many of these file handles can be instrumented.performance_schema_max_file_instances命令行格式Command-Line Format --performance-schema-max-file-instances=#系统变量System Variable performance_schema_max_file_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576可检测文件对象的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“性能模式状态监控”。The maximum number of instrumented file objects. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_index_stat命令行格式Command-Line Format --performance-schema-max-index-stat=#系统变量System Variable performance_schema_max_index_stat范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576Performance Schema 为其维护统计信息的最大索引数量。如果超过此最大值以至于索引统计信息丢失,Performance Schema 将增加
Performance_schema_index_stat_lost状态变量。默认值使用performance_schema_max_table_instances的值自动确定。The maximum number of indexes for which the Performance Schema maintains statistics. If this maximum is exceeded such that index statistics are lost, the Performance Schema increments thePerformance_schema_index_stat_loststatus variable. The default value is autosized using the value ofperformance_schema_max_table_instances.performance_schema_max_memory_classes命令行格式Command-Line Format --performance-schema-max-memory-classes=#系统变量System Variable performance_schema_max_memory_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 470默认值Default Value 450最小值Minimum Value 0最大值Maximum Value 1024内存工具的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“性能模式状态监控”。The maximum number of memory instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_metadata_locks命令行格式Command-Line Format --performance-schema-max-metadata-locks=#系统变量System Variable performance_schema_max_metadata_locks范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 10485760元数据锁定工具的最大数量。此值控制
metadata_locks表的大小。如果超过此最大值以至于无法对元数据锁进行监控,Performance Schema 将增加Performance_schema_metadata_lock_lost状态变量。The maximum number of metadata lock instruments. This value controls the size of themetadata_lockstable. If this maximum is exceeded such that a metadata lock cannot be instrumented, the Performance Schema increments thePerformance_schema_metadata_lock_loststatus variable.performance_schema_max_meter_classes命令行格式Command-Line Format --performance-schema-max-meter-classes=#系统变量System Variable performance_schema_max_meter_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 30最小值Minimum Value 0最大值Maximum Value 64可以创建的计量仪器的最大数量Maximum number of meter instruments which can be created
performance_schema_max_metric_classes命令行格式Command-Line Format --performance-schema-max-metric-classes=#系统变量System Variable performance_schema_max_metric_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 600最小值Minimum Value 30最大值Maximum Value 11000可以创建的最大指标工具数量。Maximum number of metric instruments which can be created.
performance_schema_max_mutex_classes命令行格式Command-Line Format --performance-schema-max-mutex-classes=#系统变量System Variable performance_schema_max_mutex_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 350最小值Minimum Value 0最大值Maximum Value 1024互斥体工具的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“性能模式状态监控”。The maximum number of mutex instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_mutex_instances命令行格式Command-Line Format --performance-schema-max-mutex-instances=#系统变量System Variable performance_schema_max_mutex_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 104857600可监控的互斥体对象的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“性能模式状态监控”。The maximum number of instrumented mutex objects. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_prepared_statements_instances命令行格式Command-Line Format --performance-schema-max-prepared-statements-instances=#系统变量System Variable performance_schema_max_prepared_statements_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 4194304prepared_statements_instances表中的最大行数。如果超过此最大值,导致某个预准备语句无法被监控,Performance Schema 会增加Performance_schema_prepared_statements_lost状态变量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“Performance Schema 状态监控”。The maximum number of rows in theprepared_statements_instancestable. If this maximum is exceeded such that a prepared statement cannot be instrumented, the Performance Schema increments thePerformance_schema_prepared_statements_loststatus variable. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.该变量的默认值根据
max_prepared_stmt_count系统变量的值自动调整。The default value of this variable is autosized based on the value of themax_prepared_stmt_countsystem variable.performance_schema_max_rwlock_classes命令行格式Command-Line Format --performance-schema-max-rwlock-classes=#系统变量System Variable performance_schema_max_rwlock_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 100最小值Minimum Value 0最大值Maximum Value 1024rwlock 工具的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“Performance Schema 状态监控”。The maximum number of rwlock instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_program_instances命令行格式Command-Line Format --performance-schema-max-program-instances=#系统变量System Variable performance_schema_max_program_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576Performance Schema 为其维护统计信息的最大存储程序数量。如果超过此最大值,Performance Schema 会增加
Performance_schema_program_lost状态变量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“Performance Schema 状态监控”。The maximum number of stored programs for which the Performance Schema maintains statistics. If this maximum is exceeded, the Performance Schema increments thePerformance_schema_program_loststatus variable. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.performance_schema_max_rwlock_instances命令行格式Command-Line Format --performance-schema-max-rwlock-instances=#系统变量System Variable performance_schema_max_rwlock_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最大值Maximum Value 104857600可监控的最大读写锁对象数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“Performance Schema 状态监控”。The maximum number of instrumented rwlock objects. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_socket_classes命令行格式Command-Line Format --performance-schema-max-socket-classes=#系统变量System Variable performance_schema_max_socket_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 10最小值Minimum Value 0最大值Maximum Value 1024套接字工具的最大数量。有关如何设置和使用此变量的信息,请参阅第 29.7 节,“性能模式状态监控”。The maximum number of socket instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_socket_instances命令行格式Command-Line Format --performance-schema-max-socket-instances=#系统变量System Variable performance_schema_max_socket_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576可检测的套接字对象的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“性能模式状态监控”。The maximum number of instrumented socket objects. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_sql_text_length命令行格式Command-Line Format --performance-schema-max-sql-text-length=#系统变量System Variable performance_schema_max_sql_text_length范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 1024最小值Minimum Value 0最大值Maximum Value 1048576单位Unit 字节bytes 用于存储 SQL 语句的最大字节数。该值适用于以下列所需的存储:The maximum number of bytes used to store SQL statements. The value applies to storage required for these columns:
events_statements_current、events_statements_history和events_statements_history_long语句事件表的SQL_TEXT列。TheSQL_TEXTcolumn of theevents_statements_current,events_statements_history, andevents_statements_history_longstatement event tables.events_statements_summary_by_digest摘要表的QUERY_SAMPLE_TEXT列。TheQUERY_SAMPLE_TEXTcolumn of theevents_statements_summary_by_digestsummary table.
超过
performance_schema_max_sql_text_length的字节将被丢弃,并且不会出现在该列中。在该列中,仅在前面这么多字节之后不同的语句将无法区分。Any bytes in excess ofperformance_schema_max_sql_text_lengthare discarded and do not appear in the column. Statements differing only after that many initial bytes are indistinguishable in the column.降低
performance_schema_max_sql_text_length的值可以减少内存使用,但如果 SQL 语句仅在末尾不同,会导致更多语句无法区分。增加该值会增加内存使用,但允许区分更长的语句。Decreasing theperformance_schema_max_sql_text_lengthvalue reduces memory use but causes more statements to become indistinguishable if they differ only at the end. Increasing the value increases memory use but permits longer statements to be distinguished.performance_schema_max_stage_classes命令行格式Command-Line Format --performance-schema-max-stage-classes=#系统变量System Variable performance_schema_max_stage_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 175最小值Minimum Value 0最大值Maximum Value 1024舞台仪器的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“Performance Schema 状态监控”。The maximum number of stage instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_statement_classes命令行格式Command-Line Format --performance-schema-max-statement-classes=#系统变量System Variable performance_schema_max_statement_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 最小值Minimum Value 0最大值Maximum Value 256语句工具的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“Performance Schema 状态监控”。The maximum number of statement instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
默认值是在服务器构建时根据客户端/服务器协议中的命令数量以及服务器支持的 SQL 语句类型数量计算得出的。The default value is calculated at server build time based on the number of commands in the client/server protocol and the number of SQL statement types supported by the server.
除非将其设置为 0 以禁用所有语句工具并节省所有相关内存,否则不应更改此变量。将该变量设置为除默认值之外的非零值没有任何好处;特别是,设置值大于默认值会导致分配比实际需要更多的内存。This variable should not be changed, unless to set it to 0 to disable all statement instrumentation and save all memory associated with it. Setting the variable to nonzero values other than the default has no benefit; in particular, values larger than the default cause more memory to be allocated then is needed.
performance_schema_max_statement_stack命令行格式Command-Line Format --performance-schema-max-statement-stack=#系统变量System Variable performance_schema_max_statement_stack范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 10最小值Minimum Value 1最大值Maximum Value 256Performance Schema 维护统计信息的嵌套存储程序调用的最大深度。当超过此最大值时,Performance Schema 会针对每个执行的存储程序语句递增
Performance_schema_nested_statement_lost状态变量。The maximum depth of nested stored program calls for which the Performance Schema maintains statistics. When this maximum is exceeded, the Performance Schema increments thePerformance_schema_nested_statement_loststatus variable for each stored program statement executed.performance_schema_max_table_handles命令行格式Command-Line Format --performance-schema-max-table-handles=#系统变量System Variable performance_schema_max_table_handles范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576打开的表对象的最大数量。此值控制
table_handles表的大小。如果超过此最大值,导致某个表句柄无法被记录,性能模式会增加Performance_schema_table_handles_lost状态变量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。The maximum number of opened table objects. This value controls the size of thetable_handlestable. If this maximum is exceeded such that a table handle cannot be instrumented, the Performance Schema increments thePerformance_schema_table_handles_loststatus variable. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.performance_schema_max_table_instances命令行格式Command-Line Format --performance-schema-max-table-instances=#系统变量System Variable performance_schema_max_table_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576可检测表对象的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“性能模式状态监测”。The maximum number of instrumented table objects. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_table_lock_stat命令行格式Command-Line Format --performance-schema-max-table-lock-stat=#系统变量System Variable performance_schema_max_table_lock_stat范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576Performance Schema 维护锁统计信息的最大表数量。如果超过此最大值而导致表锁统计信息丢失,Performance Schema 会增加
Performance_schema_table_lock_stat_lost状态变量。The maximum number of tables for which the Performance Schema maintains lock statistics. If this maximum is exceeded such that table lock statistics are lost, the Performance Schema increments thePerformance_schema_table_lock_stat_loststatus variable.performance_schema_max_thread_classes命令行格式Command-Line Format --performance-schema-max-thread-classes=#系统变量System Variable performance_schema_max_thread_classes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 100最小值Minimum Value 0最大值Maximum Value 1024线程工具的最大数量。有关如何设置和使用此变量的信息,请参见 第 29.7 节,“Performance Schema 状态监控”。The maximum number of thread instruments. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.
performance_schema_max_thread_instances命令行格式Command-Line Format --performance-schema-max-thread-instances=#系统变量System Variable performance_schema_max_thread_instances范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576可监控的线程对象的最大数量。该值控制
threads表的大小。如果超过该最大值而无法对线程进行监控,Performance Schema 将增加Performance_schema_thread_instances_lost状态变量。有关如何设置和使用此变量的信息,请参见第 29.7 节,“Performance Schema 状态监控”。The maximum number of instrumented thread objects. The value controls the size of thethreadstable. If this maximum is exceeded such that a thread cannot be instrumented, the Performance Schema increments thePerformance_schema_thread_instances_loststatus variable. For information about how to set and use this variable, see Section 29.7, “Performance Schema Status Monitoring”.max_connections系统变量影响服务器中可以运行的线程数量。performance_schema_max_thread_instances影响这些正在运行的线程中可以被检测的数量。Themax_connectionssystem variable affects how many threads can run in the server.performance_schema_max_thread_instancesaffects how many of these running threads can be instrumented.variables_by_thread和status_by_thread表仅包含关于前台线程的系统和状态变量信息。如果并非所有线程都被 Performance Schema 仪表化,则该表会缺少一些行。在这种情况下,Performance_schema_thread_instances_lost状态变量大于零。Thevariables_by_threadandstatus_by_threadtables contain system and status variable information only about foreground threads. If not all threads are instrumented by the Performance Schema, this table misses some rows. In this case, thePerformance_schema_thread_instances_loststatus variable is greater than zero.performance_schema_session_connect_attrs_size命令行格式Command-Line Format --performance-schema-session-connect-attrs-size=#系统变量System Variable performance_schema_session_connect_attrs_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最小值Minimum Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最大值Maximum Value 1048576单位Unit 字节bytes 为每个线程预分配的内存量,用于保存连接属性的键值对。如果客户端发送的连接属性数据总大小大于此数量,Performance Schema 会截断属性数据,增加
Performance_schema_session_connect_attrs_lost状态变量,并在log_error_verbosity系统变量值大于 1 时在错误日志中写入截断发生的消息。如果属性缓冲区有足够空间,还会向会话属性中添加一个_truncated属性,其值指示丢失了多少字节。这使得 Performance Schema 能够在连接属性表中暴露每个连接的截断信息,而无需检查错误日志即可查看这些信息。The amount of preallocated memory per thread reserved to hold connection attribute key-value pairs. If the aggregate size of connection attribute data sent by a client is larger than this amount, the Performance Schema truncates the attribute data, increments thePerformance_schema_session_connect_attrs_loststatus variable, and writes a message to the error log indicating that truncation occurred if thelog_error_verbositysystem variable is greater than 1. A_truncatedattribute is also added to the session attributes with a value indicating how many bytes were lost, if the attribute buffer has sufficient space. This enables the Performance Schema to expose per-connection truncation information in the connection attribute tables. This information can be examined without having to check the error log.performance_schema_session_connect_attrs_size的默认值在服务器启动时会自动调整大小。这个值可能较小,因此如果发生截断(Performance_schema_session_connect_attrs_lost变为非零),您可能希望将performance_schema_session_connect_attrs_size显式设置为更大的值。The default value ofperformance_schema_session_connect_attrs_sizeis autosized at server startup. This value may be small, so if truncation occurs (Performance_schema_session_connect_attrs_lostbecomes nonzero), you may wish to setperformance_schema_session_connect_attrs_sizeexplicitly to a larger value.虽然允许的最大
performance_schema_session_connect_attrs_size值为 1MB,但有效最大值为 64KB,因为服务器对接受的连接属性数据的总大小施加了 64KB 的限制。如果客户端尝试发送超过 64KB 的属性数据,服务器将拒绝连接。更多信息,请参见 第 29.12.9 节,“Performance Schema 连接属性表”。Although the maximum permittedperformance_schema_session_connect_attrs_sizevalue is 1MB, the effective maximum is 64KB because the server imposes a limit of 64KB on the aggregate size of connection attribute data it accepts. If a client attempts to send more than 64KB of attribute data, the server rejects the connection. For more information, see Section 29.12.9, “Performance Schema Connection Attribute Tables”.performance_schema_setup_actors_size命令行格式Command-Line Format --performance-schema-setup-actors-size=#系统变量System Variable performance_schema_setup_actors_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动调整大小;不要分配此字面值)-1(signifies autosizing; do not assign this literal value)最大值Maximum Value 1048576setup_actors表中的行数。The number of rows in thesetup_actorstable.performance_schema_setup_objects_size命令行格式Command-Line Format --performance-schema-setup-objects-size=#系统变量System Variable performance_schema_setup_objects_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576setup_objects表中的行数。The number of rows in thesetup_objectstable.performance_schema_show_processlist命令行格式Command-Line Format --performance-schema-show-processlist[={OFF|ON}]--performance-schema-show-processlist[={OFF|ON}]已弃用Deprecated 是Yes 系统变量System Variable performance_schema_show_processlist范围Scope 全球Global 动态Dynamic 是Yes SET_VAR提示适用SET_VARHint Applies否No 类型Type 布尔Boolean 默认值Default Value OFFOFFSHOW PROCESSLIST语句通过收集所有活动线程的数据提供进程信息。performance_schema_show_processlist变量决定使用哪种SHOW PROCESSLIST实现:TheSHOW PROCESSLISTstatement provides process information by collecting thread data from all active threads. Theperformance_schema_show_processlistvariable determines whichSHOW PROCESSLISTimplementation to use:默认实现是在持有全局互斥锁的情况下,从线程管理器中迭代遍历活动线程。这会对性能产生负面影响,特别是在繁忙系统上。The default implementation iterates across active threads from within the thread manager while holding a global mutex. This has negative performance consequences, particularly on busy systems.
替代的
SHOW PROCESSLIST实现是基于 Performance Schemaprocesslist表。这种实现从 Performance Schema 查询活动线程数据,而不是从线程管理器查询,并且不需要互斥锁。The alternativeSHOW PROCESSLISTimplementation is based on the Performance Schemaprocesslisttable. This implementation queries active thread data from the Performance Schema rather than the thread manager and does not require a mutex.
要启用替代实现,请启用
performance_schema_show_processlist系统变量。为了确保默认实现和替代实现提供相同的信息,必须满足某些配置要求;请参见 第 29.12.22.7 节,“processlist 表”。To enable the alternative implementation, enable theperformance_schema_show_processlistsystem variable. To ensure that the default and alternative implementations yield the same information, certain configuration requirements must be met; see Section 29.12.22.7, “The processlist Table”.命令行格式Command-Line Format --performance-schema-users-size=#系统变量System Variable performance_schema_users_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最小值Minimum Value -1(表示自动扩展;不要分配此字面值)-1(signifies autoscaling; do not assign this literal value)最大值Maximum Value 1048576users表中的行数。如果该变量为 0,Performance Schema 将不会在users表中维护连接统计信息,也不会在status_by_user表中维护状态变量信息。The number of rows in theuserstable. If this variable is 0, the Performance Schema does not maintain connection statistics in theuserstable or status variable information in thestatus_by_usertable.