29.15 Performance Schema 系统变量
性能Schema实现了多个系统变量,提供配置信息:
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 |
+----------------------------------------------------------+-------+
性能Schema系统变量可以在命令行或选项文件中设置,在启动服务器时设置,许多可以在运行时设置。见第29.13节,“性能Schema选项和变量参考”。
性能Schema在服务器启动时自动设置了几个参数的值,如果它们没有被明确设置。更多信息,请见第29.3节,“性能Schema启动配置”。
性能Schema系统变量具有以下含义:
-
Command-Line Format --performance-schema[={OFF|ON}]System Variable performance_schemaScope 全局 Dynamic 否 SET_VARHint Applies否 Type 布尔 Default Value ON该变量的值是
ON或OFF,以指示性能Schema是否启用。默认情况下,值为ON。在服务器启动时,您可以指定该变量的值为无、ON或1以启用它,或者为OFF或0以禁用它。即使性能Schema被禁用,它仍然继续填充global_variables、session_variables、global_status和session_status表。这是为了允许结果来自这些表的
SHOW VARIABLES和SHOW STATUS语句。性能Schema也在禁用时填充一些复制表。 -
performance_schema_accounts_sizeCommand-Line Format --performance-schema-accounts-size=#System Variable performance_schema_accounts_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给变量)Maximum Value 1048576性能架构中的
accounts表中的行数。如果该变量为 0,性能架构将不维护accounts表中的连接统计信息或状态变量信息status_by_account表。 -
performance_schema_digests_sizeCommand-Line Format --performance-schema-digests-size=#System Variable performance_schema_digests_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给变量)Maximum Value 1048576性能架构中的
events_statements_summary_by_digest表中的最大行数。如果该最大值超过,可以.instrumenting一个摘要无法,性能架构将增加Performance_schema_digest_lost状态变量。有关语句摘要的更多信息,请参见第29.10节,“性能架构语句摘要和采样”。
-
Command-Line Format --performance-schema-error-size=#System Variable performance_schema_error_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 服务器错误代码的数量Minimum Value 0Maximum Value 1048576性能架构中的服务器错误代码数量。默认值是实际的服务器错误代码数量。虽然该值可以设置为0到其最大值之间,但预期用途是将其设置为默认值(以便instrument所有错误)或0(以便instrument无错误)。
错误信息在摘要表中聚合;请参见第29.12.20.11节,“错误摘要表”。如果发生未instrument的错误,错误信息将被聚合到每个摘要表的
NULL行中,即ERROR_NUMBER=0、ERROR_NAME=NULL和SQLSTATE=NULL。 -
performance_schema_events_stages_history_long_sizeCommand-Line Format --performance-schema-events-stages-history-long-size=#System Variable performance_schema_events_stages_history_long_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576events_stages_history_long表中的行数。
-
performance_schema_events_stages_history_sizeCommand-Line Format --performance-schema-events-stages-history-size=#System Variable performance_schema_events_stages_history_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1024events_stages_history表中的每个线程的行数。
-
performance_schema_events_statements_history_long_sizeCommand-Line Format --performance-schema-events-statements-history-long-size=#System Variable performance_schema_events_statements_history_long_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576events_statements_history_long 表中的行数。
-
performance_schema_events_statements_history_sizeCommand-Line Format --performance-schema-events-statements-history-size=#System Variable performance_schema_events_statements_history_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1024每个线程在 events_statements_history 表中的行数。
-
performance_schema_events_transactions_history_long_sizeCommand-Line Format --performance-schema-events-transactions-history-long-size=#System Variable performance_schema_events_transactions_history_long_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1048576events_transactions_history_long 表中的行数。
-
performance_schema_events_transactions_history_sizeCommand-Line Format --performance-schema-events-transactions-history-size=#System Variable performance_schema_events_transactions_history_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1024每个线程中的行数,在
events_transactions_history表中。 -
performance_schema_events_waits_history_long_sizeCommand-Line Format --performance-schema-events-waits-history-long-size=#System Variable performance_schema_events_waits_history_long_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576events_waits_history_long 表中的行数。
-
performance_schema_events_waits_history_sizeCommand-Line Format --performance-schema-events-waits-history-size=#System Variable performance_schema_events_waits_history_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1024每个线程中的行数,在
events_waits_history表中。 -
Command-Line Format --performance-schema-hosts-size=#System Variable performance_schema_hosts_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576性能架构中的
hosts表中的行数。如果该变量为 0,性能架构将不维护hosts表或status_by_host表中的状态变量信息。 -
performance_schema_max_cond_classesCommand-Line Format --performance-schema-max-cond-classes=#System Variable performance_schema_max_cond_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 150Minimum Value 0Maximum Value 1024条件工具的最大数量。有关如何设置和使用该变量的信息,请参见第29.7节,“性能架构状态监控”。
-
performance_schema_max_cond_instancesCommand-Line Format --performance-schema-max-cond-instances=#System Variable performance_schema_max_cond_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1048576instrumented 条件对象的最大数量。有关如何设置和使用该变量的信息,请参见第29.7节,“性能架构状态监控”。
-
performance_schema_max_digest_lengthCommand-Line Format --performance-schema-max-digest-length=#System Variable performance_schema_max_digest_lengthScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 1024Minimum Value 0Maximum Value 1048576Unit 字节 该变量确定每个语句对normalized 语句摘要值的内存分配字节数。该变量与
max_digest_length相关,详见第7.1.8节,“Server System Variables”。欲了解更多关于语句摘要的信息,包括内存使用的考虑,见第29.10节,“Performance Schema Statement Digests and Sampling”。
-
performance_schema_max_digest_sample_ageCommand-Line Format --performance-schema-max-digest-sample-age=#System Variable performance_schema_max_digest_sample_ageScope Global Dynamic Yes SET_VARHint AppliesNo Type Integer Default Value 60Minimum Value 0Maximum Value 1048576Unit 秒 该变量影响
events_statements_summary_by_digest表。每当插入新表行时,生成该行摘要值的语句将被存储为当前样本语句与该摘要值相关联。随后,当服务器看到其他语句具有相同摘要值时,它将确定是否使用新语句替换当前样本语句(即重新采样)。重新采样策略基于当前样本语句和新语句的等待时间,以及可选的当前样本语句的年龄:-
基于等待时间的重新采样:如果新语句的等待时间大于当前样本语句的等待时间,它将成为当前样本语句。
-
基于年龄的重新采样:如果
performance_schema_max_digest_sample_age系统变量的值大于零,并且当前样本语句超过该值秒,则当前语句被认为是““too old””并被新语句替换。即使新语句的等待时间小于当前样本语句的等待时间。
欲了解更多关于语句采样,请见第29.10节,“Performance Schema Statement Digests and Sampling”。
-
-
performance_schema_max_file_classesCommand-Line Format --performance-schema-max-file-classes=#System Variable performance_schema_max_file_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 80Minimum Value 0Maximum Value 1024文件工具的最大数量。有关如何设置和使用该变量,请参见第29.7节,“性能 Schema 状态监控”。
-
performance_schema_max_file_handlesCommand-Line Format --performance-schema-max-file-handles=#System Variable performance_schema_max_file_handlesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 32768Minimum Value 0Maximum Value 1048576打开文件对象的最大数量。有关如何设置和使用该变量,请参见第29.7节,“性能 Schema 状态监控”。
变量
performance_schema_max_file_handles的值应该大于变量open_files_limit的值:open_files_limit影响服务器支持的最大打开文件数量,performance_schema_max_file_handles影响可以被instrument的文件数量。 -
performance_schema_max_file_instancesCommand-Line Format --performance-schema-max-file-instances=#System Variable performance_schema_max_file_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1048576可以被instrument的文件对象的最大数量。有关如何设置和使用该变量,请参见第29.7节,“性能 Schema 状态监控”。
-
performance_schema_max_index_statCommand-Line Format --performance_schema_max_index_stat=#System Variable performance_schema_max_index_statScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576性能 Schema 维护的索引统计的最大数量。如果达到该最大数量,索引统计将被丢失,性能 Schema 将增加
Performance_schema_index_stat_lost状态变量的值。默认值是使用performance_schema_max_table_instances的值进行自动调整。 -
performance_schema_max_memory_classesCommand-Line Format --performance_schema_max_memory_classes=#System Variable performance_schema_max_memory_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 470Default Value 450Minimum Value 0Maximum Value 1024性能 Schema 的最大内存工具数量。有关如何设置和使用该变量的信息,请参见第29.7节,“性能 Schema 状态监控”。
-
performance_schema_max_metadata_locksCommand-Line Format --performance_schema_max_metadata_locks=#System Variable performance_schema_max_metadata_locksScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 10485760存储器锁定的最大数量。这一值控制着metadata_locks表的大小。如果锁定的最大数量超过了这样一个锁定不能被instrumented,Performance Schema 将增加
Performance_schema_metadata_lock_lost状态变量。 -
performance_schema_max_meter_classesCommand-Line Format --performance-schema-max-meter-classes=#System Variable performance_schema_max_meter_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 30Minimum Value 0Maximum Value 64可以创建的最大计量仪表数量
-
performance_schema_max_metric_classesCommand-Line Format --performance-schema-max-metric-classes=#System Variable performance_schema_max_metric_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 600Minimum Value 30Maximum Value 11000可以创建的最大指标仪表数量。
-
performance_schema_max_mutex_classesCommand-Line Format --performance-schema-max-mutex-classes=#System Variable performance_schema_max_mutex_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 350Minimum Value 0Maximum Value 1024锁定的最大数量。关于如何设置和使用这个变量,请参见Section 29.7, “Performance Schema Status Monitoring”。
-
performance_schema_max_mutex_instancesCommand-Line Format --performance-schema-max-mutex-instances=#System Variable performance_schema_max_mutex_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 104857600该变量指定了可instrument的互斥锁对象的最大数量。有关如何设置和使用该变量,请参见第29.7节,“性能Schema状态监控”。
-
performance_schema_max_prepared_statements_instancesCommand-Line Format --performance-schema-max-prepared-statements-instances=#System Variable performance_schema_max_prepared_statements_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 4194304该变量指定了prepared_statements_instances表中的最大行数。如果该最大值超过,prepared statement无法instrument,Performance Schema将增加
Performance_schema_prepared_statements_lost状态变量。有关如何设置和使用该变量,请参见第29.7节,“性能Schema状态监控”。该变量的默认值是基于
max_prepared_stmt_count系统变量的值进行自动扩展。 -
performance_schema_max_rwlock_classesCommand-Line Format --performance-schema-max-rwlock-classes=#System Variable performance_schema_max_rwlock_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 100Minimum Value 0Maximum Value 1024该变量指定了rwlock instruments的最大数量。有关如何设置和使用该变量,请参见第29.7节,“性能Schema状态监控”。
-
performance_schema_max_program_instancesCommand-Line Format --performance_schema_max_program_instances=#System Variable performance_schema_max_program_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1048576performance_schema维护的存储程序统计的最大数量。如果超过该最大数量,performance_schema将增加
Performance_schema_program_lost状态变量。有关如何设置和使用该变量的信息,请参阅第29.7节,“performance_schema状态监控”。 -
performance_schema_max_rwlock_instancesCommand-Line Format --performance_schema_max_rwlock_instances=#System Variable performance_schema_max_rwlock_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 104857600performance_schema维护的rwlock对象的最大数量。有关如何设置和使用该变量的信息,请参阅第29.7节,“performance_schema状态监控”。
-
performance_schema_max_socket_classesCommand-Line Format --performance_schema_max_socket_classes=#System Variable performance_schema_max_socket_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 10Minimum Value 0Maximum Value 1024performance_schema维护的socket工具的最大数量。有关如何设置和使用该变量的信息,请参阅第29.7节,“performance_schema状态监控”。
-
performance_schema_max_socket_instancesCommand-Line Format --performance-schema-max-socket-instances=#System Variable performance_schema_max_socket_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1048576instrumented socket 对象的最大数量。有关如何设置和使用该变量的信息,请参见第29.7节,“性能 Schema 状态监控”。
-
performance_schema_max_sql_text_lengthCommand-Line Format --performance-schema-max-sql-text-length=#System Variable performance_schema_max_sql_text_lengthScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 1024Minimum Value 0Maximum Value 1048576Unit 字节 用于存储 SQL 语句的最大字节数。该值适用于以下列:
-
The
SQL_TEXT列的events_statements_current,events_statements_history, 和events_statements_history_long语句事件表。 -
The
QUERY_SAMPLE_TEXT列的events_statements_summary_by_digest摘要表。
超过
performance_schema_max_sql_text_length的字节将被截断,不会出现在列中。语句如果只在该字节后不同,将在列中变得不可 distinction。减少
performance_schema_max_sql_text_length值将减少内存使用,但将使更多语句变得不可 distinction。如果增加该值,将增加内存使用,但允许更长的语句被 distinction。 -
-
performance_schema_max_stage_classesCommand-Line Format --performance-schema-max-stage-classes=#System Variable performance_schema_max_stage_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 175Minimum Value 0Maximum Value 1024stage工具的最大数量。有关如何设置和使用该变量,请见第29.7节,“性能 Schema 状态监控”。
-
performance_schema_max_statement_classesCommand-Line Format --performance-schema-max-statement-classes=#System Variable performance_schema_max_statement_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Minimum Value 0Maximum Value 256statement工具的最大数量。有关如何设置和使用该变量,请见第29.7节,“性能 Schema 状态监控”。
默认值是在服务器构建时根据客户端/服务器协议中的命令数量和服务器支持的SQL语句类型数量计算的。
该变量不应该被更改,除非将其设置为0以禁用所有语句工具并释放与其相关的所有内存。将变量设置为非零值,除了默认值外,都是无效的;特别是大于默认值的值将分配更多的内存,但实际上不需要。
-
performance_schema_max_statement_stackCommand-Line Format --performance-schema-max-statement-stack=#System Variable performance_schema_max_statement_stackScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 10Minimum Value 1Maximum Value 256Performance Schema用于跟踪嵌套存储程序调用深度的最大值。当达到该最大值时,Performance Schema将增加
performance_schema_nested_statement_lost状态变量的值,以便跟踪每个存储程序语句的执行。 -
performance_schema_max_table_handlesCommand-Line Format --performance_schema_max_table_handles=#System Variable performance_schema_max_table_handlesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1048576打开表对象的最大数量。这一值控制着
table_handles表的大小。如果打开表对象的数量超过该最大值,使得无法对表进行instrumentation,Performance Schema 将增加Performance_schema_table_handles_lost状态变量的值。有关如何设置和使用该变量的信息,请参阅第29.7节,“性能 Schema 状态监控”。 -
performance_schema_max_table_instancesCommand-Line Format --performance_schema_max_table_instances=#System Variable performance_schema_max_table_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1048576instrumented 表对象的最大数量。有关如何设置和使用该变量的信息,请参阅第29.7节,“性能 Schema 状态监控”。
-
performance_schema_max_table_lock_statCommand-Line Format --performance_schema_max_table_lock_stat=#System Variable performance_schema_max_table_lock_statScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动扩展;不要将该字面值分配给该变量)Minimum Value -1(表示自动扩展;不要将该字面值分配给该变量)Maximum Value 1048576performance_schema锁定统计的最大表数量。如果超过这个最大值,表锁定统计将被丢失,performance_schema将增加
Performance_schema_table_lock_stat_lost状态变量。 -
performance_schema_max_thread_classesCommand-Line Format --performance-schema-max-thread-classes=#System Variable performance_schema_max_thread_classesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 100Minimum Value 0Maximum Value 1024最大线程工具数量。关于如何设置和使用该变量,请见第29.7节,“performance_schema状态监控”。
-
performance_schema_max_thread_instancesCommand-Line Format --performance-schema-max-thread-instances=#System Variable performance_schema_max_thread_instancesScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576最大线程对象数量。该值控制
threads表的大小。如果最大值超过,该线程不能被工具化,performance_schema将增加Performance_schema_thread_instances_lost状态变量。关于如何设置和使用该变量,请见第29.7节,“performance_schema状态监控”。performance_schema的
max_connections系统变量影响服务器可以运行的线程数量。performance_schema_max_thread_instances影响可以被工具化的这些运行线程数量。《
variables_by_thread》和《status_by_thread》表包含关于前台线程的系统和状态变量信息。如果performance_schema未对所有线程进行 Instrumentation,这个表将缺少一些行。在这种情况下,Performance_schema_thread_instances_lost状态变量大于零。 -
《
performance_schema_session_connect_attrs_size》Command-Line Format --performance-schema-session-connect-attrs-size=#System Variable performance_schema_session_connect_attrs_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576Unit 字节 每个线程预分配的内存量,用于存储连接属性键值对。如果客户端发送的连接属性数据的总大小超过该量,performance_schema将截断属性数据,增加
Performance_schema_session_connect_attrs_lost状态变量,并将截断信息写入错误日志,如果log_error_verbosity系统变量大于1。同时,添加一个名为_truncated的连接属性,表示截断的字节数,如果属性缓冲区有足够的空间。这使得performance_schema能够在连接属性表中暴露每个连接的截断信息,这些信息可以在不检查错误日志的情况下进行检查。《
performance_schema_session_connect_attrs_size》的默认值在服务器启动时自动调整。这可能是一个小值,因此如果截断发生(Performance_schema_session_connect_attrs_lost变为非零),您可能需要将performance_schema_session_connect_attrs_size设置为一个更大的值。虽然最大允许的
performance_schema_session_connect_attrs_size值为1MB,但是实际最大值为64KB,因为服务器对连接属性数据的总大小施加64KB的限制。如果客户端尝试发送超过64KB的属性数据,服务器将拒绝连接。有关详细信息,请参见第29.12.9节,“性能Schema连接属性表”。 -
performance_schema_setup_actors_sizeCommand-Line Format --performance-schema-setup-actors-size=#System Variable performance_schema_setup_actors_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576setup_actors表中的行数。
-
performance_schema_setup_objects_sizeCommand-Line Format --performance-schema-setup-objects-size=#System Variable performance_schema_setup_objects_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576setup_objects表中的行数。
-
performance_schema_show_processlistCommand-Line Format --performance-schema-show-processlist[={OFF|ON}]Deprecated 是 System Variable performance_schema_show_processlistScope 全局 Dynamic 是 SET_VARHint Applies否 Type 布尔 Default Value OFFThe
SHOW PROCESSLIST语句提供了进程信息,通过从所有活动线程中收集线程数据。performance_schema_show_processlist变量确定使用哪种SHOW PROCESSLIST实现:-
默认实现从线程管理器中遍历活动线程,持有全局互斥锁。这在忙碌系统中具有负面性能影响。
-
alternative
SHOW PROCESSLIST实现基于performance_schemaprocesslist表。该实现从performance_schema 中查询活动线程数据,而不是线程管理器,并且不需要互斥锁。
要启用alternative 实现,启用
performance_schema_show_processlist系统变量。为了确保默认和alternative 实现产生相同的信息,需要满足某些配置要求;请参阅 第29.12.22.7节,“The processlist 表”。 -
-
Command-Line Format --performance-schema-users-size=#System Variable performance_schema_users_sizeScope Global Dynamic No SET_VARHint AppliesNo Type Integer Default Value -1(表示自动调整;不要将该字面值分配给该变量)Minimum Value -1(表示自动调整;不要将该字面值分配给该变量)Maximum Value 1048576performance_schema 中的用户表中的行数。如果该变量为 0,performance_schema 不会维护连接统计信息在
users表中或状态变量信息在status_by_user表中。