# The MySQL sys schema
A collection of views, functions and procedures to help MySQL administrators get insight in to MySQL Database usage.
There are install files available for 5.6 and 5.7 respectively. To load these, you must position yourself within the directory that you downloaded to, as these top level files SOURCE individual files that are shared across versions in most cases (though not all).
## Overview of objects
### Tables
#### sys_config
##### Description
Holds configuration options for the sys schema. This is a persistent table, with the configuration persisting across upgrades (new options are added with `INSERT IGNORE`).
Its structure is as follows:
```SQL
+----------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+-------------------+-----------------------------+
| variable | varchar(128) | NO | PRI | NULL | |
| value | varchar(128) | YES | | NULL | |
| set_time | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| set_by | varchar(128) | YES | | NULL | |
+----------+--------------+------+-----+-------------------+-----------------------------+
```
Note, when functions check for configuration options, they first check whether a similar named user variable exists with a value, and if this is not set then pull the configuration option from this table in to that named user variable. This is done for performance reasons (to not continually `SELECT` from the table), however this comes with the side effect that once inited, the values last with the session, somewhat like how session variables are inited from global variables. If the values within this table are changed, they will not take effect until the user logs in again.
##### Options included
| Variable | Default Value | Description |
| ------------------------------------ | ------------- | ------------------------------------------------------------------------------ |
| statement_truncate_len | 64 | Sets the size to truncate statements to, for the `format_statement()` function. |
| statement_performance_analyzer.limit | 100 | The maximum number of rows to include for the views that does not have a built-in limit (e.g. the 95th percentile view). If not set the limit is 100. |
| statement_performance_analyzer.view | NULL | Used together with the 'custom' view. If the value contains a space, it is considered a query, otherwise it must be an existing view querying the performance_schema.events_statements_summary_by_digest table. |
| diagnostics.allow_i_s_tables | OFF | Specifies whether it is allowed to do table scan queries on information_schema.TABLES for the `diagnostics` procedure. |
| diagnostics.include_raw | OFF | Set to 'ON' to include the raw data (e.g. the original output of "SELECT * FROM sys.metrics") for the `diagnostics` procedure.|
| ps_thread_trx_info.max_length | 65535 | Sets the maximum output length for JSON object output by the `ps_thread_trx_info()` function. |
### Views
Many of the views in the sys schema have both a command line user friendly format output, as well as tooling friendly versions of any view that contains formatted output duplicated as an x$ table.
The examples below show output for only the formatted views, and note where there is an x$ counterpart available.
#### host_summary / x$host_summary
##### Description
Summarizes statement activity, file IO and connections by host.
When the host found is NULL, it is assumed to be a "background" thread.
##### Structures (5.7)
```SQL
mysql> desc host_summary;
+------------------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+---------------+------+-----+---------+-------+
| host | varchar(60) | YES | | NULL | |
| statements | decimal(64,0) | YES | | NULL | |
| statement_latency | text | YES | | NULL | |
| statement_avg_latency | text | YES | | NULL | |
| table_scans | decimal(65,0) | YES | | NULL | |
| file_ios | decimal(64,0) | YES | | NULL | |
| file_io_latency | text | YES | | NULL | |
| current_connections | decimal(41,0) | YES | | NULL | |
| total_connections | decimal(41,0) | YES | | NULL | |
| unique_users | bigint(21) | NO | | 0 | |
| current_memory | text | YES | | NULL | |
| total_memory_allocated | text | YES | | NULL | |
+------------------------+---------------+------+-----+---------+-------+
12 rows in set (0.15 sec)
mysql> desc x$host_summary;
+------------------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+---------------+------+-----+---------+-------+
| host | varchar(60) | YES | | NULL | |
| statements | decimal(64,0) | YES | | NULL | |
| statement_latency | decimal(64,0) | YES | | NULL | |
| statement_avg_latency | decimal(65,4) | YES | | NULL | |
| table_scans | decimal(65,0) | YES | | NULL | |
| file_ios | decimal(64,0) | YES | | NULL | |
| file_io_latency | decimal(64,0) | YES | | NULL | |
| current_connections | decimal(41,0) | YES | | NULL | |
| total_connections | decimal(41,0) | YES | | NULL | |
| unique_users | bigint(21) | NO | | 0 | |
| current_memory | decimal(63,0) | YES | | NULL | |
| total_memory_allocated | decimal(64,0) | YES | | NULL | |
+------------------------+---------------+------+-----+---------+-------+
12 rows in set (0.00 sec)
```
##### Example
```SQL
mysql> select * from host_summary;
+------+------------+-------------------+-----------------------+-------------+----------+-----------------+---------------------+-------------------+--------------+
| host | statements | statement_latency | statement_avg_latency | table_scans | file_ios | file_io_latency | current_connections | total_connections | unique_users |
+------+------------+-------------------+-----------------------+-------------+----------+-----------------+---------------------+-------------------+--------------+
| hal1 | 2924 | 00:03:59.53 | 81.92 ms | 82 | 54702 | 55.61 s | 1 | 1 | 1 |
+------+------------+-------------------+-----------------------+-------------+----------+-----------------+---------------------+-------------------+--------------+
```
#### host_summary_by_file_io / x$host_summary_by_file_io
##### Description
Summarizes file IO totals per host.
When the host found is NULL, it is assumed to be a "background" thread.
##### Structures
```SQL
mysql> desc host_summary_by_file_io;
+------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------+------+-----+---------+-------+
| host | varchar(60) | YES | | NULL | |
| ios | decimal(42,0) | YES | | NULL | |
| io_latency | text | YES | | NULL | |
+---------
没有合适的资源?快使用搜索试试~ 我知道了~
mariadb.tar.gz
需积分: 9 0 下载量 18 浏览量
2022-11-17
13:24:16
上传
评论
收藏 87.97MB GZ 举报
温馨提示
共2000个文件
test:8526个
result:8440个
h:2943个
mariadb.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
mariadb.tar.gz (2000个子文件)
sp_arm64.c 5.58MB
sp_armthumb.c 5.27MB
sp_x86_64.c 4.93MB
sp_arm32.c 4.67MB
ctype-eucjpms.c 3.48MB
ctype-ujis.c 3.47MB
nfkc50.c 2.71MB
ctype-uca.c 2.15MB
sp_c32.c 1.89MB
sp_cortexm.c 1.82MB
api.c 1.82MB
sp_c64.c 1.77MB
ctype-cp932.c 1.76MB
ctype-sjis.c 1.75MB
test.c 1.53MB
internal.c 1.23MB
asn.c 1.17MB
ssl.c 1.17MB
mysql_client_test.c 589KB
ctype-gbk.c 569KB
sp_int.c 540KB
ge_operations.c 530KB
ctype-euc_kr.c 522KB
ge_448.c 494KB
ecc.c 484KB
tls.c 430KB
pkcs7.c 420KB
aes.c 408KB
db.c 403KB
tls13.c 399KB
x509.c 392KB
ii.c 391KB
ctype-utf8.c 387KB
ctype-extra.c 372KB
ctype-big5.c 360KB
ctype-gb2312.c 343KB
evp.c 319KB
pk.c 314KB
sakke.c 313KB
expr.c 307KB
ma_loghandler.c 307KB
benchmark.c 272KB
ma_blockrec.c 251KB
mf_keycache.c 241KB
ma_check.c 238KB
mysqldump.c 229KB
armv8-curve25519_c.c 221KB
sniffer.c 210KB
ma_pagecache.c 190KB
armv8-aes.c 182KB
armv8-32-curve25519_c.c 175KB
sp_dsp32.c 173KB
armv8-32-sha512-asm_c.c 167KB
ps_bugs.c 164KB
ts_expr_node.c 163KB
mi_check.c 156KB
client.c 154KB
ps.c 147KB
rsa.c 145KB
mariadb_lib.c 141KB
libmysql.c 138KB
keys.c 134KB
server.c 133KB
tfm.c 131KB
wc_pkcs11.c 129KB
ma_dyncol.c 126KB
client.c 125KB
ma_recovery.c 125KB
mariadb_dyncol.c 123KB
integer.c 121KB
proc_select.c 119KB
proc.c 117KB
armv8-chacha.c 112KB
pat.c 110KB
groonga.c 107KB
aria_pack.c 105KB
grn_ecmascript.c 105KB
renesas_tsip_util.c 103KB
dh.c 102KB
myisampack.c 102KB
hash.c 101KB
ma_bitmap.c 100KB
wolfio.c 99KB
ctype-ucs2.c 99KB
geo.c 93KB
decimal.c 90KB
output.c 89KB
str.c 88KB
server_audit.c 86KB
bio.c 85KB
store.c 85KB
armv8-32-sha256-asm_c.c 83KB
ma_write.c 83KB
deflate.c 80KB
deflate.c 80KB
ma_charset.c 80KB
random.c 79KB
aria_chk.c 77KB
groonga_benchmark.c 77KB
rsa.c 77KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
悟世者
- 粉丝: 4076
- 资源: 159
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功