性能模式实现了 several 系统变量,以提供配置信息:
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 节,“性能模式选项和变量参考”。
性能模式在服务器启动时自动调整其参数的值,如果它们没有被明确设置。有关更多信息,请参阅 第 29.3 节,“性能模式启动配置”。
性能模式系统变量具有以下含义:
-
Command-Line Format --performance-schema[={OFF|ON}]System Variable performance_schemaScope 全局 Dynamic 否 SET_VARHint Applies否 Type 布尔值 Default Value ON该变量的值是
ON或OFF,以指示性能模式是否启用。默认情况下,该值为ON。在服务器启动时,可以指定该变量无值或值为ON或 1 以启用它,或者值为OFF或 0 以禁用它。即使性能模式被禁用,它仍然会填充
global_variables、session_variables、global_status和session_status表。这是为了允许SHOW VARIABLES和SHOW STATUS语句从这些表中获取结果。性能模式还填充了一些复制表,即使它被禁用。 -
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 Global Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576最大行数在
events_statements_summary_by_digest表中。如果超过这个最大值,以至于无法instrument某个摘要,性能模式将增加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 Global Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整大小;不要将其设置为该literal值)Minimum Value -1(表示自动调整大小;不要将其设置为该literal值)Maximum Value 1048576表
events_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 Global Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整大小;不要将其设置为该literal值)Minimum Value -1(表示自动调整大小;不要将其设置为该literal值)Maximum Value 1024每个线程在表
events_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 Global Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整大小;不要将其设置为该literal值)Minimum Value -1(表示自动调整大小;不要将其设置为该literal值)Maximum Value 1048576表
events_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 1048576表
events_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 1048576表
events_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 1048576仪器条件对象的最大数量。有关如何设置和使用该变量的信息,请参阅 第 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 节,“服务器系统变量” 中该变量的描述。有关语句摘要的更多信息,包括内存使用的考虑,请参阅第 29.10 节,“性能架构语句摘要和采样”。
-
performance_schema_max_digest_sample_ageCommand-Line Format --performance-schema-max-digest-sample-age=#System Variable performance_schema_max_digest_sample_ageScope 全局 Dynamic 是 SET_VARHint Applies否 Type 整数 Default Value 60Minimum Value 0Maximum Value 1048576Unit 秒 该变量影响语句采样对于
events_statements_summary_by_digest表。当新表行被插入时,产生该行摘要值的语句被存储为当前采样语句关联的摘要。然后,当服务器看到具有相同摘要值的其他语句时,它确定是否使用新语句来替换当前采样语句(即是否重新采样)。重新采样策略基于当前采样语句和新语句的比较等待时间,以及可选地,当前采样语句的年龄:-
基于等待时间的重新采样:如果新语句的等待时间大于当前采样语句的等待时间,则它将成为当前采样语句。
-
基于年龄的重新采样:如果
performance_schema_max_digest_sample_age系统变量的值大于零且当前采样语句的年龄超过该值,则当前语句被认为“太老”并被新语句替换。这甚至发生在新语句的等待时间小于当前采样语句的等待时间的情况下。
有关语句采样的更多信息,请参阅第 29.10 节,“性能架构语句摘要和采样”。
-
-
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 节,“性能架构状态监控”。
-
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 节,“性能架构状态监控”。
performance_schema_max_file_handles的值应该大于open_files_limit的值:open_files_limit影响服务器可以支持的最大打开文件句柄数,而performance_schema_max_file_handles影响这些文件句柄中可以被仪器的数量。 -
Command-Line Format --performance-schema-max-file-instances=#System Variable 性能模式最大文件实例数Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576instrumented 文件对象的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。
-
Command-Line Format --performance-schema-max-index-stat=#System Variable 性能模式最大索引统计Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整大小;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576性能模式维护统计的最大索引数量。如果超过这个最大值,以至于索引统计丢失,性能模式将增加
Performance_schema_index_stat_lost状态变量。默认值是使用performance_schema_max_table_instances的值自动调整大小。 -
Command-Line Format --performance-schema-max-memory-classes=#System Variable 性能模式最大内存类Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 470Default Value 450Minimum Value 0Maximum Value 1024内存仪器的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。
-
Command-Line Format --performance-schema-max-metadata-locks=#System Variable 性能模式最大元数据锁Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 10485760元数据锁仪器的最大数量。如果超过这个最大值,以至于元数据锁无法被仪器,性能模式将增加
Performance_schema_metadata_lock_lost状态变量。 -
Command-Line Format --performance-schema-max-meter-classes=#System Variable 性能模式最大仪表类Scope 全局 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 1024mutex 仪表的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能架构状态监控”。
-
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 104857600instrumented mutex 对象的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能架构状态监控”。
-
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 4194304prepared_statements_instances 表中的最大行数。如果超过这个最大值,以至于无法instrument prepared 语句,性能架构将增加
Performance_schema_prepared_statements_lost状态变量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能架构状态监控”。该变量的默认值是根据
max_prepared_stmt_count系统变量的值自动调整的。 -
performance_schema_max_rwlock_classesCommand-Line Format --performance-schema-max-rwlock-classes=#System Variable 性能模式最大读写锁类Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 100Minimum Value 0Maximum Value 1024读写锁仪器的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。
-
Command-Line Format --performance-schema-max-program-instances=#System Variable 性能模式最大程序实例Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576性能模式维护统计信息的存储程序的最大数量。如果超过这个最大值,性能模式将增加
性能模式程序丢失状态变量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。 -
Command-Line Format --performance-schema-max-rwlock-instances=#System Variable 性能模式最大读写锁实例Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动调整大小;不要分配这个文字值)Minimum Value -1(表示自动调整大小;不要分配这个文字值)Maximum Value 104857600仪器读写锁对象的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。
-
Command-Line Format --performance-schema-max-socket-classes=#System Variable 性能模式最大套接字类Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 10Minimum Value 0Maximum Value 1024套接字仪器的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。
-
Command-Line Format --performance-schema-max-socket-instances=#System Variable 性能模式最大套接字实例Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576仪器套接字对象的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。
-
Command-Line Format --性能模式最大SQL文本长度=#System Variable 性能模式最大SQL文本长度Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 1024Minimum Value 0Maximum Value 1048576Unit 字节 用于存储SQL语句的最大字节数。该值适用于以下列的存储要求:
-
当前语句事件表
events_statements_current、events_statements_history和events_statements_history_long的SQL_TEXT列。 -
语句摘要表
events_statements_summary_by_digest的QUERY_SAMPLE_TEXT列。
超过
性能模式最大SQL文本长度的字节将被丢弃,不会出现在该列中。只有在该列中不同的语句将变得不可区分。降低
性能模式最大SQL文本长度的值将减少内存使用,但会使更多的语句变得不可区分。如果语句只有末尾部分不同。增加该值将增加内存使用,但允许更长的语句变得可区分。 -
-
Command-Line Format --性能模式最大阶段类别数=#System Variable 性能模式最大阶段类别数Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 175Minimum Value 0Maximum Value 1024最大阶段仪器数量。有关如何设置和使用该变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。
-
Command-Line Format --性能模式最大语句类别数=#System Variable 性能模式最大语句类别数Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Minimum Value 0Maximum Value 256最大语句仪器数量。有关如何设置和使用该变量的信息,请参阅 第 29.7 节,“性能模式状态监控”。
默认值是在服务器构建时根据客户端/服务器协议中的命令数和服务器支持的 SQL 语句类型计算的。
除非将其设置为 0 以禁用所有语句仪器并释放相关内存,否则不应更改该变量。将变量设置为默认值以外的非零值没有任何益处;特别是,较大值将分配更多的内存,而不是必要的。
-
Command-Line Format --性能模式最大语句堆栈=#System Variable 性能架构最大语句堆栈Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 10Minimum Value 1Maximum Value 256性能架构维护统计信息的最大嵌套存储程序调用深度。当达到此最大值时,性能架构将增加
Performance_schema_nested_statement_lost状态变量,每个存储程序语句执行一次。 -
Command-Line Format --performance-schema-max-table-handles=#System Variable 性能架构最大表句柄Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576打开表对象的最大数量。此值控制
表句柄表的大小。如果超过这个最大值,以至于无法instrument表句柄,性能架构将增加Performance_schema_table_handles_lost状态变量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能架构状态监控”。 -
Command-Line Format --performance-schema-max-table-instances=#System Variable 性能架构最大表实例Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576instrumented 表对象的最大数量。有关如何设置和使用此变量的信息,请参阅 第 29.7 节,“性能架构状态监控”。
-
Command-Line Format --performance-schema-max-table-lock-stat=#System Variable 性能架构最大表锁统计Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576性能架构维护锁统计信息的最大表数量。如果超过这个最大值,以至于锁统计信息丢失,性能架构将增加
Performance_schema_table_lock_stat_lost状态变量。 -
Command-Line Format --performance-schema-max-thread-classes=#System Variable 性能架构最大线程类别Scope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value 100Minimum Value 0Maximum Value 1024线程仪器的最大数量。有关如何设置和使用此变量的信息,请参阅第 29.7 节,“性能架构状态监控”。
-
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_thread_instances_lost状态变量。有关如何设置和使用此变量的信息,请参阅第 29.7 节,“性能架构状态监控”。服务器的
max_connections系统变量影响服务器中可以运行的线程数量。performance_schema_max_thread_instances影响这些运行线程中可以被仪器化的数量。性能架构的
variables_by_thread和status_by_thread表仅包含前台线程的系统和状态变量信息。如果不是所有线程都被性能架构仪器化,这个表将缺少一些行。在这种情况下,Performance_schema_thread_instances_lost状态变量将大于零。 -
performance_schema_session_connect_attrs_sizeCommand-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_session_connect_attrs_lost状态变量,并在错误日志中写入一条消息,指示截断发生,如果log_error_verbosity系统变量大于 1。还将添加一个名为_truncated的属性,以指示丢失的字节数,如果属性缓冲区有足够的空间。这使性能架构能够在连接属性表中公开每个连接的截断信息,而不需要检查错误日志。默认值
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的属性数据,服务器将拒绝连接。有关更多信息,请参阅第29.12.9节,“性能模式连接属性表”。 -
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 1048576表
setup_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 1048576表
setup_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 OFF语句
SHOW PROCESSLIST提供了进程信息,通过从所有活动线程中收集线程数据。performance_schema_show_processlist变量确定使用哪种SHOW PROCESSLIST实现:-
默认实现会在线程管理器中遍历活动线程,同时持有全局互斥锁。这在繁忙的系统上会产生负面性能后果。
-
备用
SHOW PROCESSLIST实现基于性能模式processlist表。该实现从性能模式中查询活动线程数据,而不需要互斥锁。
要启用替代实现,请启用
performance_schema_show_processlist系统变量。为了确保默认和替代实现产生相同的信息,一些配置要求必须满足;见 第 29.12.22.7 节,“进程列表表”。 -
-
Command-Line Format --performance-schema-users-size=#System Variable performance_schema_users_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Type 整数 Default Value -1(表示自动缩放;不要分配这个文字值)Minimum Value -1(表示自动缩放;不要分配这个文字值)Maximum Value 1048576表
users中的行数。如果这个变量为 0,性能模式不会在users表中维护连接统计信息或在status_by_user表中维护状态变量信息。