mysql(四)使用pt-query-digest分析慢查询日志

目录

  • pt-query-digest简介
  • pt-query-digest安装
  • pt-query-digest的使用
    • 使用说明
    • 使用示例
    • pt-query-digest 分析慢日志
      • 检查数据库慢查询的相关配置
      • 分析 pt-query-digest 输出结果
        • 第一部分:输出结果的总体信息
        • 第二部分:输出队列组的统计信息
        • 第三部分:输出每列查询的详细信息
      • 将分析可视化

由于数据的写入量非常大,所以要想直接打开慢查询日志来查看到底哪些语句有问题几乎是不可能的,因为日志的刷新速度太快了,此时我们可以使用 Percona Toolkit中的 pt-query-digest来解决这个问题

pt-query-digest简介

用于分析MySQL慢查询的一个工具,它也可以分析binlog、General log、slowlog,也可以通过SHOWPROCESSLIST或者通过tcpdump抓取的mysql协议数据来进行分析。可以把分析结果输出到文件中,分析过程是先对查询语句的条件进行参数化,然后对参数化以后的查询进行分组统计,统计出各查询的执行时间、次数、占比等,可以借助分析结果找出问题进行优化

pt-query-digest安装

下载网址

下载Percona Toolkit

[root@VM-4-2-centos /]# wget https://www.percona.com/downloads/percona-toolkit/3.2.1/binary/redhat/7/x86_64/percona-toolkit-3.2.1-1.el7.x86_64.rpm

PT 工具是使用 Perl 语言编写和执行的,所以需要系统中有 Perl 环境。安装相关的依赖包

[root@VM-4-2-centos /]# yum install perl-DBI.x86_64
[root@VM-4-2-centos /]# yum install perl-DBD-MySQL.x86_64
[root@VM-4-2-centos /]# yum install perl-IO-Socket-SSL.noarch
[root@VM-4-2-centos /]# yum install perl-Digest-MD5.x86_64
[root@VM-4-2-centos /]# yum install perl-TermReadKey.x86_64

安装 Percona Toolkit

[root@VM-4-2-centos /]# rpm -iv percona-toolkit-3.2.1-1.el7.x86_64.rpm
warning: percona-toolkit-3.2.1-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 8507efa5: NOKEY
Preparing packages...
percona-toolkit-3.2.1-1.el7.x86_64

pt-query-digest的使用

使用说明

shell> pt-query-digest [OPTIONS] [DSN]
详情可参考
shell>pt-query-digest --help

常用参数:
--create-review-table :当使用--review参数把分析结果输出到表中时,如果没有表就自动创建。
--create-history-table:当使用--history参数把分析结果输出到表中时,如果没有表就自动创建。
--filter :  对输入的慢查询按指定的字符串进行匹配过滤后再进行分析
--limit:限制输出结果百分比或数量,默认值是20,即将最慢的20条语句输出,如果是95%则按总响应时间占比从大到小排序,输出到总和达到95%位置截止。
--log=s :指定输出的日志文件
--history 将分析结果保存到表中,分析结果比较详细,下次再使用--history时,如果存在相同的语句,且查询所在的时间区间和历史表
           中的不同,则会记录到数据表中,可以通过查询同一CHECKSUM来比较某类型查询的历史变化。
--review:将分析结果保存到表中,这个分析只是对查询条件进行参数化,一个类型的查询一条记录,比较简单。
           当下次使用--review时,如果存在相同的语句分析,就不会记录到数据表中。
--output 分析结果输出类型,值可以是report(标准分析报告)slowlog(Mysql slow log)、json、json-anon,一般使用report,以便于阅读。
--since:从该指定日期开始分析。
--until:截止时间,配合—since可以分析一段时间内的慢查询。

使用示例

  • pt-query-digest分析慢查询日志
[root@VM-4-2-centos /] pt-query-digest VM-4-2-centos-slow.log
  • 报告最近半个小时的慢查询
[root@VM-4-2-centos /] pt-query-digest --report --since 1800s VM-4-2-centos-slow.log
  • 报告一个时间段的慢查询
[root@VM-4-2-centos /]pt-query-digest --report --since '2013-02-10 21:48:59' --until '2013-02-16 02:33:50' VM-4-2-centos-slow.log
  • 报告只含select语句的慢查询
[root@VM-4-2-centos /] pt-query-digest --filter '$event->{fingerprint} =~ m/^select/i' VM-4-2-centos-slow.log
  • 报告针对某个用户的慢查询
[root@VM-4-2-centos /] pt-query-digest --filter '($event->{user} || "") =~ m/^root/i' VM-4-2-centos-slow.log
  • 报告所有的全表扫描或full join的慢查询
[root@VM-4-2-centos /] pt-query-digest --filter '(($event->{Full_scan} || "") eq "yes") || (($event->{Full_join} || "") eq "yes")' VM-4-2-centos-slow.log
  • 把查询保存到query_review表
[root@VM-4-2-centos /] pt-query-digest --user=root –password=abc123 --review h=localhost,D=test,t=query_review 
                       --create-review-table  VM-4-2-centos-slow.log
  • 把查询保存到query_history表
[root@VM-4-2-centos /] pt-query-digest --user=root –password=abc123 --history  h=localhost,D=test,t=query_history
                       --create-history-table  VM-4-2-centos-slow.log
  • 通过tcpdump抓取mysql的tcp协议数据,然后再分析
[root@VM-4-2-centos /] tcpdump -s 65535 -x -nn -q -tttt -i any -c 1000 port 3306 > mysql.tcp.txt
[root@VM-4-2-centos /] pt-query-digest --type tcpdump mysql.tcp.txt> VM-4-2-centos-slow.log
  • 分析binlog
[root@VM-4-2-centos /] mysqlbinlog mysql-bin.000093 > mysql-bin000093.sql
[root@VM-4-2-centos /] pt-query-digest --type=binlog mysql-bin000093.sql > VM-4-2-centos-slow.log
  • 分析general log
[root@VM-4-2-centos /] pt-query-digest --type=genlog localhost.log > slow_report.log

pt-query-digest 分析慢日志

检查数据库慢查询的相关配置

mysql> show variables like '%slow%';
+-----------------------------+---------------------------------------+
| Variable_name               | Value                                 |
+-----------------------------+---------------------------------------+
| log_slow_admin_statements   | OFF                                   |
| log_slow_extra              | OFF                                   |
| log_slow_replica_statements | OFF                                   |
| log_slow_slave_statements   | OFF                                   |
| slow_launch_time            | 2                                     |
| slow_query_log              | ON                                    |
| slow_query_log_file         | /var/lib/mysql/VM-4-2-centos-slow.log |
+-----------------------------+---------------------------------------+
7 rows in set (0.01 sec)

mysql> show variables like '%long_query_time%';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| long_query_time | 0.001000 |
+-----------------+----------+
1 row in set (0.00 sec)

分析 pt-query-digest 输出结果

[root@VM-4-2-centos mysql]# pt-query-digest VM-4-2-centos-slow.log 

# 150ms user time, 10ms system time, 26.06M rss, 220.51M vsz
# Current date: Sat Jul 15 16:27:57 2023
# Hostname: VM-4-2-centos
# Files: VM-4-2-centos-slow.log
# Overall: 21 total, 11 unique, 0.04 QPS, 0.00x concurrency ______________
# Time range: 2023-07-15T08:20:04 to 2023-07-15T08:27:53
# Attribute          total     min     max     avg     95%  stddev  median
# ============     ======= ======= ======= ======= ======= ======= =======
# Exec time          254ms     1ms   110ms    12ms     7ms    30ms     1ms
# Lock time           42ms     1us    42ms     2ms     5us     9ms     1us
# Rows sent          2.94k       0     499  143.57  487.09  219.42    0.99
# Rows examine       3.00k       0     499  146.29  487.09  217.79    5.75
# Query size         1.33k      11     564   64.67   88.31  121.28   28.75

# Profile
# Rank Query ID                          Response time Calls R/Call V/M   
# ==== ================================= ============= ===== ====== ===== 
#    1 0x5FECA91B35719611A595F86DCD01...  0.1102 43.5%     1 0.1102  0.00 TRUNCATE TABLE performance_schema.host_cache
#    2 0x1F3AEFC36986D2A154FB11940933...  0.1062 41.9%     1 0.1062  0.00 SET
#    3 0xE77769C62EF669AA7DD5F6760F2D...  0.0115  4.5%     5 0.0023  0.00 SHOW VARIABLES
#    4 0xF9734574CDDDC5D231DA25F95494...  0.0070  2.8%     6 0.0012  0.00 SHOW STATUS
#    5 0xF6C6D60B8B46C010445D20E44CF5...  0.0069  2.7%     1 0.0069  0.00 SHOW TABLE STATUS
# MISC 0xMISC                             0.0116  4.6%     7 0.0017   0.0 <6 ITEMS>

# Query 1: 0 QPS, 0x concurrency, ID 0x5FECA91B35719611A595F86DCD014D64 at byte 614
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-07-15T08:25:26
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          4       1
# Exec time     43   110ms   110ms   110ms   110ms   110ms       0   110ms
# Lock time      0    18us    18us    18us    18us    18us       0    18us
# Rows sent      0       0       0       0       0       0       0       0
# Rows examine   0       0       0       0       0       0       0       0
# Query size     3      44      44      44      44      44       0      44
# String:
# Hosts        localhost
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms
#  10ms
# 100ms  ################################################################
#    1s
#  10s+
# Tables
#    SHOW TABLE STATUS FROM `performance_schema` LIKE 'host_cache'\G
#    SHOW CREATE TABLE `performance_schema`.`host_cache`\G
TRUNCATE TABLE performance_schema.host_cache\G

# Query 2: 0 QPS, 0x concurrency, ID 0x1F3AEFC36986D2A154FB1194093381DB at byte 0
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-07-15T08:20:04
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          4       1
# Exec time     41   106ms   106ms   106ms   106ms   106ms       0   106ms
# Lock time     99    42ms    42ms    42ms    42ms    42ms       0    42ms
# Rows sent      0       0       0       0       0       0       0       0
# Rows examine   0       0       0       0       0       0       0       0
# Query size     2      28      28      28      28      28       0      28
# String:
# Hosts        localhost
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms
#  10ms
# 100ms  ################################################################
#    1s
#  10s+
SET GLOBAL slow_query_log=ON\G

# Query 3: 0.01 QPS, 0.00x concurrency, ID 0xE77769C62EF669AA7DD5F6760F2D2EBB at byte 847
# Scores: V/M = 0.00
# Time range: 2023-07-15T08:20:13 to 2023-07-15T08:25:47
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         23       5
# Exec time      4    12ms     1ms     4ms     2ms     4ms   847us     2ms
# Lock time      0     7us     1us     2us     1us     1us       0     1us
# Rows sent      0      13       1       7    2.60    6.98    2.25    1.96
# Rows examine   0      13       1       7    2.60    6.98    2.25    1.96
# Query size    11     156      28      34   31.20   33.28    2.49   28.75
# String:
# Databases    dxl
# Hosts        171.217.167.186 (4/80%), localhost (1/20%)
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms  ################################################################
#  10ms
# 100ms
#    1s
#  10s+
SHOW VARIABLES LIKE 'lower_case_%'\G

# Query 4: 0.06 QPS, 0.00x concurrency, ID 0xF9734574CDDDC5D231DA25F95494CA95 at byte 4391
# Scores: V/M = 0.00
# Time range: 2023-07-15T08:26:14 to 2023-07-15T08:27:53
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         28       6
# Exec time      2     7ms     1ms     1ms     1ms     1ms    42us     1ms
# Lock time      0    11us     1us     2us     1us     1us       0     1us
# Rows sent     99   2.92k     499     499     499     499       0     499
# Rows examine  97   2.92k     499     499     499     499       0     499
# Query size     4      66      11      11      11      11       0      11
# String:
# Databases    dxl
# Hosts        171.217.167.186
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms  ################################################################
#  10ms
# 100ms
#    1s
#  10s+
SHOW STATUS\G

# Query 5: 0 QPS, 0x concurrency, ID 0xF6C6D60B8B46C010445D20E44CF56324 at byte 3027
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-07-15T08:25:41
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          4       1
# Exec time      2     7ms     7ms     7ms     7ms     7ms       0     7ms
# Lock time      0     6us     6us     6us     6us     6us       0     6us
# Rows sent      0       1       1       1       1       1       0       1
# Rows examine   0       6       6       6       6       6       0       6
# Query size     1      17      17      17      17      17       0      17
# String:
# Databases    dxl
# Hosts        171.217.167.186
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms  ################################################################
#  10ms
# 100ms
#    1s
#  10s+
SHOW TABLE STATUS\G

第一部分:输出结果的总体信息

# 150ms user time, 10ms system time, 26.06M rss, 220.51M vsz 
说明:
执行过程中在用户中所花费的所有时间
执行过程中内核空间中所花费的所有时间
pt-query-digest进程所分配的内存大小
pt-query-digest进程所分配的虚拟内存大小

# Current date: Sat Jul 15 16:27:57 2023 
说明:当前日期

# Hostname: VM-4-2-centos
说明:执行pt-query-digest的主机名

# Files: VM-4-2-centos-slow.log
说明:被分析的文件名

# Overall: 21 total, 11 unique, 0.04 QPS, 0.00x concurrency ______________
说明:语句总数量,唯一语句数量,每秒查询量,查询的并发

# Time range: 2023-07-15T08:20:04 to 2023-07-15T08:27:53
说明:执行过程中日志记录的时间范围

# Attribute          total     min     max     avg     95%  stddev  median
说明:属性           总计     最小值  最大值  平均值   95%  标准差  中位数
# ============     ======= ======= ======= ======= ======= ======= =======

# Exec time           363s     1ms   183ms    10ms    23ms     8ms     8ms
说明:执行时间
# Lock time             1s       0    34ms    35us    38us   603us       0
说明:锁占用时间
# Rows sent        182.14k       0     100    4.98    0.99   21.06       0
说明:发送到客户端的行数
# Rows examine     491.83k       0   1.02k   13.45   97.36   56.85       0
说明:扫描的语句行数
# Query size        19.82M       5 511.96k  554.80   72.65  16.25k    5.75 
说明:查询的字符数

第二部分:输出队列组的统计信息

# Profile
# Rank Query ID                          Response time Calls R/Call V/M   
# ==== ================================= ============= ===== ====== ===== 
#    1 0x5FECA91B35719611A595F86DCD01...  0.1102 43.5%     1 0.1102  0.00 TRUNCATE TABLE performance_schema.host_cache
#    2 0x1F3AEFC36986D2A154FB11940933...  0.1062 41.9%     1 0.1062  0.00 SET
#    3 0xE77769C62EF669AA7DD5F6760F2D...  0.0115  4.5%     5 0.0023  0.00 SHOW VARIABLES
#    4 0xF9734574CDDDC5D231DA25F95494...  0.0070  2.8%     6 0.0012  0.00 SHOW STATUS
#    5 0xF6C6D60B8B46C010445D20E44CF5...  0.0069  2.7%     1 0.0069  0.00 SHOW TABLE STATUS
# MISC 0xMISC 
  • rank:所有语句的排名,默认按照查找时间降序排列
  • Query ID:语句ID信息
  • Response:响应时间
  • time:本次查询在分析中所占的用时间比例
  • Calls:执行次数,在本次分析中,一共有多少条这种类型的查询语句
  • R/Call:平均每次执行的响应时间
  • V/M:响应时间Variance-to-mean的比率

第三部分:输出每列查询的详细信息

# Query 1: 0 QPS, 0x concurrency, ID 0x5FECA91B35719611A595F86DCD014D64 at byte 614
说明:查询队列1:每秒查询量,查询的并发,队列1ID值,614:表示文中偏移量(查看方法在下面‘偏1’中)
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-07-15T08:25:26
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          4       1
# Exec time     43   110ms   110ms   110ms   110ms   110ms       0   110ms
# Lock time      0    18us    18us    18us    18us    18us       0    18us
# Rows sent      0       0       0       0       0       0       0       0
# Rows examine   0       0       0       0       0       0       0       0
# Query size     3      44      44      44      44      44       0      44
# String:
# Hosts        localhost
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms
#  10ms
# 100ms  ################################################################
#    1s
#  10s+
说明:查询时间分布
# Tables
#    SHOW TABLE STATUS FROM `performance_schema` LIKE 'host_cache'\G
#    SHOW CREATE TABLE `performance_schema`.`host_cache`\G
TRUNCATE TABLE performance_schema.host_cache\G
说明:执行的慢语句信息
# Query 2: 0 QPS, 0x concurrency, ID 0x1F3AEFC36986D2A154FB1194093381DB at byte 0
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-07-15T08:20:04
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          4       1
# Exec time     41   106ms   106ms   106ms   106ms   106ms       0   106ms
# Lock time     99    42ms    42ms    42ms    42ms    42ms       0    42ms
# Rows sent      0       0       0       0       0       0       0       0
# Rows examine   0       0       0       0       0       0       0       0
# Query size     2      28      28      28      28      28       0      28
# String:
# Hosts        localhost
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms
#  10ms
# 100ms  ################################################################
#    1s
#  10s+
SET GLOBAL slow_query_log=ON\G

# Query 3: 0.01 QPS, 0.00x concurrency, ID 0xE77769C62EF669AA7DD5F6760F2D2EBB at byte 847
# Scores: V/M = 0.00
# Time range: 2023-07-15T08:20:13 to 2023-07-15T08:25:47
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         23       5
# Exec time      4    12ms     1ms     4ms     2ms     4ms   847us     2ms
# Lock time      0     7us     1us     2us     1us     1us       0     1us
# Rows sent      0      13       1       7    2.60    6.98    2.25    1.96
# Rows examine   0      13       1       7    2.60    6.98    2.25    1.96
# Query size    11     156      28      34   31.20   33.28    2.49   28.75
# String:
# Databases    dxl
# Hosts        171.217.167.186 (4/80%), localhost (1/20%)
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms  ################################################################
#  10ms
# 100ms
#    1s
#  10s+
SHOW VARIABLES LIKE 'lower_case_%'\G

# Query 4: 0.06 QPS, 0.00x concurrency, ID 0xF9734574CDDDC5D231DA25F95494CA95 at byte 4391
# Scores: V/M = 0.00
# Time range: 2023-07-15T08:26:14 to 2023-07-15T08:27:53
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         28       6
# Exec time      2     7ms     1ms     1ms     1ms     1ms    42us     1ms
# Lock time      0    11us     1us     2us     1us     1us       0     1us
# Rows sent     99   2.92k     499     499     499     499       0     499
# Rows examine  97   2.92k     499     499     499     499       0     499
# Query size     4      66      11      11      11      11       0      11
# String:
# Databases    dxl
# Hosts        171.217.167.186
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms  ################################################################
#  10ms
# 100ms
#    1s
#  10s+
SHOW STATUS\G

# Query 5: 0 QPS, 0x concurrency, ID 0xF6C6D60B8B46C010445D20E44CF56324 at byte 3027
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-07-15T08:25:41
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          4       1
# Exec time      2     7ms     7ms     7ms     7ms     7ms       0     7ms
# Lock time      0     6us     6us     6us     6us     6us       0     6us
# Rows sent      0       1       1       1       1       1       0       1
# Rows examine   0       6       6       6       6       6       0       6
# Query size     1      17      17      17      17      17       0      17
# String:
# Databases    dxl
# Hosts        171.217.167.186
# Users        root
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms  ################################################################
#  10ms
# 100ms
#    1s
#  10s+
SHOW TABLE STATUS\G

偏 1:
可以利用偏移量在慢查询日志文件中到查找到具体的 SQL 语句,查找方法如下:

[root@VM-4-2-centos mysql]# tail -c +614 ./VM-4-2-centos-slow.log | head
# Time: 2023-07-15T08:25:26.727081Z
# User@Host: root[root] @ localhost []  Id: 15344
# Query_time: 0.110240  Lock_time: 0.000018 Rows_sent: 0  Rows_examined: 0
SET timestamp=1689409526;
TRUNCATE TABLE performance_schema.host_cache;
# Time: 2023-07-15T08:25:37.530706Z
# User@Host: root[root] @  [171.217.167.186]  Id: 15346
# Query_time: 0.003786  Lock_time: 0.000002 Rows_sent: 2  Rows_examined: 2
SET timestamp=1689409537;
SHOW VARIABLES LIKE 'lower_case_%';

将分析可视化

使用pt-query-digest分析慢查询日志并将查询分析数据保存到MySQL数据库表中.然后使用应用程序来展示分析结果.
目前有基于LAMP的Query-Digest-UIAnemometer开源项目支持。

将慢日志插入表中:
shell> pt-query-digest --user=root --password=abc224 --review h='10.10.10.134',D=test,t=global_query_review --history h='10.10.10.134',D=test,t=global_query_review_history --no-report --create-review-table --create-history-table --limit=20% slowquery.log

或者
shell> pt-query-digest --user=root --password=abc224 --review h='10.10.10.134',D=test,t=global_query_review --no-report --create-review-table slowquery.log


shell> pt-query-digest --user=root --password=abc224 --history h='10.10.10.134',D=test,t=global_query_review_history --no-report --create-history-table slowquery.log


mysql> select * from global_query_review limit 2 \G
*************************** 1. row ***************************
   checksum: 300935684267402542
fingerprint: call test.confixinverstweek
     sample: CALL test.confixinverstweek('2014-07-01','2014-07-10',0.0060)
 first_seen: 2014-07-09 14:35:29
  last_seen: 2014-07-14 08:04:11
reviewed_by: NULL
reviewed_on: NULL
   comments: NULL

mysql> select * from global_query_review_history limit 1 \G
*************************** 1. row ***************************
                    checksum: 300935684267402542
                      sample: CALL test.confixinverstweek('2014-07-01','2014-07-10',0.0060)
                      ts_min: 2014-07-09 14:35:29
                      ts_max: 2014-07-14 08:04:11
                      ts_cnt: 4
              Query_time_sum: 419674
              Query_time_min: 13882.8
              Query_time_max: 227433
           Query_time_pct_95: 216908
           Query_time_stddev: 90097.8
           Query_time_median: 189384
               Lock_time_sum: 0
               Lock_time_min: 0
               Lock_time_max: 0
            Lock_time_pct_95: 0
            Lock_time_stddev: 0
            Lock_time_median: 0
               Rows_sent_sum: 0
               Rows_sent_min: 0
               Rows_sent_max: 0
            Rows_sent_pct_95: 0
            Rows_sent_stddev: 0
            Rows_sent_median: 0
           Rows_examined_sum: 0
           Rows_examined_min: 0
           Rows_examined_max: 0
        Rows_examined_pct_95: 0
        Rows_examined_stddev: 0
        Rows_examined_median: 0
           Rows_affected_sum: NULL
           Rows_affected_min: NULL
           Rows_affected_max: NULL
        Rows_affected_pct_95: NULL
        Rows_affected_stddev: NULL
        Rows_affected_median: NULL
               Rows_read_sum: NULL
               Rows_read_min: NULL
               Rows_read_max: NULL
            Rows_read_pct_95: NULL
            Rows_read_stddev: NULL
            Rows_read_median: NULL
            Merge_passes_sum: NULL
            Merge_passes_min: NULL
            Merge_passes_max: NULL
         Merge_passes_pct_95: NULL
         Merge_passes_stddev: NULL
         Merge_passes_median: NULL
         InnoDB_IO_r_ops_min: NULL
         InnoDB_IO_r_ops_max: NULL
      InnoDB_IO_r_ops_pct_95: NULL
      InnoDB_IO_r_ops_stddev: NULL
      InnoDB_IO_r_ops_median: NULL
       InnoDB_IO_r_bytes_min: NULL
       InnoDB_IO_r_bytes_max: NULL
    InnoDB_IO_r_bytes_pct_95: NULL
    InnoDB_IO_r_bytes_stddev: NULL
    InnoDB_IO_r_bytes_median: NULL
        InnoDB_IO_r_wait_min: NULL
        InnoDB_IO_r_wait_max: NULL
     InnoDB_IO_r_wait_pct_95: NULL
     InnoDB_IO_r_wait_stddev: NULL
     InnoDB_IO_r_wait_median: NULL
    InnoDB_rec_lock_wait_min: NULL
    InnoDB_rec_lock_wait_max: NULL
 InnoDB_rec_lock_wait_pct_95: NULL
 InnoDB_rec_lock_wait_stddev: NULL
 InnoDB_rec_lock_wait_median: NULL
       InnoDB_queue_wait_min: NULL
       InnoDB_queue_wait_max: NULL
    InnoDB_queue_wait_pct_95: NULL
    InnoDB_queue_wait_stddev: NULL
    InnoDB_queue_wait_median: NULL
   InnoDB_pages_distinct_min: NULL
   InnoDB_pages_distinct_max: NULL
InnoDB_pages_distinct_pct_95: NULL
InnoDB_pages_distinct_stddev: NULL
InnoDB_pages_distinct_median: NULL
                  QC_Hit_cnt: NULL
                  QC_Hit_sum: NULL
               Full_scan_cnt: NULL
               Full_scan_sum: NULL
               Full_join_cnt: NULL
               Full_join_sum: NULL
               Tmp_table_cnt: NULL
               Tmp_table_sum: NULL
       Tmp_table_on_disk_cnt: NULL
       Tmp_table_on_disk_sum: NULL
                Filesort_cnt: NULL
                Filesort_sum: NULL
        Filesort_on_disk_cnt: NULL
        Filesort_on_disk_sum: NULL
1 row in set (0.00 sec)

参考:

https://zhuanlan.zhihu.com/p/257975998
https://blog.csdn.net/yu757371316/article/details/77076376

你可能感兴趣的:(数据库,mysql,数据库)