<a href="#_Toc458365216">24 MySQL sys框架... 1</a>
<a href="#_Toc458365217">24.1 sys框架的前提条件... 1</a>
<a href="#_Toc458365218">24.2 使用sys框架... 2</a>
<a href="#_Toc458365219">24.3 sys框架进度报告... 3</a>
<a href="#_Toc458365220">24.4 sys框架的对象... 3</a>
<a href="#_Toc458365221">24.4.1所有sys下的对象... 3</a>
<a href="#_Toc458365222">24.4.2 sys框架的表和触发器... 8</a>
<a href="#_Toc458365223">24.4.2.1 sys_config. 8</a>
<a href="#_Toc458365224">24.4.3 性能框架视图... 10</a>
<a href="#_Toc458365225">24.4.4 sys框架存储过程... 13</a>
<a href="#_Toc458365226">24.4.5 sys框架存储函数... 14</a>
在开始使用sys框架之前,有一些前提条件,sys需要mysql 5.6或者更高版本。因为sys是performance_schema的替代方案,performance_schema必须启动,sys才能够使用。
为了完全访问sys,需要有以下权限:
· Sys表和视图的select权限。
· Sys存储过程和函数的exec权限。
· Sys_config表的insert,update权限。
· 另外执行存储过程需要一些其他的权限,可以看存储过程的描述。
其他权限:
· Sys框架对象访问的任何performance_Schema的表的select权限,和sys框架对象更新的任何表的update权限。
· Information_schema.innodb_buffer_page的process表。
特定的performance_Schema消费者和记录点要启动:
· 所有的等待记录点
· 所有stage记录点
· 所有statement记录点
· Xxx_current和xxx_history_long消费者相关的所有事件。
你可以使用sys下面的存储过程启动所有这些选项:
CALL sys.ps_setup_enable_instrument('wait');
CALL sys.ps_setup_enable_instrument('stage');
CALL sys.ps_setup_enable_instrument('statement');
CALL sys.ps_setup_enable_consumer('current');
CALL sys.ps_setup_enable_consumer('history_long');
注意点:
对于很多sys的使用,默认的性能框架数据收集就能够满足,启动所有的记录点和消费者会对性能有一点影响,所以最好只启动你要的配置。通过这个函数也可以返回默认配置:
CALL
sys.ps_setup_reset_to_default(TRUE);
查看sys版本和mysql版本:
mysql> USE sys;
Database changed
mysql> SELECT * FROM version;
+-------------+-----------------+
| sys_version |
mysql_version |
|
1.5.0 | 5.7.9-debug-log |
Sys框架下包含了很多视图合计了性能框架的表。很多这些视图成对出现的,比如一个成员的名字和另外一个一样,只是加了x$的前缀。比如host_summary_by_file_io有个名字一样的x$host_summary_by_file_io,2个显示的单位不同。
mysql> SELECT * FROM
host_summary_by_file_io;
+------------+-------+------------+
host | ios | io_latency |
| localhost
| 67570 | 5.38 s |
| background
| 3468 | 4.18 s |
x$host_summary_by_file_io;
+------------+-------+---------------+
host | ios |
io_latency |
| 67574 | 5380678125144 |
| 3474 | 4758696829416 |
没有x$前缀的表更容易读。带x$和不带x$显示的数值是一样大的用来用具获取和处理这些数据。
可以使用show 语句或者information_schema的查询获取对象的定义比如:
mysql> SHOW CREATE VIEW session;
mysql> SHOW CREATE FUNCTION format_bytes;
mysqldump,mysqlpump默认不导出sys框架,导出sys需要显示设置:
mysqldump
--databases --routines sys > sys_dump.sql
mysqlpump sys > sys_dump.sql
导入sys结构:
mysql <
sys_dump.sql
Mysql 5.7.9,在sys下提供了长运行事务的进度报告:
Processlist
session
x$processlist
x$session
假设请求的记录点和消费者已经启动了,这些视图的progress列显示了完成的百分比。
stage进度报告要启动events_stages_current消费者,还有一些需要启动的记录点信息:
stage/sql/Copying
to tmp table
stage/innodb/alter table (end)
stage/innodb/alter table (flush)
stage/innodb/alter table (insert)
stage/innodb/alter table (log apply index)
stage/innodb/alter table (log apply table)
stage/innodb/alter table (merge sort)
stage/innodb/alter table (read PK 和 internal sort)
stage/innodb/buffer pool load
对于stage不支持简历和完成工作报告,如果请求记录点和消费者没有启动,progress列为null。
Table 24.1 sys Schema
Tables 和 Triggers
Table or
Trigger Name
Description
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-sys-config.html">sys_config</a>
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-sys-config-insert-set-user.html">sys_config_insert_set_user</a>
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-sys-config-update-set-user.html">sys_config_update_set_user</a>
View Name
Statement
activity, file I/O, 和
connections, grouped by host
File I/O,
grouped by host
grouped by host 和
event type
stages, grouped by host
statistics, grouped by host
Statements
executed, grouped by host 和
statement
InnoDB buffer information, grouped by schema
InnoDB buffer information, grouped by schema 和 table
InnoDB lock information
I/O consumers,
grouped by thread
Global I/O
consumers, grouped by file 和
bytes
latency
consumers, grouped by bytes
consumers, grouped by latency
Most recent
I/O, grouped by file 和
thread
Memory use,
grouped by user
grouped by allocation type
Total memory
use
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-metrics.html">metrics</a>
Server metrics
information
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-check-lost-instrumentation.html">ps_check_lost_instrumentation</a>
Variables that
have lost instruments
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-auto-increment-columns.html">schema_auto_increment_columns</a>
AUTO_INCREMENT column information
Index
statistics
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-object-overview.html">schema_object_overview</a>
Types of
objects within each schema
<a title="24.4.3.27 The schema_redundant_indexes and x$schema_flattened_keys Views" href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-redundant-indexes.html">schema_redundant_indexes</a>
Duplicate or
redundant indexes
Sessions
waiting for metadata locks
Table
statistics, including InnoDB buffer pool statistics
Tables being
accessed with full scans
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-unused-indexes.html">schema_unused_indexes</a>
Indexes not in
active use
information for user sessions
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-session-ssl-status.html">session_ssl_status</a>
Connection SSL
aggregate statistics
Statements that
have produced errors or warnings
have done full table scans
Statements with
highest average runtime
performed sorts
used temporary tables
User statement 和 connection
activity
grouped by user 和
event
Stage events,
statistics, grouped by user
executed, grouped by user 和
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-version.html">version</a>
versions
Wait class
average latency, grouped by event class
total latency, grouped by event class
Wait events,
grouped by event
<a title="24.4.3.38 The statements_with_runtimes_in_95th_percentile and x$statements_with_runtimes_in_95th_percentile Views" href="http://dev.mysql.com/doc/refman/5.7/en/sys-statements-with-runtimes-in-95th-percentile.html">x$ps_digest_95th_percentile_by_avg_us</a>
Helper view for
95th-percentile views
<a title="24.4.3.38 The statements_with_runtimes_in_95th_percentile and x$statements_with_runtimes_in_95th_percentile Views" href="http://dev.mysql.com/doc/refman/5.7/en/sys-statements-with-runtimes-in-95th-percentile.html">x$ps_digest_avg_latency_distribution</a>
<a title="24.4.3.29 The schema_table_statistics and x$schema_table_statistics Views" href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-table-statistics.html">x$ps_schema_table_statistics_io</a>
table-statistics views
<a title="24.4.3.27 The schema_redundant_indexes and x$schema_flattened_keys Views" href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-redundant-indexes.html">x$schema_flattened_keys</a>
Helper view
Procedure Name
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-create-synonym-db.html">create_synonym_db()</a>
Create synonym
for schema
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-diagnostics.html">diagnostics()</a>
Collect system
diagnostic information
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-execute-prepared-stmt.html">execute_prepared_stmt()</a>
Execute
prepared statement
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-disable-background-threads.html">ps_setup_disable_background_threads()</a>
Disable
background thread instrumentation
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-disable-consumer.html">ps_setup_disable_consumer()</a>
consumers
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-disable-instrument.html">ps_setup_disable_instrument()</a>
instruments
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-disable-thread.html">ps_setup_disable_thread()</a>
instrumentation for thread
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-enable-background-threads.html">ps_setup_enable_background_threads()</a>
Enable
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-enable-consumer.html">ps_setup_enable_consumer()</a>
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-enable-instrument.html">ps_setup_enable_instrument()</a>
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-enable-thread.html">ps_setup_enable_thread()</a>
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-reload-saved.html">ps_setup_reload_saved()</a>
Reload saved
Performance Schema configuration
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-reset-to-default.html">ps_setup_reset_to_default()</a>
Reset saved
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-save.html">ps_setup_save()</a>
Save
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-disabled.html">ps_setup_show_disabled()</a>
Display
disabled Performance Schema configuration
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-disabled-consumers.html">ps_setup_show_disabled_consumers()</a>
disabled Performance Schema consumers
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-disabled-instruments.html">ps_setup_show_disabled_instruments()</a>
disabled Performance Schema instruments
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-enabled.html">ps_setup_show_enabled()</a>
Display enabled
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-enabled-consumers.html">ps_setup_show_enabled_consumers()</a>
Performance Schema consumers
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-enabled-instruments.html">ps_setup_show_enabled_instruments()</a>
Performance Schema instruments
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-statement-avg-latency-histogram.html">ps_statement_avg_latency_histogram()</a>
statement latency histogram
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-trace-statement-digest.html">ps_trace_statement_digest()</a>
Trace
Performance Schema instrumentation for digest
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-trace-thread.html">ps_trace_thread()</a>
Dump
Performance Schema data for thread
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-truncate-all-tables.html">ps_truncate_all_tables()</a>
Truncate
Performance Schema summary tables
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-statement-performance-analyzer.html">statement_performance_analyzer()</a>
Report of
statements running on server
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-table-exists.html">table_exists()</a>
Whether a table
exists
Function Name
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-extract-schema-from-file-name.html">extract_schema_from_file_name()</a>
Extract schema
name from file path name
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-extract-table-from-file-name.html">extract_table_from_file_name()</a>
Extract table
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-format-bytes.html">format_bytes()</a>
Convert byte
value to value with units
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-format-path.html">format_path()</a>
Replace data 和 temp-file
directories in path name with symbolic values
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-format-statement.html">format_statement()</a>
Truncate long
statement to fixed length
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-format-time.html">format_time()</a>
Convert
picoseconds value to value with units
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-list-add.html">list_add()</a>
Add item to
list
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-list-drop.html">list_drop()</a>
Remove item
from list
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-account-enabled.html">ps_is_account_enabled()</a>
Check whether
account instrumentation is enabled
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-consumer-enabled.html">ps_is_consumer_enabled()</a>
consumer is enabled
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-instrument-default-enabled.html">ps_is_instrument_default_enabled()</a>
instrument is enabled
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-instrument-default-timed.html">ps_is_instrument_default_timed()</a>
instrument is timed
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-thread-instrumented.html">ps_is_thread_instrumented()</a>
thread is instrumented
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-thread-account.html">ps_thread_account()</a>
Return account
for thread ID
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-thread-id.html">ps_thread_id()</a>
Return thread
ID for connection ID
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-thread-stack.html">ps_thread_stack()</a>
Return event
information for thread ID
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-thread-trx-info.html">ps_thread_trx_info()</a>
Return
transaction information for thread ID
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-quote-identifier.html">quote_identifier()</a>
Return string
as quoted identifier
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-sys-get-config.html">sys_get_config()</a>
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-version-major.html">version_major()</a>
MySQL server
major version number
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-version-minor.html">version_minor()</a>
minor version number
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-version-patch.html">version_patch()</a>
patch release version number
Sys_config表列:
·
Variable:配置选项
value:选项的值
set_time:最近一次修改时间。
set_by:最近一次修改用户
为了最小化直接读取sys_config表的影响,sys框架下的函数用来检查用户定义的变量和相关的名字,这个名字使用变量以@sys.为前缀。如果当前会话有用户定义的变量部位null,那么就优先使用变量上的长度。否则就读取表上的值:
mysql> SET @stmt = 'SELECT variable, value,
set_time, set_by FROM sys_config';
mysql> SELECT format_statement(@stmt);
+----------------------------------------------------------+
format_statement(@stmt)
| SELECT
variable, value, set_time, set_by FROM sys_config |
mysql> SET @sys.statement_truncate_len = 32;
+-----------------------------------+
format_statement(@stmt)
| SELECT variabl
... ROM sys_config |
之后会话中的会继续使用变量的32,而不是使用表里面的64。
为了停止变量的使用可以使用以下语句,取消或者关闭当前会话:
mysql> SET @sys.statement_truncate_len =
NULL;
变量可以在会话结束前生效,如果sys_config在会话中被修改,这个修改不会体现在会话上,除非会话结束。
Sys_config和变量的配置值:
diagnostics.all_i_s_tables, @sys.diagnostics.all_i_s_tables
如果选项为on,diagnostics()过程允许对information_schema.tables表进行扫描。如果表很多这个操作花费就比较大。
diagnostics.include_raw,@sys. diagnostics.include_raw
如果选项为on,diagnostics()过程包含了metrics视图输出的原生数据。默认为off。
ps_thread_trx_info.max_length,@sys. ps_thread_trx_info.max_length
ps_thread_trx_info()函数输出的最大json的长度。
statement_performance_analyzer.limit,@sys.statement_performance_analyzer.limit
视图返回的最大行数,编译没有限制。最大为100.
statement_performance_analyzer.view,@sys.statement_performance_analyzer.view
statement_performance_analyzer()过程使用到的视图和查询。如果选项值包含了空间就表示是一个查询,否则必须是events_statements_summary_by_digest表上的视图。如果上面的limit>0就不能有limit子句。默认我null。
statement_truncate_len,
@sys.statement_truncate_len
format_statement()函数返回的最大语句长度,长的语句会被截断,默认64.
其他选项可以通过sys_config表添加。比如diagnostics(),execute_prepared_stmt()的调试选项,但是不是sys_config的默认有的选项:
mysql> INSERT INTO sys_config (variable,
value) VALUES('debug', 'ON');
修改debug信息:
mysql> UPDATE sys_config SET value = 'OFF'
WHERE variable = 'debug';
mysql> SET @sys.debug = NULL;
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-host-summary.html">host_summary 和 x$host_summary Views</a>
视图显示了语句活动,文件io和连接信息,由host分组
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-host-summary-by-file-io.html">host_summary_by_file_io 和 x$host_summary_by_file_io Views</a>
视图总计了文件io,由host分组
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-host-summary-by-file-io-type.html">host_summary_by_file_io_type 和 x$host_summary_by_file_io_type Views</a>
视图总计了文件io,由host和event类型分组。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-host-summary-by-stages.html">host_summary_by_stages 和 x$host_summary_by_stages Views</a>
总计语句stage,由host分组
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-host-summary-by-statement-latency.html">host_summary_by_statement_latency 和 x$host_summary_by_statement_latency Views</a>
总计语句的统计信息,由host分组
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-host-summary-by-statement-type.html">host_summary_by_statement_type 和 x$host_summary_by_statement_type Views</a>
总计语句的执行,由host和语句类型分组
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-innodb-buffer-stats-by-schema.html">innodb_buffer_stats_by_schema 和 x$innodb_buffer_stats_by_schema Views</a>
统计information_schema.innodb_buffer_page,由schema分组,object_schema为对象的schema,如果为innodb表属于innodb system。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-innodb-buffer-stats-by-table.html">innodb_buffer_stats_by_table 和 x$innodb_buffer_stats_by_table Views</a>
统计information_schema.innodb_buffer_page,由表名分组。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-innodb-lock-waits.html">innodb_lock_waits 和 x$innodb_lock_waits Views</a>
总计了innodb锁等待。列如下:
wait_started:等待开始事件。
wait_age:等待锁的时间长度。
wait_age_secs:等待了多少秒。
locked_table:被锁定的表。
locked_index:被锁的索引
locked_type:锁等待类型
waiting_trx_started:等待事务的开始事件。
waiting_trx_age:等待事务等待时间。
waiting_trx_rows_locked:等待事务锁定的行锁个数。
……
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-io-by-thread-by-latency.html">io_by_thread_by_latency 和 x$io_by_thread_by_latency Views</a>
总计了IO消费者显示了线程的IO等待。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-io-global-by-file-by-bytes.html">io_global_by_file_by_bytes 和 x$io_global_by_file_by_bytes Views</a>
总计了IO消费者显示每个文件的读写量,由文件分组
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-io-global-by-file-by-latency.html">io_global_by_file_by_latency 和 x$io_global_by_file_by_latency Views</a>
总结io消费者显示io次数和延迟事件,由文件分组
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-io-global-by-wait-by-bytes.html">io_global_by_wait_by_bytes 和 x$io_global_by_wait_by_bytes Views</a>
每个event的总io字节。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-io-global-by-wait-by-latency.html">io_global_by_wait_by_latency 和 x$io_global_by_wait_by_latency Views</a>
每个event的总io次数和io等待时间
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-latest-file-io.html">latest_file_io 和 x$latest_file_io Views</a>
总计活动的文件IO,由文件和线程分组。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-memory-by-host-by-current-bytes.html">memory_by_host_by_current_bytes 和 x$memory_by_host_by_current_bytes Views</a>
总计host使用的总内存
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-memory-by-thread-by-current-bytes.html">memory_by_thread_by_current_bytes 和 x$memory_by_thread_by_current_bytes Views</a>
线程的内存使用
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-memory-by-user-by-current-bytes.html">memory_by_user_by_current_bytes 和 x$memory_by_user_by_current_bytes Views</a>
总计用户使用的内存
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-memory-global-by-current-bytes.html">memory_global_by_current_bytes 和 x$memory_global_by_current_bytes Views</a>
每个分配类型分配的内存
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-memory-global-total.html">memory_global_total 和 x$memory_global_total Views</a>
服务的总内存使用
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-metrics.html">metrics View</a>
视图总计mysql服务的指标,显示变量名,变量值,类型和他们的启动情况。视图在mysql 5.7.9被添加,视图主要包含信息:
o
全局的状态变量,来至于global_status表。
来自information_schema.global_status.Innodb指标
当前和所有内存分配
当前时间
有一些在global_status和innodb_status中有重复的指标,metrics视图会进行消除。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-processlist.html">processlist 和 x$processlist Views</a>
比show processlist返回的信息更加详细
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-check-lost-instrumentation.html">ps_check_lost_instrumentation View</a>
返回丢失的性能框架记录点,显示是否性能框架可以跟踪所有数据。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-auto-increment-columns.html">schema_auto_increment_columns View</a>
视图显示了有auto_increment的列,并且提供了有用的信息。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-index-statistics.html">schema_index_statistics 和 x$schema_index_statistics Views</a>
视图提供的所有统计信息
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-object-overview.html">schema_object_overview View</a>
schema下对象统计
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-redundant-indexes.html">schema_redundant_indexes 和 x$schema_flattened_keys Views</a>
显示了冗余的索引
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-table-lock-waits.html">schema_table_lock_waits 和 x$schema_table_lock_waits Views</a>
显示了哪些会话被元数据锁锁定,什么锁定了它们
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-table-statistics.html">schema_table_statistics 和 x$schema_table_statistics Views</a>
表操作的统计,io和延迟的统计
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-table-statistics-with-buffer.html">schema_table_statistics_with_buffer 和 x$schema_table_statistics_with_buffer Views</a>
表操作的统计,io和延迟的统计,和内存的分配
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-tables-with-full-table-scans.html">schema_tables_with_full_table_scans 和 x$schema_tables_with_full_table_scans Views</a>
显示了哪些表被表扫描访问
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-schema-unused-indexes.html">schema_unused_indexes View</a>
未使用过的索引
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-session.html">session 和 x$session Views</a>
和processlist相似但是不显示后台进程
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-session-ssl-status.html">session_ssl_status View</a>
对于每个连接显示SSL版本,chipher和count
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-statement-analysis.html">statement_analysis 和 x$statement_analysis Views</a>
显示了语句的执行情况,执行次数,响应行数,延迟等
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-statements-with-errors-or-warnings.html">statements_with_errors_or_warnings 和 x$statements_with_errors_or_warnings Views</a>
语句的错误或者警告
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-statements-with-full-table-scans.html">statements_with_full_table_scans 和 x$statements_with_full_table_scans Views</a>
用到了表扫描的语句
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-statements-with-runtimes-in-95th-percentile.html">statements_with_runtimes_in_95th_percentile和 x$statements_with_runtimes_in_95th_percentile Views</a>
runtimes在95%以内的语句
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-statements-with-sorting.html">statements_with_sorting 和 x$statements_with_sorting Views</a>
执行了排序的语句
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-statements-with-temp-tables.html">statements_with_temp_tables 和 x$statements_with_temp_tables Views</a>
使用了临时表的语句
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-user-summary.html">user_summary 和 x$user_summary Views</a>
用户总计信息,包含语句,文件io,连接
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-user-summary-by-file-io.html">user_summary_by_file_io 和 x$user_summary_by_file_io Views</a>
用户文件io总计
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-user-summary-by-file-io-type.html">user_summary_by_file_io_type 和 x$user_summary_by_file_io_type Views</a>
用户文件io类型总计
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-user-summary-by-stages.html">user_summary_by_stages 和 x$user_summary_by_stages Views</a>
用户stage事件总计
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-user-summary-by-statement-latency.html">user_summary_by_statement_latency 和 x$user_summary_by_statement_latency Views</a>
用户在执行语句上的延迟
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-user-summary-by-statement-type.html">user_summary_by_statement_type 和 x$user_summary_by_statement_type Views</a>
用户在语句类型上的延迟
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-version.html">version View</a>
版本
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-wait-classes-global-by-avg-latency.html">wait_classes_global_by_avg_latency 和 x$wait_classes_global_by_avg_latency Views</a>
等待类型延迟汇总,由平均延迟排序
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-wait-classes-global-by-latency.html">wait_classes_global_by_latency 和 x$wait_classes_global_by_latency Views</a>
等待类型延迟汇总,由总延迟排序
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-waits-by-host-by-latency.html">waits_by_host_by_latency 和 x$waits_by_host_by_latency Views</a>
host,等待事件延迟汇总
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-waits-by-user-by-latency.html">waits_by_user_by_latency 和 x$waits_by_user_by_latency Views</a>
用户等待事件延迟
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-waits-global-by-latency.html">waits_global_by_latency 和 x$waits_global_by_latency Views</a>
等待事件延迟。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-create-synonym-db.html">The create_synonym_db() Procedure</a>
创建一个别名数据库,指向被引用的数据库,使用视图指向被引用数据库的表
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-diagnostics.html">The diagnostics() Procedure</a>
当前服务器的状态,包含了mysql服务版本信息,系统变量,innodb状态,processlist,内存使用信息,performance_schema状态,和一些状态信息。输出到diag.out文件
以已准备好的语句,来执行。准备好的语句在执行完成后被释放,所以并不能重用。可以用来执行的动态语句。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-disable-background-threads.html">The ps_setup_disable_background_threads() Procedure</a>
禁止后台进程的所有性能框架记录点
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-disable-consumer.html">The ps_setup_disable_consumer() Procedure</a>
禁用某个消费者
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-disable-instrument.html">The ps_setup_disable_instrument() Procedure</a>
禁用记录点
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-disable-thread.html">The ps_setup_disable_thread() Procedure</a>
根据连接id,禁用某个线程
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-enable-background-threads.html">The ps_setup_enable_background_threads() Procedure</a>
启动后台线程的性能框架记录
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-enable-consumer.html">The ps_setup_enable_consumer() Procedure</a>
启动某个性能框架消费者
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-enable-instrument.html">The ps_setup_enable_instrument() Procedure</a>
启动某个性能框架记录点
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-enable-thread.html">The ps_setup_enable_thread() Procedure</a>
启动某个连接id对应线程的记录点
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-reload-saved.html">The ps_setup_reload_saved() Procedure</a>
重新加载性能框架配置,使用之前ps_setup_save保存的配置
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-reset-to-default.html">The ps_setup_reset_to_default() Procedure</a>
重置到默认配置
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-save.html">The ps_setup_save() Procedure</a>
保存性能框架配置,这样可以根据调试要求先调整,然后恢复
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-disabled.html">The ps_setup_show_disabled() Procedure</a>
显示当前所有禁用的配置
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-disabled-consumers.html">The ps_setup_show_disabled_consumers() Procedure</a>
显示所有禁用的消费者
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-disabled-instruments.html">The ps_setup_show_disabled_instruments() Procedure</a>
显示禁用的记录点
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-enabled.html">The ps_setup_show_enabled() Procedure</a>
显示启动的性能框架配置
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-enabled-consumers.html">The ps_setup_show_enabled_consumers() Procedure</a>
显示启动的消费者
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-setup-show-enabled-instruments.html">The ps_setup_show_enabled_instruments() Procedure</a>
显示启动的记录点
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-statement-avg-latency-histogram.html">The ps_statement_avg_latency_histogram() Procedure</a>
直方图显示语句的平均延迟
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-trace-statement-digest.html">The ps_trace_statement_digest() Procedure</a>
跟踪指定语句digest的所有性能记录点。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-trace-thread.html">The ps_trace_thread() Procedure</a>
指定连接id的所有性能记录点
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-truncate-all-tables.html">The ps_truncate_all_tables() Procedure</a>
清空所有性能框架summary表
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-statement-performance-analyzer.html">The statement_performance_analyzer() Procedure</a>
创建语句在服务端上运行的报表
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-table-exists.html">The table_exists() Procedure</a>
判断是否存在表,视图,临时表
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-extract-schema-from-file-name.html">The extract_schema_from_file_name() Function</a>
根据文件路径获取对应的数据库名
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-extract-table-from-file-name.html">The extract_table_from_file_name() Function</a>
根据文件路径获取表名
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-format-bytes.html">The format_bytes() Function</a>
给字节数,转化为可读的格式
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-format-path.html">The format_path() Function</a>
文件路径格式化
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-format-statement.html">The format_statement() Function</a>
格式化语句输出,输出长度和statement_truncate_len配置有关。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-format-time.html">The format_time() Function</a>
时间格式化
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-list-add.html">The list_add() Function</a>
增加一个由逗号隔开的队列中。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-list-drop.html">The list_drop() Function</a>
从逗号隔开的队列的队列中删除一个元素
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-account-enabled.html">The ps_is_account_enabled() Function</a>
判断账号是否启动
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-consumer-enabled.html">The ps_is_consumer_enabled() Function</a>
判断消费者是否启动
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-instrument-default-enabled.html">The ps_is_instrument_default_enabled() Function</a>
判断记录点是否默认启动
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-instrument-default-timed.html">The ps_is_instrument_default_timed() Function</a>
给定记录点默认是否是被计时的。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-is-thread-instrumented.html">The ps_is_thread_instrumented() Function</a>
判断连接id对应的性能框架记录点启动
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-thread-account.html">The ps_thread_account() Function</a>
给定连接id,判断线程启动的用户。
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-thread-id.html">The ps_thread_id() Function</a>
给定连接id返回线程id
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-thread-stack.html">The ps_thread_stack() Function</a>
给定线程id,返回json格式的语句,stages,events的stack
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-ps-thread-trx-info.html">The ps_thread_trx_info() Function</a>
返回线程id的事务和已经执行的语句
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-quote-identifier.html">The quote_identifier() Function</a>
引用分隔符
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-sys-get-config.html">The sys_get_config() Function</a>
获取sys_config表的数据
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-version-major.html">The version_major() Function</a>
mysql主版本
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-version-minor.html">The version_minor() Function</a>
mysql次版本
<a href="http://dev.mysql.com/doc/refman/5.7/en/sys-version-patch.html">The version_patch() Function</a>
mysql补丁号