性能模式实现了几个提供配置信息的系统变量:
mysql>显示变量为“perf%”;+----------------------------------------------------------+-------+ | Variable_name |值 | +----------------------------------------------------------+-------+ | 上performance_schema | | | performance_schema_accounts_size | 1 | | performance_schema_digests_size | 10000 | | 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 | 80 | | performance_schema_max_cond_instances | 1 | | performance_schema_max_digest_length | 1024 | |performance_schema_max_file_classes 50 | | | performance_schema_max_file_handles | 32768 | | performance_schema_max_file_instances | 1 | | performance_schema_max_index_stat | 1 | | performance_schema_max_memory_classes | 320 | | performance_schema_max_metadata_locks | 1 | | performance_schema_max_mutex_classes | 200 | | performance_schema_max_mutex_instances | 1 | | performance_schema_max_prepared_statements_instances | 1 | | performance_schema_max_program_instances | 1 | |performance_schema_max_rwlock_classes 40 | | | 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 | 150 | | performance_schema_max_statement_classes | 192 | | 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 50 | | | 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_users_size | 1 | +----------------------------------------------------------+-------+
性能架构系统变量可以在服务器启动时在命令行或选项文件中设置,许多变量可以在运行时设置。看到第25.13节“性能模式选项和变量参考”.
如果在服务器启动时没有显式设置,Performance Schema会自动调整其几个参数的值。有关更多信息,请参见第25.3节,“性能模式启动配置”.
Performance Schema系统变量含义如下:
-
命令行格式 ——performance-schema[={|在}]
系统变量 performance_schema
范围 全球 动态 没有 类型 布尔 默认值 在
这个变量的值是
在
或从
以指示是否启用性能架构。缺省值是在
.在服务器启动时,可以不指定此变量的值,也可以指定值为在
或1来启用它,或值为从
或者0来禁用它。即使禁用了性能模式,它也会继续填充
global_variables
,session_variables
,global_status
,session_status
表。的结果是必要的显示变量
而且显示状态
的设置,从这些表中绘制的语句show_compatibiliy_56
系统变量。 performance_schema_accounts_size
命令行格式 ——performance-schema-accounts-size = #
系统变量 performance_schema_accounts_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)最小值 -1
(意味着自动定量;不要分配此文字值)最大值 1048576
中的行数
账户
表格如果此变量为0,则性能架构不维护连接统计信息账户
中的表或状态变量信息status_by_account
表格performance_schema_digests_size
命令行格式 ——performance-schema-digests-size = #
系统变量 performance_schema_digests_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)最小值 -1
最大值 1048576
中的最大行数
events_statements_summary_by_digest
表格如果超过这个最大值,以至于不能对摘要进行仪器化,则性能模式将增加Performance_schema_digest_lost
状态变量。有关语句摘要的更多信息,请参见第25.10节“性能架构语句摘要”.
performance_schema_events_stages_history_long_size
命令行格式 ——performance-schema-events-stages-history-long-size = #
系统变量 performance_schema_events_stages_history_long_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)performance_schema_events_stages_history_size
命令行格式 ——performance-schema-events-stages-history-size = #
系统变量 performance_schema_events_stages_history_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)中的每个线程的行数
events_stages_history
表格performance_schema_events_statements_history_long_size
命令行格式 ——performance-schema-events-statements-history-long-size = #
系统变量 performance_schema_events_statements_history_long_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)performance_schema_events_statements_history_size
命令行格式 ——performance-schema-events-statements-history-size = #
系统变量 performance_schema_events_statements_history_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)中的每个线程的行数
events_statements_history
表格performance_schema_events_transactions_history_long_size
命令行格式 ——performance-schema-events-transactions-history-long-size = #
系统变量 performance_schema_events_transactions_history_long_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)performance_schema_events_transactions_history_size
命令行格式 ——performance-schema-events-transactions-history-size = #
系统变量 performance_schema_events_transactions_history_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)中的每个线程的行数
events_transactions_history
表格performance_schema_events_waits_history_long_size
命令行格式 ——performance-schema-events-waits-history-long-size = #
系统变量 performance_schema_events_waits_history_long_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)performance_schema_events_waits_history_size
命令行格式 ——performance-schema-events-waits-history-size = #
系统变量 performance_schema_events_waits_history_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)中的每个线程的行数
events_waits_history
表格-
命令行格式 ——performance-schema-hosts-size = #
系统变量 performance_schema_hosts_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)最小值 -1
(意味着自动定量;不要分配此文字值)最大值 1048576
中的行数
主机
表格如果此变量为0,则性能架构不维护连接统计信息主机
中的表或状态变量信息status_by_host
表格 performance_schema_max_cond_classes
命令行格式 ——performance-schema-max-cond-classes = #
系统变量 performance_schema_max_cond_classes
范围 全球 动态 没有 类型 整数 默认值 80
最小值 0
最大值 256
条件仪器的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_cond_instances
命令行格式 ——performance-schema-max-cond-instances = #
系统变量 performance_schema_max_cond_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)仪器化条件对象的最大数目。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_digest_length
命令行格式 ——performance-schema-max-digest-length = #
系统变量 performance_schema_max_digest_length
范围 全球 动态 没有 类型 整数 默认值 1024
最小值 0
最大值 1048576
在性能模式中为计算规范化语句摘要值而保留的每个语句的最大内存字节数。这个变量与
max_digest_length
;该变量的描述见第5.1.7节,“服务器系统变量”.有关语句消化的更多信息,包括关于内存使用的注意事项,请参见第25.10节“性能架构语句摘要”.
performance_schema_max_file_classes
命令行格式 ——performance-schema-max-file-classes = #
系统变量 performance_schema_max_file_classes
范围 全球 动态 没有 类型 整数 默认值 80
最小值 0
最大值 256
文件仪器的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_file_handles
命令行格式 ——performance-schema-max-file-handles = #
系统变量 performance_schema_max_file_handles
范围 全球 动态 没有 类型 整数 默认值 32768
打开的文件对象的最大数目。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
的价值
performance_schema_max_file_handles
应该大于的值open_files_limit
:open_files_limit
影响服务器可支持的打开文件句柄的最大数量performance_schema_max_file_handles
影响可以检测这些文件句柄的数量。performance_schema_max_file_instances
命令行格式 ——performance-schema-max-file-instances = #
系统变量 performance_schema_max_file_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)检测文件对象的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_index_stat
命令行格式 ——performance-schema-max-index-stat = #
系统变量 performance_schema_max_index_stat
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)性能架构维护统计信息的索引的最大数目。如果超过此最大值,索引统计信息将丢失,则性能模式将增加
Performance_schema_index_stat_lost
状态变量。的值自动调整默认值performance_schema_max_table_instances
.performance_schema_max_memory_classes
命令行格式 ——performance-schema-max-memory-classes = #
系统变量 performance_schema_max_memory_classes
范围 全球 动态 没有 类型 整数 默认值 320
存储器的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_metadata_locks
命令行格式 ——performance-schema-max-metadata-locks = #
系统变量 performance_schema_max_metadata_locks
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)元数据锁定设备的最大数量。控件的大小
metadata_locks
表格如果超过这个最大值,以致元数据锁不能被仪器化,则性能架构将增加Performance_schema_metadata_lock_lost
状态变量。performance_schema_max_mutex_classes
命令行格式 ——performance-schema-max-mutex-classes = #
系统变量 performance_schema_max_mutex_classes
范围 全球 动态 没有 类型 整数 默认值 200
最小值 0
最大值 256
互斥设备的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_mutex_instances
命令行格式 ——performance-schema-max-mutex-instances = #
系统变量 performance_schema_max_mutex_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)仪器化互斥对象的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_prepared_statements_instances
命令行格式 ——performance-schema-max-prepared-statements-instances = #
系统变量 performance_schema_max_prepared_statements_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)中的最大行数
prepared_statements_instances
表格如果超过了这个最大值,以至于准备好的语句不能被仪器化,性能模式将增加Performance_schema_prepared_statements_lost
状态变量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.的值自动调整此变量的默认值
max_prepared_stmt_count
系统变量。performance_schema_max_rwlock_classes
命令行格式 ——performance-schema-max-rwlock-classes = #
系统变量 performance_schema_max_rwlock_classes
范围 全球 动态 没有 类型 整数 默认值(≥5.7.25) 50
默认值(≤5.7.24) 40
最小值 0
最大值 256
rwlock仪器的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_program_instances
命令行格式 ——performance-schema-max-program-instances = #
系统变量 performance_schema_max_program_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)性能架构维护统计信息的存储程序的最大数目。如果超过此最大值,则性能架构将增加
Performance_schema_program_lost
状态变量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.performance_schema_max_rwlock_instances
命令行格式 ——performance-schema-max-rwlock-instances = #
系统变量 performance_schema_max_rwlock_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)测试rwlock对象的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_socket_classes
命令行格式 ——performance-schema-max-socket-classes = #
系统变量 performance_schema_max_socket_classes
范围 全球 动态 没有 类型 整数 默认值 10
最小值 0
最大值 256
插座仪器的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_socket_instances
命令行格式 ——performance-schema-max-socket-instances = #
系统变量 performance_schema_max_socket_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)仪器化套接字对象的最大数目。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_sql_text_length
命令行格式 ——performance-schema-max-sql-text-length = #
系统变量 performance_schema_max_sql_text_length
范围 全球 动态 没有 类型 整数 默认值 1024
最小值 0
最大值 1048576
数据库中用于存储SQL语句的最大字节数
SQL_TEXT
列的events_statements_current
,events_statements_history
,events_statements_history_long
语句事件表。超过的任何字节performance_schema_max_sql_text_length
都被丢弃而不出现在SQL_TEXT
列。在这个列中,只有在多个初始字节之后才不同的语句是无法区分的。减少了
performance_schema_max_sql_text_length
值减少了内存的使用,但如果只在最后不同,则会导致更多语句变得不可区分。增加该值会增加内存使用量,但允许区分较长的语句。performance_schema_max_stage_classes
命令行格式 ——performance-schema-max-stage-classes = #
系统变量 performance_schema_max_stage_classes
范围 全球 动态 没有 类型 整数 默认值 150
最小值 0
最大值 256
舞台乐器的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_statement_classes
命令行格式 ——performance-schema-max-statement-classes = #
系统变量 performance_schema_max_statement_classes
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)报表工具的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
默认值是在服务器构建时根据客户机/服务器协议中的命令数量和服务器支持的SQL语句类型的数量计算的。
不应更改此变量,除非将其设置为0以禁用所有语句插装并保存与之相关的所有内存。将该变量设置为默认值以外的非零值没有任何好处;特别是,大于默认值会导致分配比所需更多的内存。
performance_schema_max_statement_stack
命令行格式 ——performance-schema-max-statement-stack = #
系统变量 performance_schema_max_statement_stack
范围 全球 动态 没有 类型 整数 默认值 10
Performance Schema维护统计信息所需的嵌套存储程序的最大深度。超过此最大值时,性能架构将增加
Performance_schema_nested_statement_lost
执行的每个存储程序语句的状态变量。performance_schema_max_table_handles
命令行格式 ——performance-schema-max-table-handles = #
系统变量 performance_schema_max_table_handles
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)打开的表对象的最大数目。控件的大小
table_handles
表格如果超过此最大值,以致表句柄不能被仪器化,则性能模式将增加Performance_schema_table_handles_lost
状态变量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.performance_schema_max_table_instances
命令行格式 ——performance-schema-max-table-instances = #
系统变量 performance_schema_max_table_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)仪器化表对象的最大数目。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_table_lock_stat
命令行格式 ——performance-schema-max-table-lock-stat = #
系统变量 performance_schema_max_table_lock_stat
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)性能模式维护锁统计信息的最大表数。如果超过此最大值,以致表锁统计信息丢失,则性能模式将增加
Performance_schema_table_lock_stat_lost
状态变量。performance_schema_max_thread_classes
命令行格式 ——performance-schema-max-thread-classes = #
系统变量 performance_schema_max_thread_classes
范围 全球 动态 没有 类型 整数 默认值 50
最小值 0
最大值 256
螺纹仪器的最大数量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.
performance_schema_max_thread_instances
命令行格式 ——performance-schema-max-thread-instances = #
系统变量 performance_schema_max_thread_instances
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)仪器化线程对象的最大数量。控件的大小
线程
表格如果超过此最大值,以致线程无法进行仪器化,则性能架构将增加Performance_schema_thread_instances_lost
状态变量。有关如何设置和使用此变量的信息,请参见第25.7节“性能模式状态监控”.的
max_connections
系统变量影响服务器中可以运行的线程数。performance_schema_max_thread_instances
影响这些正在运行的线程中有多少可以插装。的
variables_by_thread
而且status_by_thread
表只包含前台线程的系统和状态变量信息。如果不是所有线程都被性能模式检测,则该表可能会遗漏一些行。在这种情况下,Performance_schema_thread_instances_lost
状态变量大于零。performance_schema_session_connect_attrs_size
命令行格式 ——performance-schema-session-connect-attrs-size = #
系统变量 performance_schema_session_connect_attrs_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着autosizing;不要分配此文字值)最小值 -1
最大值 1048576
每个线程预留用于保存连接属性键-值对的预分配内存量。如果客户端发送的连接属性数据的总大小大于此数量,则性能模式将截断属性数据,并增加
Performance_schema_session_connect_attrs_lost
状态变量,并向错误日志写入一条消息,指示发生截断log_error_verbosity
系统变量值大于1。的默认值。
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的属性数据,服务器将拒绝连接。有关更多信息,请参见第25.12.9节“性能架构连接属性表”.performance_schema_setup_actors_size
命令行格式 ——performance-schema-setup-actors-size = #
系统变量 performance_schema_setup_actors_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)中的行数
setup_actors
表格performance_schema_setup_objects_size
命令行格式 ——performance-schema-setup-objects-size = #
系统变量 performance_schema_setup_objects_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)中的行数
setup_objects
表格-
命令行格式 ——performance-schema-users-size = #
系统变量 performance_schema_users_size
范围 全球 动态 没有 类型 整数 默认值 -1
(意味着自动定量;不要分配此文字值)最小值 -1
(意味着自动定量;不要分配此文字值)最大值 1048576
中的行数
用户
表格如果此变量为0,则性能架构不维护连接统计信息用户
中的表或状态变量信息status_by_user
表格