为什么pt-query-digest不显示所有查询?

时间:2019-10-07 09:34:24

标签: mysql pt-query-digest

我有一个带有2个唯一查询的MySql慢查询日志。但是pt-query-digest仅显示1个唯一查询,并且查询总数包括这两个查询。

我已从日志中删除了一些数据。替换为“” MySql慢日志:

Time                 Id Command    Argument
# Time: 191005 18:22:54
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    18
# Query_time: 17.970162  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
use <empty>;
SET timestamp=1570296174;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191005 18:23:32
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    18
# Query_time: 37.812570  Lock_time: 0.000000 Rows_sent: 654896  Rows_examined: 654896
SET timestamp=1570296212;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191005 22:24:35
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    19
# Query_time: 16.641931  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570310675;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191005 22:25:12
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    19
# Query_time: 36.510373  Lock_time: 0.000000 Rows_sent: 654886  Rows_examined: 654886
SET timestamp=1570310712;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191006  2:26:11
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    20
# Query_time: 16.360659  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570325171;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191006  2:26:45
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    20
# Query_time: 33.732895  Lock_time: 0.000000 Rows_sent: 654912  Rows_examined: 654912
SET timestamp=1570325205;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191006  4:00:22
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    21
# Query_time: 17.319935  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570330822;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191006  4:00:57
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    21
# Query_time: 35.099691  Lock_time: 0.000000 Rows_sent: 654912  Rows_examined: 654912
SET timestamp=1570330857;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191006  6:27:42
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    22
# Query_time: 16.641898  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570339662;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191006  6:28:18
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    22
# Query_time: 35.899780  Lock_time: 0.000000 Rows_sent: 654912  Rows_examined: 654912
SET timestamp=1570339698;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191006 10:29:15
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    23
# Query_time: 16.454418  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570354155;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191006 10:29:48
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    23
# Query_time: 33.060434  Lock_time: 0.000000 Rows_sent: 654912  Rows_examined: 654912
SET timestamp=1570354188;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191006 14:30:45
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    24
# Query_time: 17.623352  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570368645;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191006 14:31:18
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    24
# Query_time: 32.930131  Lock_time: 0.000000 Rows_sent: 654886  Rows_examined: 654886
SET timestamp=1570368678;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191006 18:32:18
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    25
# Query_time: 17.655080  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570383138;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191006 18:32:51
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    25
# Query_time: 32.290264  Lock_time: 0.000000 Rows_sent: 654886  Rows_examined: 654886
SET timestamp=1570383171;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191006 22:33:50
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    26
# Query_time: 17.115810  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570397630;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191006 22:34:28
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    26
# Query_time: 37.722819  Lock_time: 0.000000 Rows_sent: 654886  Rows_examined: 654886
SET timestamp=1570397668;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191007  2:35:23
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    27
# Query_time: 17.550030  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570412123;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191007  2:35:58
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    27
# Query_time: 35.257635  Lock_time: 0.000000 Rows_sent: 654912  Rows_examined: 654912
SET timestamp=1570412158;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191007  4:00:20
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    28
# Query_time: 17.907653  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570417220;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191007  4:00:52
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    28
# Query_time: 31.942954  Lock_time: 0.000000 Rows_sent: 654912  Rows_examined: 654912
SET timestamp=1570417252;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;
# Time: 191007  6:36:45
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    29
# Query_time: 17.268767  Lock_time: 0.000000 Rows_sent: 1928145  Rows_examined: 1928145
SET timestamp=1570426605;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `log`;
# Time: 191007  6:37:21
# User@Host: <empty>[<empty>] @ localhost [::1]  Id:    29
# Query_time: 35.262304  Lock_time: 0.000000 Rows_sent: 654912  Rows_examined: 654912
SET timestamp=1570426641;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`;

pt-query-digest --limit = 100%mysql-slow.log的输出

# 150ms user time, 70ms system time, 32.44M rss, 50.93M vsz
# Current date: Mon Oct  7 12:21:00 2019
# Hostname: <empty>
# Files: mysql-slow.log
# Overall: 24 total, 1 unique, 0.00 QPS, 0.00x concurrency _______________
# Time range: 2019-10-05 18:22:54 to 2019-10-07 06:37:21
# Attribute          total     min     max     avg     95%  stddev  median
# ============     ======= ======= ======= ======= ======= ======= =======
# Exec time           624s     16s     38s     26s     35s      9s     32s
# Lock time              0       0       0       0       0       0       0
# Rows sent         29.56M 639.54k   1.84M   1.23M   1.77M 596.48k   1.77M
# Rows examine      29.56M 639.54k   1.84M   1.23M   1.77M 596.48k   1.77M
# Query size         1.07k      44      47   45.50   46.83    1.50   46.83

# Profile
# Rank Query ID                           Response time   Calls R/Call  V/
# ==== ================================== =============== ===== ======= ==
#    1 0xE3C753C2F267B2D767A347A2812914DF 624.0315 100.0%    24 26.0013  2.94 SELECT region

# Query 1: 0.00 QPS, 0.00x concurrency, ID 0xE3C753C2F267B2D767A347A2812914DF at byte 446
# This item is included in the report because it matches --limit.
# Scores: V/M = 2.94
# Time range: 2019-10-05 18:22:54 to 2019-10-07 06:37:21
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count        100      24
# Exec time    100    624s     16s     38s     26s     35s      9s     32s
# Lock time      0       0       0       0       0       0       0       0
# Rows sent    100  29.56M 639.54k   1.84M   1.23M   1.77M 596.48k   1.77M
# Rows examine 100  29.56M 639.54k   1.84M   1.23M   1.77M 596.48k   1.77M
# Query size   100   1.07k      44      47   45.50   46.83    1.50   46.83
# String:
# Databases    <empty>
# Hosts        localhost
# Users        <empty>
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms
#  10ms
# 100ms
#    1s
#  10s+  ################################################################
# Tables
#    SHOW TABLE STATUS FROM `<empty>` LIKE 'region'\G
#    SHOW CREATE TABLE `<empty>`.`region`\G
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`\G
# Converted for EXPLAIN
# EXPLAIN /*!50100 PARTITIONS*/
SELECT /*!40001 SQL_NO_CACHE */ * FROM `region`\G

为什么pt-query-digest仅显示一个唯一查询?

0 个答案:

没有答案