From 23397d1660a2e84323a5f09c8279edfecceab46f Mon Sep 17 00:00:00 2001 From: Mark Leith Date: Fri, 7 Mar 2014 17:51:01 +0000 Subject: [PATCH] Use 'total' more consistently (instead of count_star, etc.) --- README.md | 270 +++++++++--------- views/p_s/io_by_thread_by_latency.sql | 68 ++--- views/p_s/io_global_by_file_by_latency.sql | 36 +-- views/p_s/io_global_by_wait_by_bytes.sql | 116 ++++---- views/p_s/io_global_by_wait_by_latency.sql | 126 ++++---- views/p_s/user_summary.sql | 34 ++- views/p_s/user_summary_57.sql | 63 ++-- views/p_s/user_summary_by_file_io_type.sql | 12 +- views/p_s/user_summary_by_stages.sql | 12 +- .../p_s/user_summary_by_statement_latency.sql | 12 +- views/p_s/user_summary_by_statement_type.sql | 12 +- .../wait_classes_global_by_avg_latency.sql | 68 ++--- views/p_s/wait_classes_global_by_latency.sql | 66 ++--- views/p_s/waits_by_user_by_latency.sql | 84 +++--- views/p_s/waits_global_by_latency.sql | 44 +-- 15 files changed, 535 insertions(+), 488 deletions(-) diff --git a/README.md b/README.md index b6b550b..24bb1d5 100644 --- a/README.md +++ b/README.md @@ -101,21 +101,21 @@ Shows the top IO consumers by thread, ordered by total latency. ```SQL mysql> select * from io_by_thread_by_latency; -+---------------------+------------+---------------+-------------+-------------+-------------+-----------+----------------+ -| user | count_star | total_latency | min_latency | avg_latency | max_latency | thread_id | processlist_id | -+---------------------+------------+---------------+-------------+-------------+-------------+-----------+----------------+ -| root@localhost | 11580 | 18.01 s | 429.78 ns | 1.12 ms | 181.07 ms | 25 | 6 | -| main | 1358 | 1.31 s | 475.02 ns | 2.27 ms | 350.70 ms | 1 | NULL | -| page_cleaner_thread | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL | -| io_write_thread | 131 | 107.75 ms | 8.60 us | 822.55 us | 27.69 ms | 8 | NULL | -| io_write_thread | 46 | 47.07 ms | 10.64 us | 1.02 ms | 16.90 ms | 9 | NULL | -| io_write_thread | 71 | 46.99 ms | 9.11 us | 661.81 us | 17.04 ms | 11 | NULL | -| io_log_thread | 20 | 21.01 ms | 14.25 us | 1.05 ms | 7.08 ms | 3 | NULL | -| srv_master_thread | 13 | 17.60 ms | 8.49 us | 1.35 ms | 9.99 ms | 16 | NULL | -| srv_purge_thread | 4 | 1.81 ms | 34.31 us | 452.45 us | 1.02 ms | 17 | NULL | -| io_write_thread | 19 | 951.39 us | 9.75 us | 50.07 us | 297.47 us | 10 | NULL | -| signal_handler | 3 | 218.03 us | 21.64 us | 72.68 us | 154.84 us | 19 | NULL | -+---------------------+------------+---------------+-------------+-------------+-------------+-----------+----------------+ ++---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ +| user | total | total_latency | min_latency | avg_latency | max_latency | thread_id | processlist_id | ++---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ +| root@localhost | 11580 | 18.01 s | 429.78 ns | 1.12 ms | 181.07 ms | 25 | 6 | +| main | 1358 | 1.31 s | 475.02 ns | 2.27 ms | 350.70 ms | 1 | NULL | +| page_cleaner_thread | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL | +| io_write_thread | 131 | 107.75 ms | 8.60 us | 822.55 us | 27.69 ms | 8 | NULL | +| io_write_thread | 46 | 47.07 ms | 10.64 us | 1.02 ms | 16.90 ms | 9 | NULL | +| io_write_thread | 71 | 46.99 ms | 9.11 us | 661.81 us | 17.04 ms | 11 | NULL | +| io_log_thread | 20 | 21.01 ms | 14.25 us | 1.05 ms | 7.08 ms | 3 | NULL | +| srv_master_thread | 13 | 17.60 ms | 8.49 us | 1.35 ms | 9.99 ms | 16 | NULL | +| srv_purge_thread | 4 | 1.81 ms | 34.31 us | 452.45 us | 1.02 ms | 17 | NULL | +| io_write_thread | 19 | 951.39 us | 9.75 us | 50.07 us | 297.47 us | 10 | NULL | +| signal_handler | 3 | 218.03 us | 21.64 us | 72.68 us | 154.84 us | 19 | NULL | ++---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ ``` #### io_global_by_file_by_bytes / x$io_global_by_file_by_bytes @@ -149,15 +149,15 @@ Shows the top global IO consumers by latency by file. ```SQL mysql> select * from io_global_by_file_by_latency limit 5; -+-----------------------------------------------------------+------------+-----------+------------+--------------+-------------+---------------+------------+--------------+ -| file | count_star | total | count_read | read_latency | count_write | write_latency | count_misc | misc_latency | -+-----------------------------------------------------------+------------+-----------+------------+--------------+-------------+---------------+------------+--------------+ -| @@datadir/sys/wait_classes_global_by_avg_latency_raw.frm~ | 24 | 451.99 ms | 0 | 0 ps | 4 | 108.07 us | 20 | 451.88 ms | -| @@datadir/sys/innodb_buffer_stats_by_schema_raw.frm~ | 24 | 379.84 ms | 0 | 0 ps | 4 | 108.88 us | 20 | 379.73 ms | -| @@datadir/sys/io_by_thread_by_latency_raw.frm~ | 24 | 379.46 ms | 0 | 0 ps | 4 | 101.37 us | 20 | 379.36 ms | -| @@datadir/ibtmp1 | 53 | 373.45 ms | 0 | 0 ps | 48 | 246.08 ms | 5 | 127.37 ms | -| @@datadir/sys/statement_analysis_raw.frm~ | 24 | 353.14 ms | 0 | 0 ps | 4 | 94.96 us | 20 | 353.04 ms | -+-----------------------------------------------------------+------------+-----------+------------+--------------+-------------+---------------+------------+--------------+ ++-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ +| file | total | total_latency | count_read | read_latency | count_write | write_latency | count_misc | misc_latency | ++-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ +| @@datadir/sys/wait_classes_global_by_avg_latency_raw.frm~ | 24 | 451.99 ms | 0 | 0 ps | 4 | 108.07 us | 20 | 451.88 ms | +| @@datadir/sys/innodb_buffer_stats_by_schema_raw.frm~ | 24 | 379.84 ms | 0 | 0 ps | 4 | 108.88 us | 20 | 379.73 ms | +| @@datadir/sys/io_by_thread_by_latency_raw.frm~ | 24 | 379.46 ms | 0 | 0 ps | 4 | 101.37 us | 20 | 379.36 ms | +| @@datadir/ibtmp1 | 53 | 373.45 ms | 0 | 0 ps | 48 | 246.08 ms | 5 | 127.37 ms | +| @@datadir/sys/statement_analysis_raw.frm~ | 24 | 353.14 ms | 0 | 0 ps | 4 | 94.96 us | 20 | 353.04 ms | ++-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ ``` #### io_global_by_wait_by_bytes / x$io_global_by_wait_by_bytes @@ -170,26 +170,26 @@ Shows the top global IO consumer classes by bytes usage. ```SQL mysql> select * from io_global_by_wait_by_bytes; -+--------------------+------------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ -| event_name | count_star | total_latency | min_latency | avg_latency | max_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | total_requested | -+--------------------+------------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ -| myisam/dfile | 163681 | 983.13 ms | 379.08 ns | 6.01 µs | 22.06 ms | 68737 | 127.31 MiB | 1.90 KiB | 1012221 | 121.52 MiB | 126 bytes | 248.83 MiB | -| myisam/kfile | 1775 | 375.13 ms | 1.02 µs | 211.34 µs | 35.15 ms | 54066 | 9.97 MiB | 193 bytes | 428257 | 12.40 MiB | 30 bytes | 22.37 MiB | -| sql/FRM | 57889 | 8.40 s | 19.44 ns | 145.05 µs | 336.71 ms | 8009 | 2.60 MiB | 341 bytes | 14675 | 2.91 MiB | 208 bytes | 5.51 MiB | -| sql/global_ddl_log | 164 | 75.96 ms | 5.72 µs | 463.19 µs | 7.43 ms | 20 | 80.00 KiB | 4.00 KiB | 76 | 304.00 KiB | 4.00 KiB | 384.00 KiB | -| sql/file_parser | 419 | 601.37 ms | 1.96 µs | 1.44 ms | 37.14 ms | 66 | 42.01 KiB | 652 bytes | 64 | 226.98 KiB | 3.55 KiB | 268.99 KiB | -| sql/binlog | 190 | 6.79 s | 1.56 µs | 35.76 ms | 4.21 s | 52 | 60.54 KiB | 1.16 KiB | 0 | 0 bytes | 0 bytes | 60.54 KiB | -| sql/ERRMSG | 5 | 2.03 s | 8.61 µs | 405.40 ms | 2.03 s | 3 | 51.82 KiB | 17.27 KiB | 0 | 0 bytes | 0 bytes | 51.82 KiB | -| mysys/charset | 3 | 196.52 µs | 17.61 µs | 65.51 µs | 137.33 µs | 1 | 17.83 KiB | 17.83 KiB | 0 | 0 bytes | 0 bytes | 17.83 KiB | -| sql/partition | 81 | 18.87 ms | 888.08 ns | 232.92 µs | 4.67 ms | 66 | 2.75 KiB | 43 bytes | 8 | 288 bytes | 36 bytes | 3.04 KiB | -| sql/dbopt | 329166 | 26.95 s | 2.06 µs | 81.89 µs | 178.71 ms | 0 | 0 bytes | 0 bytes | 9 | 585 bytes | 65 bytes | 585 bytes | -| sql/relaylog | 7 | 1.18 ms | 838.84 ns | 168.30 µs | 892.70 µs | 0 | 0 bytes | 0 bytes | 1 | 120 bytes | 120 bytes | 120 bytes | -| mysys/cnf | 5 | 171.61 µs | 303.26 ns | 34.32 µs | 115.21 µs | 3 | 56 bytes | 19 bytes | 0 | 0 bytes | 0 bytes | 56 bytes | -| sql/pid | 3 | 220.55 µs | 29.29 µs | 73.52 µs | 143.11 µs | 0 | 0 bytes | 0 bytes | 1 | 5 bytes | 5 bytes | 5 bytes | -| sql/casetest | 1 | 121.19 µs | 121.19 µs | 121.19 µs | 121.19 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | -| sql/binlog_index | 5 | 593.47 µs | 1.07 µs | 118.69 µs | 535.90 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | -| sql/misc | 23 | 2.73 ms | 65.14 µs | 118.50 µs | 255.31 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | -+--------------------+------------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ ++--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ +| event_name | total | total_latency | min_latency | avg_latency | max_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | total_requested | ++--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ +| myisam/dfile | 163681 | 983.13 ms | 379.08 ns | 6.01 µs | 22.06 ms | 68737 | 127.31 MiB | 1.90 KiB | 1012221 | 121.52 MiB | 126 bytes | 248.83 MiB | +| myisam/kfile | 1775 | 375.13 ms | 1.02 µs | 211.34 µs | 35.15 ms | 54066 | 9.97 MiB | 193 bytes | 428257 | 12.40 MiB | 30 bytes | 22.37 MiB | +| sql/FRM | 57889 | 8.40 s | 19.44 ns | 145.05 µs | 336.71 ms | 8009 | 2.60 MiB | 341 bytes | 14675 | 2.91 MiB | 208 bytes | 5.51 MiB | +| sql/global_ddl_log | 164 | 75.96 ms | 5.72 µs | 463.19 µs | 7.43 ms | 20 | 80.00 KiB | 4.00 KiB | 76 | 304.00 KiB | 4.00 KiB | 384.00 KiB | +| sql/file_parser | 419 | 601.37 ms | 1.96 µs | 1.44 ms | 37.14 ms | 66 | 42.01 KiB | 652 bytes | 64 | 226.98 KiB | 3.55 KiB | 268.99 KiB | +| sql/binlog | 190 | 6.79 s | 1.56 µs | 35.76 ms | 4.21 s | 52 | 60.54 KiB | 1.16 KiB | 0 | 0 bytes | 0 bytes | 60.54 KiB | +| sql/ERRMSG | 5 | 2.03 s | 8.61 µs | 405.40 ms | 2.03 s | 3 | 51.82 KiB | 17.27 KiB | 0 | 0 bytes | 0 bytes | 51.82 KiB | +| mysys/charset | 3 | 196.52 µs | 17.61 µs | 65.51 µs | 137.33 µs | 1 | 17.83 KiB | 17.83 KiB | 0 | 0 bytes | 0 bytes | 17.83 KiB | +| sql/partition | 81 | 18.87 ms | 888.08 ns | 232.92 µs | 4.67 ms | 66 | 2.75 KiB | 43 bytes | 8 | 288 bytes | 36 bytes | 3.04 KiB | +| sql/dbopt | 329166 | 26.95 s | 2.06 µs | 81.89 µs | 178.71 ms | 0 | 0 bytes | 0 bytes | 9 | 585 bytes | 65 bytes | 585 bytes | +| sql/relaylog | 7 | 1.18 ms | 838.84 ns | 168.30 µs | 892.70 µs | 0 | 0 bytes | 0 bytes | 1 | 120 bytes | 120 bytes | 120 bytes | +| mysys/cnf | 5 | 171.61 µs | 303.26 ns | 34.32 µs | 115.21 µs | 3 | 56 bytes | 19 bytes | 0 | 0 bytes | 0 bytes | 56 bytes | +| sql/pid | 3 | 220.55 µs | 29.29 µs | 73.52 µs | 143.11 µs | 0 | 0 bytes | 0 bytes | 1 | 5 bytes | 5 bytes | 5 bytes | +| sql/casetest | 1 | 121.19 µs | 121.19 µs | 121.19 µs | 121.19 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | +| sql/binlog_index | 5 | 593.47 µs | 1.07 µs | 118.69 µs | 535.90 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | +| sql/misc | 23 | 2.73 ms | 65.14 µs | 118.50 µs | 255.31 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | ++--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ ``` #### io_global_by_wait_by_latency / x$io_global_by_wait_by_latency @@ -202,26 +202,26 @@ Shows the top global IO consumers by latency. ```SQL mysql> SELECT * FROM io_global_by_wait_by_latency; -+-------------------------+------------+-----------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ -| event_name | count_star | total | avg_latency | max_latency | read_latency | write_latency | misc_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | -+-------------------------+------------+-----------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ -| sql/file_parser | 5433 | 30.20 s | 5.56 ms | 203.65 ms | 22.08 ms | 24.89 ms | 30.16 s | 24 | 6.18 KiB | 264 bytes | 737 | 2.15 MiB | 2.99 KiB | -| innodb/innodb_data_file | 1344 | 1.52 s | 1.13 ms | 350.70 ms | 203.82 ms | 450.96 ms | 868.21 ms | 147 | 2.30 MiB | 16.00 KiB | 1001 | 53.61 MiB | 54.84 KiB | -| innodb/innodb_log_file | 828 | 893.48 ms | 1.08 ms | 30.11 ms | 16.32 ms | 705.89 ms | 171.27 ms | 6 | 68.00 KiB | 11.33 KiB | 413 | 2.19 MiB | 5.42 KiB | -| myisam/kfile | 7642 | 242.34 ms | 31.71 us | 19.27 ms | 73.60 ms | 23.48 ms | 145.26 ms | 758 | 135.63 KiB | 183 bytes | 4386 | 232.52 KiB | 54 bytes | -| myisam/dfile | 12540 | 223.47 ms | 17.82 us | 32.50 ms | 87.76 ms | 16.97 ms | 118.74 ms | 5390 | 4.49 MiB | 873 bytes | 1448 | 2.65 MiB | 1.88 KiB | -| csv/metadata | 8 | 28.98 ms | 3.62 ms | 20.15 ms | 399.27 us | 0 ps | 28.58 ms | 2 | 70 bytes | 35 bytes | 0 | 0 bytes | 0 bytes | -| mysys/charset | 3 | 24.24 ms | 8.08 ms | 24.15 ms | 24.15 ms | 0 ps | 93.18 us | 1 | 17.31 KiB | 17.31 KiB | 0 | 0 bytes | 0 bytes | -| sql/ERRMSG | 5 | 20.43 ms | 4.09 ms | 19.31 ms | 20.32 ms | 0 ps | 103.20 us | 3 | 58.97 KiB | 19.66 KiB | 0 | 0 bytes | 0 bytes | -| mysys/cnf | 5 | 11.37 ms | 2.27 ms | 11.28 ms | 11.29 ms | 0 ps | 78.22 us | 3 | 56 bytes | 19 bytes | 0 | 0 bytes | 0 bytes | -| sql/dbopt | 57 | 4.04 ms | 70.92 us | 843.70 us | 0 ps | 186.43 us | 3.86 ms | 0 | 0 bytes | 0 bytes | 7 | 431 bytes | 62 bytes | -| csv/data | 4 | 411.55 us | 102.89 us | 234.89 us | 0 ps | 0 ps | 411.55 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | -| sql/misc | 22 | 340.38 us | 15.47 us | 33.77 us | 0 ps | 0 ps | 340.38 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | -| archive/data | 39 | 277.86 us | 7.12 us | 16.18 us | 0 ps | 0 ps | 277.86 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | -| sql/pid | 3 | 218.03 us | 72.68 us | 154.84 us | 0 ps | 21.64 us | 196.39 us | 0 | 0 bytes | 0 bytes | 1 | 6 bytes | 6 bytes | -| sql/casetest | 5 | 197.15 us | 39.43 us | 126.31 us | 0 ps | 0 ps | 197.15 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | -| sql/global_ddl_log | 2 | 14.60 us | 7.30 us | 12.12 us | 0 ps | 0 ps | 14.60 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | -+-------------------------+------------+-----------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ ++-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ +| event_name | total | total_latency | avg_latency | max_latency | read_latency | write_latency | misc_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | ++-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ +| sql/file_parser | 5433 | 30.20 s | 5.56 ms | 203.65 ms | 22.08 ms | 24.89 ms | 30.16 s | 24 | 6.18 KiB | 264 bytes | 737 | 2.15 MiB | 2.99 KiB | +| innodb/innodb_data_file | 1344 | 1.52 s | 1.13 ms | 350.70 ms | 203.82 ms | 450.96 ms | 868.21 ms | 147 | 2.30 MiB | 16.00 KiB | 1001 | 53.61 MiB | 54.84 KiB | +| innodb/innodb_log_file | 828 | 893.48 ms | 1.08 ms | 30.11 ms | 16.32 ms | 705.89 ms | 171.27 ms | 6 | 68.00 KiB | 11.33 KiB | 413 | 2.19 MiB | 5.42 KiB | +| myisam/kfile | 7642 | 242.34 ms | 31.71 us | 19.27 ms | 73.60 ms | 23.48 ms | 145.26 ms | 758 | 135.63 KiB | 183 bytes | 4386 | 232.52 KiB | 54 bytes | +| myisam/dfile | 12540 | 223.47 ms | 17.82 us | 32.50 ms | 87.76 ms | 16.97 ms | 118.74 ms | 5390 | 4.49 MiB | 873 bytes | 1448 | 2.65 MiB | 1.88 KiB | +| csv/metadata | 8 | 28.98 ms | 3.62 ms | 20.15 ms | 399.27 us | 0 ps | 28.58 ms | 2 | 70 bytes | 35 bytes | 0 | 0 bytes | 0 bytes | +| mysys/charset | 3 | 24.24 ms | 8.08 ms | 24.15 ms | 24.15 ms | 0 ps | 93.18 us | 1 | 17.31 KiB | 17.31 KiB | 0 | 0 bytes | 0 bytes | +| sql/ERRMSG | 5 | 20.43 ms | 4.09 ms | 19.31 ms | 20.32 ms | 0 ps | 103.20 us | 3 | 58.97 KiB | 19.66 KiB | 0 | 0 bytes | 0 bytes | +| mysys/cnf | 5 | 11.37 ms | 2.27 ms | 11.28 ms | 11.29 ms | 0 ps | 78.22 us | 3 | 56 bytes | 19 bytes | 0 | 0 bytes | 0 bytes | +| sql/dbopt | 57 | 4.04 ms | 70.92 us | 843.70 us | 0 ps | 186.43 us | 3.86 ms | 0 | 0 bytes | 0 bytes | 7 | 431 bytes | 62 bytes | +| csv/data | 4 | 411.55 us | 102.89 us | 234.89 us | 0 ps | 0 ps | 411.55 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | +| sql/misc | 22 | 340.38 us | 15.47 us | 33.77 us | 0 ps | 0 ps | 340.38 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | +| archive/data | 39 | 277.86 us | 7.12 us | 16.18 us | 0 ps | 0 ps | 277.86 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | +| sql/pid | 3 | 218.03 us | 72.68 us | 154.84 us | 0 ps | 21.64 us | 196.39 us | 0 | 0 bytes | 0 bytes | 1 | 6 bytes | 6 bytes | +| sql/casetest | 5 | 197.15 us | 39.43 us | 126.31 us | 0 ps | 0 ps | 197.15 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | +| sql/global_ddl_log | 2 | 14.60 us | 7.30 us | 12.12 us | 0 ps | 0 ps | 14.60 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | ++-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ ``` #### latest_file_io / x$latest_file_io @@ -845,7 +845,7 @@ Summarizes stages by user, ordered by user and total latency per stage. ```SQL mysql> select * from user_summary_by_stages; +------+--------------------------------+-------+-----------+-----------+ -| user | event_name | count | wait_sum | wait_avg | +| user | event_name | total | wait_sum | wait_avg | +------+--------------------------------+-------+-----------+-----------+ | root | stage/sql/Opening tables | 889 | 1.97 ms | 2.22 us | | root | stage/sql/Creating sort index | 4 | 1.79 ms | 446.30 us | @@ -877,7 +877,7 @@ Summarizes overall statement statistics by user. ```SQL mysql> select * from user_summary_by_statement_latency; +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ -| user | count | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +| user | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | root | 3381 | 00:02:09.13 | 1.48 s | 1.07 s | 1151 | 93947 | 150 | 91 | +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -894,7 +894,7 @@ Summarizes the types of statements executed by each user. ```SQL mysql> select * from user_summary_by_statement_type; +------+------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ -| user | statement | count | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +| user | statement | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | root | create_view | 1332 | 00:03:39.08 | 677.76 ms | 494.56 ms | 0 | 0 | 0 | 0 | | root | select | 88 | 20.13 s | 16.57 s | 17.40 s | 1804 | 77285 | 0 | 48 | @@ -926,16 +926,16 @@ Lists the top wait classes by average latency, ignoring idle (this may be very l ```SQL mysql> select * from wait_classes_global_by_avg_latency where event_class != 'idle'; -+-------------------+--------------+---------------+-------------+-------------+-------------+ -| event_class | total_events | total_latency | min_latency | avg_latency | max_latency | -+-------------------+--------------+---------------+-------------+-------------+-------------+ -| wait/io/file | 543123 | 44.60 s | 19.44 ns | 82.11 µs | 4.21 s | -| wait/io/table | 22002 | 766.60 ms | 148.72 ns | 34.84 µs | 44.97 ms | -| wait/io/socket | 79613 | 967.17 ms | 0 ps | 12.15 µs | 27.10 ms | -| wait/lock/table | 35409 | 18.68 ms | 65.45 ns | 527.51 ns | 969.88 µs | -| wait/synch/rwlock | 37935 | 4.61 ms | 21.38 ns | 121.61 ns | 34.65 µs | -| wait/synch/mutex | 390622 | 18.60 ms | 19.44 ns | 47.61 ns | 10.32 µs | -+-------------------+--------------+---------------+-------------+-------------+-------------+ ++-------------------+--------+---------------+-------------+-------------+-------------+ +| event_class | total | total_latency | min_latency | avg_latency | max_latency | ++-------------------+--------+---------------+-------------+-------------+-------------+ +| wait/io/file | 543123 | 44.60 s | 19.44 ns | 82.11 µs | 4.21 s | +| wait/io/table | 22002 | 766.60 ms | 148.72 ns | 34.84 µs | 44.97 ms | +| wait/io/socket | 79613 | 967.17 ms | 0 ps | 12.15 µs | 27.10 ms | +| wait/lock/table | 35409 | 18.68 ms | 65.45 ns | 527.51 ns | 969.88 µs | +| wait/synch/rwlock | 37935 | 4.61 ms | 21.38 ns | 121.61 ns | 34.65 µs | +| wait/synch/mutex | 390622 | 18.60 ms | 19.44 ns | 47.61 ns | 10.32 µs | ++-------------------+--------+---------------+-------------+-------------+-------------+ ``` #### wait_classes_global_by_latency / x$wait_classes_global_by_latency @@ -948,16 +948,16 @@ Lists the top wait classes by total latency, ignoring idle (this may be very lar ```SQL mysql> select * from wait_classes_global_by_latency; -+-------------------+--------------+---------------+-------------+-------------+-------------+ -| event_class | total_events | total_latency | min_latency | avg_latency | max_latency | -+-------------------+--------------+---------------+-------------+-------------+-------------+ -| wait/io/file | 550470 | 46.01 s | 19.44 ns | 83.58 µs | 4.21 s | -| wait/io/socket | 228833 | 2.71 s | 0 ps | 11.86 µs | 29.93 ms | -| wait/io/table | 64063 | 1.89 s | 99.79 ns | 29.43 µs | 68.07 ms | -| wait/lock/table | 76029 | 47.19 ms | 65.45 ns | 620.74 ns | 969.88 µs | -| wait/synch/mutex | 635925 | 34.93 ms | 19.44 ns | 54.93 ns | 107.70 µs | -| wait/synch/rwlock | 61287 | 7.62 ms | 21.38 ns | 124.37 ns | 34.65 µs | -+-------------------+--------------+---------------+-------------+-------------+-------------+ ++-------------------+--------+---------------+-------------+-------------+-------------+ +| event_class | total | total_latency | min_latency | avg_latency | max_latency | ++-------------------+--------+---------------+-------------+-------------+-------------+ +| wait/io/file | 550470 | 46.01 s | 19.44 ns | 83.58 µs | 4.21 s | +| wait/io/socket | 228833 | 2.71 s | 0 ps | 11.86 µs | 29.93 ms | +| wait/io/table | 64063 | 1.89 s | 99.79 ns | 29.43 µs | 68.07 ms | +| wait/lock/table | 76029 | 47.19 ms | 65.45 ns | 620.74 ns | 969.88 µs | +| wait/synch/mutex | 635925 | 34.93 ms | 19.44 ns | 54.93 ns | 107.70 µs | +| wait/synch/rwlock | 61287 | 7.62 ms | 21.38 ns | 124.37 ns | 34.65 µs | ++-------------------+--------+---------------+-------------+-------------+-------------+ ``` #### waits_by_user_by_latency / x$waits_by_user_by_latency @@ -970,25 +970,25 @@ Lists the top wait events by their total latency, ignoring idle (this may be ver ```SQL mysql> select * from waits_by_user_by_latency; -+------+-----------------------------------------------------+--------------+---------------+-------------+-------------+ -| user | event | total_events | total_latency | avg_latency | max_latency | -+------+-----------------------------------------------------+--------------+---------------+-------------+-------------+ -| root | wait/io/file/sql/file_parser | 13743 | 00:01:00.46 | 4.40 ms | 231.88 ms | -| root | wait/io/file/innodb/innodb_data_file | 4699 | 3.02 s | 643.38 us | 46.93 ms | -| root | wait/io/file/sql/FRM | 11462 | 2.60 s | 226.83 us | 61.72 ms | -| root | wait/io/file/myisam/dfile | 26776 | 746.70 ms | 27.89 us | 308.79 ms | -| root | wait/io/file/myisam/kfile | 7126 | 462.66 ms | 64.93 us | 88.76 ms | -| root | wait/io/file/sql/dbopt | 179 | 137.58 ms | 768.59 us | 15.46 ms | -| root | wait/io/file/csv/metadata | 8 | 86.60 ms | 10.82 ms | 50.32 ms | -| root | wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | 798080 | 66.46 ms | 82.94 ns | 161.03 us | -| root | wait/io/file/sql/binlog | 19 | 49.11 ms | 2.58 ms | 9.40 ms | -| root | wait/io/file/sql/misc | 26 | 22.38 ms | 860.80 us | 15.30 ms | -| root | wait/io/file/csv/data | 4 | 297.46 us | 74.37 us | 111.93 us | -| root | wait/synch/rwlock/sql/MDL_lock::rwlock | 944 | 287.86 us | 304.62 ns | 874.64 ns | -| root | wait/io/file/archive/data | 4 | 82.71 us | 20.68 us | 40.74 us | -| root | wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | 60 | 12.21 us | 203.20 ns | 512.72 ns | -| root | wait/synch/mutex/innodb/trx_mutex | 81 | 5.93 us | 73.14 ns | 252.59 ns | -+------+-----------------------------------------------------+--------------+---------------+-------------+-------------+ ++------+-----------------------------------------------------+--------+---------------+-------------+-------------+ +| user | event | total | total_latency | avg_latency | max_latency | ++------+-----------------------------------------------------+--------+---------------+-------------+-------------+ +| root | wait/io/file/sql/file_parser | 13743 | 00:01:00.46 | 4.40 ms | 231.88 ms | +| root | wait/io/file/innodb/innodb_data_file | 4699 | 3.02 s | 643.38 us | 46.93 ms | +| root | wait/io/file/sql/FRM | 11462 | 2.60 s | 226.83 us | 61.72 ms | +| root | wait/io/file/myisam/dfile | 26776 | 746.70 ms | 27.89 us | 308.79 ms | +| root | wait/io/file/myisam/kfile | 7126 | 462.66 ms | 64.93 us | 88.76 ms | +| root | wait/io/file/sql/dbopt | 179 | 137.58 ms | 768.59 us | 15.46 ms | +| root | wait/io/file/csv/metadata | 8 | 86.60 ms | 10.82 ms | 50.32 ms | +| root | wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | 798080 | 66.46 ms | 82.94 ns | 161.03 us | +| root | wait/io/file/sql/binlog | 19 | 49.11 ms | 2.58 ms | 9.40 ms | +| root | wait/io/file/sql/misc | 26 | 22.38 ms | 860.80 us | 15.30 ms | +| root | wait/io/file/csv/data | 4 | 297.46 us | 74.37 us | 111.93 us | +| root | wait/synch/rwlock/sql/MDL_lock::rwlock | 944 | 287.86 us | 304.62 ns | 874.64 ns | +| root | wait/io/file/archive/data | 4 | 82.71 us | 20.68 us | 40.74 us | +| root | wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | 60 | 12.21 us | 203.20 ns | 512.72 ns | +| root | wait/synch/mutex/innodb/trx_mutex | 81 | 5.93 us | 73.14 ns | 252.59 ns | ++------+-----------------------------------------------------+--------+---------------+-------------+-------------+ ``` #### waits_global_by_latency / x$waits_global_by_latency @@ -1001,35 +1001,35 @@ Lists the top wait events by their total latency, ignoring idle (this may be ver ```SQL mysql> select * from waits_global_by_latency; -+-----------------------------------------------------+--------------+---------------+-------------+-------------+ -| events | total_events | total_latency | avg_latency | max_latency | -+-----------------------------------------------------+--------------+---------------+-------------+-------------+ -| wait/io/file/sql/file_parser | 14936 | 00:01:06.64 | 4.46 ms | 231.88 ms | -| wait/io/file/innodb/innodb_data_file | 6133 | 6.31 s | 1.03 ms | 147.56 ms | -| wait/io/file/sql/FRM | 12677 | 2.83 s | 223.37 us | 40.86 ms | -| wait/io/file/myisam/dfile | 28446 | 754.40 ms | 26.52 us | 308.79 ms | -| wait/io/file/myisam/kfile | 7572 | 491.17 ms | 64.87 us | 88.76 ms | -| wait/io/file/sql/relaylog | 9 | 252.28 ms | 28.03 ms | 144.17 ms | -| wait/io/file/sql/binlog | 76 | 242.87 ms | 3.20 ms | 153.72 ms | -| wait/io/file/sql/binlog_index | 21 | 173.07 ms | 8.24 ms | 81.83 ms | -| wait/io/file/sql/dbopt | 184 | 149.52 ms | 812.62 us | 15.46 ms | -| wait/io/file/innodb/innodb_log_file | 20 | 117.17 ms | 5.86 ms | 36.53 ms | -| wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | 1197128 | 99.27 ms | 82.56 ns | 161.03 us | -| wait/io/file/csv/metadata | 8 | 86.60 ms | 10.82 ms | 50.32 ms | -| wait/io/file/sql/relaylog_index | 10 | 60.10 ms | 6.01 ms | 48.04 ms | -| wait/io/file/sql/ERRMSG | 5 | 35.41 ms | 7.08 ms | 31.78 ms | -| wait/io/file/sql/misc | 28 | 22.40 ms | 800.06 us | 15.30 ms | -| wait/io/file/mysys/charset | 3 | 7.46 ms | 2.49 ms | 4.13 ms | -| wait/io/file/sql/casetest | 5 | 6.01 ms | 1.20 ms | 5.86 ms | -| wait/io/file/sql/pid | 3 | 5.96 ms | 1.99 ms | 3.06 ms | -| wait/synch/rwlock/sql/MDL_lock::rwlock | 1396 | 420.58 us | 301.22 ns | 874.64 ns | -| wait/io/file/csv/data | 4 | 297.46 us | 74.37 us | 111.93 us | -| wait/io/file/mysys/cnf | 5 | 154.97 us | 30.99 us | 58.87 us | -| wait/io/file/archive/data | 4 | 82.71 us | 20.68 us | 40.74 us | -| wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | 90 | 19.23 us | 213.38 ns | 576.81 ns | -| wait/io/file/sql/global_ddl_log | 2 | 18.64 us | 9.32 us | 16.40 us | -| wait/synch/mutex/innodb/trx_mutex | 108 | 8.23 us | 76.15 ns | 365.69 ns | -+-----------------------------------------------------+--------------+---------------+-------------+-------------+ ++-----------------------------------------------------+---------+---------------+-------------+-------------+ +| events | total | total_latency | avg_latency | max_latency | ++-----------------------------------------------------+---------+---------------+-------------+-------------+ +| wait/io/file/sql/file_parser | 14936 | 00:01:06.64 | 4.46 ms | 231.88 ms | +| wait/io/file/innodb/innodb_data_file | 6133 | 6.31 s | 1.03 ms | 147.56 ms | +| wait/io/file/sql/FRM | 12677 | 2.83 s | 223.37 us | 40.86 ms | +| wait/io/file/myisam/dfile | 28446 | 754.40 ms | 26.52 us | 308.79 ms | +| wait/io/file/myisam/kfile | 7572 | 491.17 ms | 64.87 us | 88.76 ms | +| wait/io/file/sql/relaylog | 9 | 252.28 ms | 28.03 ms | 144.17 ms | +| wait/io/file/sql/binlog | 76 | 242.87 ms | 3.20 ms | 153.72 ms | +| wait/io/file/sql/binlog_index | 21 | 173.07 ms | 8.24 ms | 81.83 ms | +| wait/io/file/sql/dbopt | 184 | 149.52 ms | 812.62 us | 15.46 ms | +| wait/io/file/innodb/innodb_log_file | 20 | 117.17 ms | 5.86 ms | 36.53 ms | +| wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | 1197128 | 99.27 ms | 82.56 ns | 161.03 us | +| wait/io/file/csv/metadata | 8 | 86.60 ms | 10.82 ms | 50.32 ms | +| wait/io/file/sql/relaylog_index | 10 | 60.10 ms | 6.01 ms | 48.04 ms | +| wait/io/file/sql/ERRMSG | 5 | 35.41 ms | 7.08 ms | 31.78 ms | +| wait/io/file/sql/misc | 28 | 22.40 ms | 800.06 us | 15.30 ms | +| wait/io/file/mysys/charset | 3 | 7.46 ms | 2.49 ms | 4.13 ms | +| wait/io/file/sql/casetest | 5 | 6.01 ms | 1.20 ms | 5.86 ms | +| wait/io/file/sql/pid | 3 | 5.96 ms | 1.99 ms | 3.06 ms | +| wait/synch/rwlock/sql/MDL_lock::rwlock | 1396 | 420.58 us | 301.22 ns | 874.64 ns | +| wait/io/file/csv/data | 4 | 297.46 us | 74.37 us | 111.93 us | +| wait/io/file/mysys/cnf | 5 | 154.97 us | 30.99 us | 58.87 us | +| wait/io/file/archive/data | 4 | 82.71 us | 20.68 us | 40.74 us | +| wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | 90 | 19.23 us | 213.38 ns | 576.81 ns | +| wait/io/file/sql/global_ddl_log | 2 | 18.64 us | 9.32 us | 16.40 us | +| wait/synch/mutex/innodb/trx_mutex | 108 | 8.23 us | 76.15 ns | 365.69 ns | ++-----------------------------------------------------+---------+---------------+-------------+-------------+ ``` ### Functions diff --git a/views/p_s/io_by_thread_by_latency.sql b/views/p_s/io_by_thread_by_latency.sql index 0c6a469..e3480de 100644 --- a/views/p_s/io_by_thread_by_latency.sql +++ b/views/p_s/io_by_thread_by_latency.sql @@ -19,21 +19,21 @@ * Show the top IO consumers by thread, ordered by total latency * * mysql> select * from io_by_thread_by_latency; - * +---------------------+------------+---------------+-------------+-------------+-------------+-----------+----------------+ - * | user | count_star | total_latency | min_latency | avg_latency | max_latency | thread_id | processlist_id | - * +---------------------+------------+---------------+-------------+-------------+-------------+-----------+----------------+ - * | root@localhost | 11580 | 18.01 s | 429.78 ns | 1.12 ms | 181.07 ms | 25 | 6 | - * | main | 1358 | 1.31 s | 475.02 ns | 2.27 ms | 350.70 ms | 1 | NULL | - * | page_cleaner_thread | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL | - * | io_write_thread | 131 | 107.75 ms | 8.60 us | 822.55 us | 27.69 ms | 8 | NULL | - * | io_write_thread | 46 | 47.07 ms | 10.64 us | 1.02 ms | 16.90 ms | 9 | NULL | - * | io_write_thread | 71 | 46.99 ms | 9.11 us | 661.81 us | 17.04 ms | 11 | NULL | - * | io_log_thread | 20 | 21.01 ms | 14.25 us | 1.05 ms | 7.08 ms | 3 | NULL | - * | srv_master_thread | 13 | 17.60 ms | 8.49 us | 1.35 ms | 9.99 ms | 16 | NULL | - * | srv_purge_thread | 4 | 1.81 ms | 34.31 us | 452.45 us | 1.02 ms | 17 | NULL | - * | io_write_thread | 19 | 951.39 us | 9.75 us | 50.07 us | 297.47 us | 10 | NULL | - * | signal_handler | 3 | 218.03 us | 21.64 us | 72.68 us | 154.84 us | 19 | NULL | - * +---------------------+------------+---------------+-------------+-------------+-------------+-----------+----------------+ + * +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ + * | user | total | total_latency | min_latency | avg_latency | max_latency | thread_id | processlist_id | + * +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ + * | root@localhost | 11580 | 18.01 s | 429.78 ns | 1.12 ms | 181.07 ms | 25 | 6 | + * | main | 1358 | 1.31 s | 475.02 ns | 2.27 ms | 350.70 ms | 1 | NULL | + * | page_cleaner_thread | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL | + * | io_write_thread | 131 | 107.75 ms | 8.60 us | 822.55 us | 27.69 ms | 8 | NULL | + * | io_write_thread | 46 | 47.07 ms | 10.64 us | 1.02 ms | 16.90 ms | 9 | NULL | + * | io_write_thread | 71 | 46.99 ms | 9.11 us | 661.81 us | 17.04 ms | 11 | NULL | + * | io_log_thread | 20 | 21.01 ms | 14.25 us | 1.05 ms | 7.08 ms | 3 | NULL | + * | srv_master_thread | 13 | 17.60 ms | 8.49 us | 1.35 ms | 9.99 ms | 16 | NULL | + * | srv_purge_thread | 4 | 1.81 ms | 34.31 us | 452.45 us | 1.02 ms | 17 | NULL | + * | io_write_thread | 19 | 951.39 us | 9.75 us | 50.07 us | 297.47 us | 10 | NULL | + * | signal_handler | 3 | 218.03 us | 21.64 us | 72.68 us | 154.84 us | 19 | NULL | + * +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ * */ @@ -43,7 +43,7 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW io_by_thread_by_latency ( user, - count_star, + total, total_latency, min_latency, avg_latency, @@ -56,7 +56,7 @@ SELECT IF(processlist_id IS NULL, SUBSTRING_INDEX(name, '/', -1), CONCAT(processlist_user, '@', processlist_host) ) user, - SUM(count_star) count_star, + SUM(count_star) total, sys.format_time(SUM(sum_timer_wait)) total_latency, sys.format_time(MIN(min_timer_wait)) min_latency, sys.format_time(AVG(avg_timer_wait)) avg_latency, @@ -76,21 +76,21 @@ SELECT IF(processlist_id IS NULL, * Show the top IO consumers by thread, ordered by total latency * * mysql> select * from x$io_by_thread_by_latency; - * +---------------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+ - * | user | count_star | total_latency | min_latency | avg_latency | max_latency | thread_id | processlist_id | - * +---------------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+ - * | root@localhost | 11587 | 18007539905680 | 429780 | 1120831681.6667 | 181065665560 | 25 | 6 | - * | main | 1358 | 1309001741320 | 475020 | 2269581997.8000 | 350700491310 | 1 | NULL | - * | page_cleaner_thread | 654 | 147435455960 | 588120 | 225436198.0000 | 46412043990 | 18 | NULL | - * | io_write_thread | 131 | 107754483070 | 8603140 | 822553303.0000 | 27691592500 | 8 | NULL | - * | io_write_thread | 46 | 47074926860 | 10642710 | 1023367631.0000 | 16899745070 | 9 | NULL | - * | io_write_thread | 71 | 46988801210 | 9108320 | 661814075.0000 | 17042760020 | 11 | NULL | - * | io_log_thread | 20 | 21007710490 | 14250600 | 1050385336.0000 | 7081255090 | 3 | NULL | - * | srv_master_thread | 13 | 17601511720 | 8486270 | 1353962324.0000 | 9990100380 | 16 | NULL | - * | srv_purge_thread | 4 | 1809792270 | 34307000 | 452447879.0000 | 1018887740 | 17 | NULL | - * | io_write_thread | 19 | 951385890 | 9745450 | 50072763.0000 | 297468080 | 10 | NULL | - * | signal_handler | 3 | 218026640 | 21639800 | 72675421.0000 | 154841440 | 19 | NULL | - * +---------------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+ + * +---------------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+ + * | user | total | total_latency | min_latency | avg_latency | max_latency | thread_id | processlist_id | + * +---------------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+ + * | root@localhost | 11587 | 18007539905680 | 429780 | 1120831681.6667 | 181065665560 | 25 | 6 | + * | main | 1358 | 1309001741320 | 475020 | 2269581997.8000 | 350700491310 | 1 | NULL | + * | page_cleaner_thread | 654 | 147435455960 | 588120 | 225436198.0000 | 46412043990 | 18 | NULL | + * | io_write_thread | 131 | 107754483070 | 8603140 | 822553303.0000 | 27691592500 | 8 | NULL | + * | io_write_thread | 46 | 47074926860 | 10642710 | 1023367631.0000 | 16899745070 | 9 | NULL | + * | io_write_thread | 71 | 46988801210 | 9108320 | 661814075.0000 | 17042760020 | 11 | NULL | + * | io_log_thread | 20 | 21007710490 | 14250600 | 1050385336.0000 | 7081255090 | 3 | NULL | + * | srv_master_thread | 13 | 17601511720 | 8486270 | 1353962324.0000 | 9990100380 | 16 | NULL | + * | srv_purge_thread | 4 | 1809792270 | 34307000 | 452447879.0000 | 1018887740 | 17 | NULL | + * | io_write_thread | 19 | 951385890 | 9745450 | 50072763.0000 | 297468080 | 10 | NULL | + * | signal_handler | 3 | 218026640 | 21639800 | 72675421.0000 | 154841440 | 19 | NULL | + * +---------------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+ * */ @@ -100,7 +100,7 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW x$io_by_thread_by_latency ( user, - count_star, + total, total_latency, min_latency, avg_latency, @@ -113,7 +113,7 @@ SELECT IF(processlist_id IS NULL, SUBSTRING_INDEX(name, '/', -1), CONCAT(processlist_user, '@', processlist_host) ) user, - SUM(count_star) count_star, + SUM(count_star) total, SUM(sum_timer_wait) total_latency, MIN(min_timer_wait) min_latency, AVG(avg_timer_wait) avg_latency, diff --git a/views/p_s/io_global_by_file_by_latency.sql b/views/p_s/io_global_by_file_by_latency.sql index 77f5f13..cfe2ce2 100644 --- a/views/p_s/io_global_by_file_by_latency.sql +++ b/views/p_s/io_global_by_file_by_latency.sql @@ -19,15 +19,15 @@ * Shows the top global IO consumers by latency by file. * * mysql> select * from io_global_by_file_by_latency limit 5; - * +-----------------------------------------------------------+------------+-----------+------------+--------------+-------------+---------------+------------+--------------+ - * | file | count_star | total | count_read | read_latency | count_write | write_latency | count_misc | misc_latency | - * +-----------------------------------------------------------+------------+-----------+------------+--------------+-------------+---------------+------------+--------------+ - * | @@datadir/sys/wait_classes_global_by_avg_latency_raw.frm~ | 24 | 451.99 ms | 0 | 0 ps | 4 | 108.07 us | 20 | 451.88 ms | - * | @@datadir/sys/innodb_buffer_stats_by_schema_raw.frm~ | 24 | 379.84 ms | 0 | 0 ps | 4 | 108.88 us | 20 | 379.73 ms | - * | @@datadir/sys/io_by_thread_by_latency_raw.frm~ | 24 | 379.46 ms | 0 | 0 ps | 4 | 101.37 us | 20 | 379.36 ms | - * | @@datadir/ibtmp1 | 53 | 373.45 ms | 0 | 0 ps | 48 | 246.08 ms | 5 | 127.37 ms | - * | @@datadir/sys/statement_analysis_raw.frm~ | 24 | 353.14 ms | 0 | 0 ps | 4 | 94.96 us | 20 | 353.04 ms | - * +-----------------------------------------------------------+------------+-----------+------------+--------------+-------------+---------------+------------+--------------+ + * +-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ + * | file | total | total_latency | count_read | read_latency | count_write | write_latency | count_misc | misc_latency | + * +-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ + * | @@datadir/sys/wait_classes_global_by_avg_latency_raw.frm~ | 24 | 451.99 ms | 0 | 0 ps | 4 | 108.07 us | 20 | 451.88 ms | + * | @@datadir/sys/innodb_buffer_stats_by_schema_raw.frm~ | 24 | 379.84 ms | 0 | 0 ps | 4 | 108.88 us | 20 | 379.73 ms | + * | @@datadir/sys/io_by_thread_by_latency_raw.frm~ | 24 | 379.46 ms | 0 | 0 ps | 4 | 101.37 us | 20 | 379.36 ms | + * | @@datadir/ibtmp1 | 53 | 373.45 ms | 0 | 0 ps | 48 | 246.08 ms | 5 | 127.37 ms | + * | @@datadir/sys/statement_analysis_raw.frm~ | 24 | 353.14 ms | 0 | 0 ps | 4 | 94.96 us | 20 | 353.04 ms | + * +-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ * */ @@ -64,15 +64,15 @@ SELECT sys.format_path(file_name) AS file, * Shows the top global IO consumers by latency by file. * * mysql> select * from x$io_global_by_file_by_latency limit 5; - * +--------------------------------------------------------------------------------------+------------+---------------+------------+--------------+-------------+---------------+------------+--------------+ - * | file | count_star | total | count_read | read_latency | count_write | write_latency | count_misc | misc_latency | - * +--------------------------------------------------------------------------------------+------------+---------------+------------+--------------+-------------+---------------+------------+--------------+ - * | /Users/mark/sandboxes/msb_5_7_2/data/sys/wait_classes_global_by_avg_latency_raw.frm~ | 30 | 513959738110 | 0 | 0 | 5 | 132130960 | 25 | 513827607150 | - * | /Users/mark/sandboxes/msb_5_7_2/data/sys/innodb_buffer_stats_by_schema_raw.frm~ | 30 | 490149888410 | 0 | 0 | 5 | 483887040 | 25 | 489666001370 | - * | /Users/mark/sandboxes/msb_5_7_2/data/sys/io_by_thread_by_latency_raw.frm~ | 30 | 427724241620 | 0 | 0 | 5 | 131399580 | 25 | 427592842040 | - * | /Users/mark/sandboxes/msb_5_7_2/data/sys/innodb_buffer_stats_by_schema.frm~ | 30 | 406392559950 | 0 | 0 | 5 | 104082160 | 25 | 406288477790 | - * | /Users/mark/sandboxes/msb_5_7_2/data/sys/statement_analysis_raw.frm~ | 30 | 395527510430 | 0 | 0 | 5 | 118724840 | 25 | 395408785590 | - * +--------------------------------------------------------------------------------------+------------+---------------+------------+--------------+-------------+---------------+------------+--------------+ + * +--------------------------------------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ + * | file | total | total_latency | count_read | read_latency | count_write | write_latency | count_misc | misc_latency | + * +--------------------------------------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ + * | /Users/mark/sandboxes/msb_5_7_2/data/sys/wait_classes_global_by_avg_latency_raw.frm~ | 30 | 513959738110 | 0 | 0 | 5 | 132130960 | 25 | 513827607150 | + * | /Users/mark/sandboxes/msb_5_7_2/data/sys/innodb_buffer_stats_by_schema_raw.frm~ | 30 | 490149888410 | 0 | 0 | 5 | 483887040 | 25 | 489666001370 | + * | /Users/mark/sandboxes/msb_5_7_2/data/sys/io_by_thread_by_latency_raw.frm~ | 30 | 427724241620 | 0 | 0 | 5 | 131399580 | 25 | 427592842040 | + * | /Users/mark/sandboxes/msb_5_7_2/data/sys/innodb_buffer_stats_by_schema.frm~ | 30 | 406392559950 | 0 | 0 | 5 | 104082160 | 25 | 406288477790 | + * | /Users/mark/sandboxes/msb_5_7_2/data/sys/statement_analysis_raw.frm~ | 30 | 395527510430 | 0 | 0 | 5 | 118724840 | 25 | 395408785590 | + * +--------------------------------------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ * */ diff --git a/views/p_s/io_global_by_wait_by_bytes.sql b/views/p_s/io_global_by_wait_by_bytes.sql index 1038c69..170cf92 100644 --- a/views/p_s/io_global_by_wait_by_bytes.sql +++ b/views/p_s/io_global_by_wait_by_bytes.sql @@ -19,26 +19,26 @@ * Shows the top global IO consumer classes by bytes usage. * * mysql> select * from io_global_by_wait_by_bytes; - * +--------------------+------------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ - * | event_name | count_star | total_latency | min_latency | avg_latency | max_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | total_requested | - * +--------------------+------------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ - * | myisam/dfile | 163681 | 983.13 ms | 379.08 ns | 6.01 µs | 22.06 ms | 68737 | 127.31 MiB | 1.90 KiB | 1012221 | 121.52 MiB | 126 bytes | 248.83 MiB | - * | myisam/kfile | 1775 | 375.13 ms | 1.02 µs | 211.34 µs | 35.15 ms | 54066 | 9.97 MiB | 193 bytes | 428257 | 12.40 MiB | 30 bytes | 22.37 MiB | - * | sql/FRM | 57889 | 8.40 s | 19.44 ns | 145.05 µs | 336.71 ms | 8009 | 2.60 MiB | 341 bytes | 14675 | 2.91 MiB | 208 bytes | 5.51 MiB | - * | sql/global_ddl_log | 164 | 75.96 ms | 5.72 µs | 463.19 µs | 7.43 ms | 20 | 80.00 KiB | 4.00 KiB | 76 | 304.00 KiB | 4.00 KiB | 384.00 KiB | - * | sql/file_parser | 419 | 601.37 ms | 1.96 µs | 1.44 ms | 37.14 ms | 66 | 42.01 KiB | 652 bytes | 64 | 226.98 KiB | 3.55 KiB | 268.99 KiB | - * | sql/binlog | 190 | 6.79 s | 1.56 µs | 35.76 ms | 4.21 s | 52 | 60.54 KiB | 1.16 KiB | 0 | 0 bytes | 0 bytes | 60.54 KiB | - * | sql/ERRMSG | 5 | 2.03 s | 8.61 µs | 405.40 ms | 2.03 s | 3 | 51.82 KiB | 17.27 KiB | 0 | 0 bytes | 0 bytes | 51.82 KiB | - * | mysys/charset | 3 | 196.52 µs | 17.61 µs | 65.51 µs | 137.33 µs | 1 | 17.83 KiB | 17.83 KiB | 0 | 0 bytes | 0 bytes | 17.83 KiB | - * | sql/partition | 81 | 18.87 ms | 888.08 ns | 232.92 µs | 4.67 ms | 66 | 2.75 KiB | 43 bytes | 8 | 288 bytes | 36 bytes | 3.04 KiB | - * | sql/dbopt | 329166 | 26.95 s | 2.06 µs | 81.89 µs | 178.71 ms | 0 | 0 bytes | 0 bytes | 9 | 585 bytes | 65 bytes | 585 bytes | - * | sql/relaylog | 7 | 1.18 ms | 838.84 ns | 168.30 µs | 892.70 µs | 0 | 0 bytes | 0 bytes | 1 | 120 bytes | 120 bytes | 120 bytes | - * | mysys/cnf | 5 | 171.61 µs | 303.26 ns | 34.32 µs | 115.21 µs | 3 | 56 bytes | 19 bytes | 0 | 0 bytes | 0 bytes | 56 bytes | - * | sql/pid | 3 | 220.55 µs | 29.29 µs | 73.52 µs | 143.11 µs | 0 | 0 bytes | 0 bytes | 1 | 5 bytes | 5 bytes | 5 bytes | - * | sql/casetest | 1 | 121.19 µs | 121.19 µs | 121.19 µs | 121.19 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | - * | sql/binlog_index | 5 | 593.47 µs | 1.07 µs | 118.69 µs | 535.90 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | - * | sql/misc | 23 | 2.73 ms | 65.14 µs | 118.50 µs | 255.31 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | - * +--------------------+------------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ + * +--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ + * | event_name | total | total_latency | min_latency | avg_latency | max_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | total_requested | + * +--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ + * | myisam/dfile | 163681 | 983.13 ms | 379.08 ns | 6.01 µs | 22.06 ms | 68737 | 127.31 MiB | 1.90 KiB | 1012221 | 121.52 MiB | 126 bytes | 248.83 MiB | + * | myisam/kfile | 1775 | 375.13 ms | 1.02 µs | 211.34 µs | 35.15 ms | 54066 | 9.97 MiB | 193 bytes | 428257 | 12.40 MiB | 30 bytes | 22.37 MiB | + * | sql/FRM | 57889 | 8.40 s | 19.44 ns | 145.05 µs | 336.71 ms | 8009 | 2.60 MiB | 341 bytes | 14675 | 2.91 MiB | 208 bytes | 5.51 MiB | + * | sql/global_ddl_log | 164 | 75.96 ms | 5.72 µs | 463.19 µs | 7.43 ms | 20 | 80.00 KiB | 4.00 KiB | 76 | 304.00 KiB | 4.00 KiB | 384.00 KiB | + * | sql/file_parser | 419 | 601.37 ms | 1.96 µs | 1.44 ms | 37.14 ms | 66 | 42.01 KiB | 652 bytes | 64 | 226.98 KiB | 3.55 KiB | 268.99 KiB | + * | sql/binlog | 190 | 6.79 s | 1.56 µs | 35.76 ms | 4.21 s | 52 | 60.54 KiB | 1.16 KiB | 0 | 0 bytes | 0 bytes | 60.54 KiB | + * | sql/ERRMSG | 5 | 2.03 s | 8.61 µs | 405.40 ms | 2.03 s | 3 | 51.82 KiB | 17.27 KiB | 0 | 0 bytes | 0 bytes | 51.82 KiB | + * | mysys/charset | 3 | 196.52 µs | 17.61 µs | 65.51 µs | 137.33 µs | 1 | 17.83 KiB | 17.83 KiB | 0 | 0 bytes | 0 bytes | 17.83 KiB | + * | sql/partition | 81 | 18.87 ms | 888.08 ns | 232.92 µs | 4.67 ms | 66 | 2.75 KiB | 43 bytes | 8 | 288 bytes | 36 bytes | 3.04 KiB | + * | sql/dbopt | 329166 | 26.95 s | 2.06 µs | 81.89 µs | 178.71 ms | 0 | 0 bytes | 0 bytes | 9 | 585 bytes | 65 bytes | 585 bytes | + * | sql/relaylog | 7 | 1.18 ms | 838.84 ns | 168.30 µs | 892.70 µs | 0 | 0 bytes | 0 bytes | 1 | 120 bytes | 120 bytes | 120 bytes | + * | mysys/cnf | 5 | 171.61 µs | 303.26 ns | 34.32 µs | 115.21 µs | 3 | 56 bytes | 19 bytes | 0 | 0 bytes | 0 bytes | 56 bytes | + * | sql/pid | 3 | 220.55 µs | 29.29 µs | 73.52 µs | 143.11 µs | 0 | 0 bytes | 0 bytes | 1 | 5 bytes | 5 bytes | 5 bytes | + * | sql/casetest | 1 | 121.19 µs | 121.19 µs | 121.19 µs | 121.19 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | + * | sql/binlog_index | 5 | 593.47 µs | 1.07 µs | 118.69 µs | 535.90 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | + * | sql/misc | 23 | 2.73 ms | 65.14 µs | 118.50 µs | 255.31 µs | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | 0 bytes | + * +--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ * */ @@ -48,7 +48,7 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW io_global_by_wait_by_bytes ( event_name, - count_star, + total, total_latency, min_latency, avg_latency, @@ -62,18 +62,18 @@ VIEW io_global_by_wait_by_bytes ( total_requested ) AS SELECT SUBSTRING_INDEX(event_name, '/', -2) event_name, - count_star, - sys.format_time(sum_timer_wait) total_latency, - sys.format_time(min_timer_wait) min_latency, - sys.format_time(avg_timer_wait) avg_latency, - sys.format_time(max_timer_wait) max_latency, + count_star AS total, + sys.format_time(sum_timer_wait) AS total_latency, + sys.format_time(min_timer_wait) AS min_latency, + sys.format_time(avg_timer_wait) AS avg_latency, + sys.format_time(max_timer_wait) AS max_latency, count_read, - sys.format_bytes(sum_number_of_bytes_read) total_read, - sys.format_bytes(IFNULL(sum_number_of_bytes_read / count_read, 0)) avg_read, + sys.format_bytes(sum_number_of_bytes_read) AS total_read, + sys.format_bytes(IFNULL(sum_number_of_bytes_read / count_read, 0)) AS avg_read, count_write, - sys.format_bytes(sum_number_of_bytes_write) total_written, - sys.format_bytes(IFNULL(sum_number_of_bytes_write / count_write, 0)) avg_written, - sys.format_bytes(sum_number_of_bytes_write + sum_number_of_bytes_read) total_requested + sys.format_bytes(sum_number_of_bytes_write) AS total_written, + sys.format_bytes(IFNULL(sum_number_of_bytes_write / count_write, 0)) AS avg_written, + sys.format_bytes(sum_number_of_bytes_write + sum_number_of_bytes_read) AS total_requested FROM performance_schema.file_summary_by_event_name WHERE event_name LIKE 'wait/io/file/%' AND count_star > 0 @@ -85,21 +85,21 @@ SELECT SUBSTRING_INDEX(event_name, '/', -2) event_name, * Shows the top global IO consumer classes by bytes usage. * * mysql> select * from x$io_global_by_wait_by_bytes; - * +-------------------------+------------+---------------+-------------+-------------+--------------+------------+------------+------------+-------------+---------------+-------------+-----------------+ - * | event_name | count_star | total_latency | min_latency | avg_latency | max_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | total_requested | - * +-------------------------+------------+---------------+-------------+-------------+--------------+------------+------------+------------+-------------+---------------+-------------+-----------------+ - * | innodb/innodb_data_file | 151 | 334405721910 | 8399560 | 2214607429 | 107444600380 | 147 | 4472832 | 30427.4286 | 0 | 0 | 0.0000 | 4472832 | - * | sql/FRM | 555 | 147752034170 | 674830 | 266219881 | 57705900850 | 270 | 112174 | 415.4593 | 0 | 0 | 0.0000 | 112174 | - * | innodb/innodb_log_file | 22 | 56776429970 | 2476890 | 2580746816 | 18883021430 | 6 | 69632 | 11605.3333 | 5 | 2560 | 512.0000 | 72192 | - * | sql/ERRMSG | 5 | 11862056180 | 14883960 | 2372411236 | 11109473700 | 3 | 44724 | 14908.0000 | 0 | 0 | 0.0000 | 44724 | - * | mysys/charset | 3 | 7256869230 | 19796270 | 2418956410 | 7198498320 | 1 | 18317 | 18317.0000 | 0 | 0 | 0.0000 | 18317 | - * | myisam/kfile | 135 | 10194698280 | 784160 | 75516283 | 2593514950 | 40 | 9216 | 230.4000 | 33 | 1017 | 30.8182 | 10233 | - * | myisam/dfile | 68 | 10527909730 | 772850 | 154822201 | 7600014630 | 9 | 6667 | 740.7778 | 0 | 0 | 0.0000 | 6667 | - * | sql/pid | 3 | 216507330 | 41296580 | 72169110 | 100617530 | 0 | 0 | 0.0000 | 1 | 6 | 6.0000 | 6 | - * | sql/casetest | 5 | 185261570 | 4105530 | 37052314 | 113488310 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | 0 | - * | sql/global_ddl_log | 2 | 21538010 | 3121560 | 10769005 | 18416450 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | 0 | - * | sql/dbopt | 10 | 1004267680 | 1164930 | 100426768 | 939894930 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | 0 | - * +-------------------------+------------+---------------+-------------+-------------+--------------+------------+------------+------------+-------------+---------------+-------------+-----------------+ + * +-------------------------+-------+---------------+-------------+-------------+--------------+------------+------------+------------+-------------+---------------+-------------+-----------------+ + * | event_name | total | total_latency | min_latency | avg_latency | max_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | total_requested | + * +-------------------------+-------+---------------+-------------+-------------+--------------+------------+------------+------------+-------------+---------------+-------------+-----------------+ + * | innodb/innodb_data_file | 151 | 334405721910 | 8399560 | 2214607429 | 107444600380 | 147 | 4472832 | 30427.4286 | 0 | 0 | 0.0000 | 4472832 | + * | sql/FRM | 555 | 147752034170 | 674830 | 266219881 | 57705900850 | 270 | 112174 | 415.4593 | 0 | 0 | 0.0000 | 112174 | + * | innodb/innodb_log_file | 22 | 56776429970 | 2476890 | 2580746816 | 18883021430 | 6 | 69632 | 11605.3333 | 5 | 2560 | 512.0000 | 72192 | + * | sql/ERRMSG | 5 | 11862056180 | 14883960 | 2372411236 | 11109473700 | 3 | 44724 | 14908.0000 | 0 | 0 | 0.0000 | 44724 | + * | mysys/charset | 3 | 7256869230 | 19796270 | 2418956410 | 7198498320 | 1 | 18317 | 18317.0000 | 0 | 0 | 0.0000 | 18317 | + * | myisam/kfile | 135 | 10194698280 | 784160 | 75516283 | 2593514950 | 40 | 9216 | 230.4000 | 33 | 1017 | 30.8182 | 10233 | + * | myisam/dfile | 68 | 10527909730 | 772850 | 154822201 | 7600014630 | 9 | 6667 | 740.7778 | 0 | 0 | 0.0000 | 6667 | + * | sql/pid | 3 | 216507330 | 41296580 | 72169110 | 100617530 | 0 | 0 | 0.0000 | 1 | 6 | 6.0000 | 6 | + * | sql/casetest | 5 | 185261570 | 4105530 | 37052314 | 113488310 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | 0 | + * | sql/global_ddl_log | 2 | 21538010 | 3121560 | 10769005 | 18416450 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | 0 | + * | sql/dbopt | 10 | 1004267680 | 1164930 | 100426768 | 939894930 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | 0 | + * +-------------------------+-------+---------------+-------------+-------------+--------------+------------+------------+------------+-------------+---------------+-------------+-----------------+ * */ @@ -109,7 +109,7 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW x$io_global_by_wait_by_bytes ( event_name, - count_star, + total, total_latency, min_latency, avg_latency, @@ -122,19 +122,19 @@ VIEW x$io_global_by_wait_by_bytes ( avg_written, total_requested ) AS -SELECT SUBSTRING_INDEX(event_name, '/', -2) event_name, - count_star, - sum_timer_wait total_latency, - min_timer_wait min_latency, - avg_timer_wait avg_latency, - max_timer_wait max_latency, +SELECT SUBSTRING_INDEX(event_name, '/', -2) AS event_name, + count_star AS total, + sum_timer_wait AS total_latency, + min_timer_wait AS min_latency, + avg_timer_wait AS avg_latency, + max_timer_wait AS max_latency, count_read, - sum_number_of_bytes_read total_read, - IFNULL(sum_number_of_bytes_read / count_read, 0) avg_read, + sum_number_of_bytes_read AS total_read, + IFNULL(sum_number_of_bytes_read / count_read, 0) AS avg_read, count_write, - sum_number_of_bytes_write total_written, - IFNULL(sum_number_of_bytes_write / count_write, 0) avg_written, - sum_number_of_bytes_write + sum_number_of_bytes_read total_requested + sum_number_of_bytes_write AS total_written, + IFNULL(sum_number_of_bytes_write / count_write, 0) AS avg_written, + sum_number_of_bytes_write + sum_number_of_bytes_read AS total_requested FROM performance_schema.file_summary_by_event_name WHERE event_name LIKE 'wait/io/file/%' AND count_star > 0 diff --git a/views/p_s/io_global_by_wait_by_latency.sql b/views/p_s/io_global_by_wait_by_latency.sql index da6b649..98cc11c 100644 --- a/views/p_s/io_global_by_wait_by_latency.sql +++ b/views/p_s/io_global_by_wait_by_latency.sql @@ -19,26 +19,26 @@ * Shows the top global IO consumers by latency. * * mysql> SELECT * FROM io_global_by_wait_by_latency; - * +-------------------------+------------+-----------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ - * | event_name | count_star | total | avg_latency | max_latency | read_latency | write_latency | misc_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | - * +-------------------------+------------+-----------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ - * | sql/file_parser | 5433 | 30.20 s | 5.56 ms | 203.65 ms | 22.08 ms | 24.89 ms | 30.16 s | 24 | 6.18 KiB | 264 bytes | 737 | 2.15 MiB | 2.99 KiB | - * | innodb/innodb_data_file | 1344 | 1.52 s | 1.13 ms | 350.70 ms | 203.82 ms | 450.96 ms | 868.21 ms | 147 | 2.30 MiB | 16.00 KiB | 1001 | 53.61 MiB | 54.84 KiB | - * | innodb/innodb_log_file | 828 | 893.48 ms | 1.08 ms | 30.11 ms | 16.32 ms | 705.89 ms | 171.27 ms | 6 | 68.00 KiB | 11.33 KiB | 413 | 2.19 MiB | 5.42 KiB | - * | myisam/kfile | 7642 | 242.34 ms | 31.71 us | 19.27 ms | 73.60 ms | 23.48 ms | 145.26 ms | 758 | 135.63 KiB | 183 bytes | 4386 | 232.52 KiB | 54 bytes | - * | myisam/dfile | 12540 | 223.47 ms | 17.82 us | 32.50 ms | 87.76 ms | 16.97 ms | 118.74 ms | 5390 | 4.49 MiB | 873 bytes | 1448 | 2.65 MiB | 1.88 KiB | - * | csv/metadata | 8 | 28.98 ms | 3.62 ms | 20.15 ms | 399.27 us | 0 ps | 28.58 ms | 2 | 70 bytes | 35 bytes | 0 | 0 bytes | 0 bytes | - * | mysys/charset | 3 | 24.24 ms | 8.08 ms | 24.15 ms | 24.15 ms | 0 ps | 93.18 us | 1 | 17.31 KiB | 17.31 KiB | 0 | 0 bytes | 0 bytes | - * | sql/ERRMSG | 5 | 20.43 ms | 4.09 ms | 19.31 ms | 20.32 ms | 0 ps | 103.20 us | 3 | 58.97 KiB | 19.66 KiB | 0 | 0 bytes | 0 bytes | - * | mysys/cnf | 5 | 11.37 ms | 2.27 ms | 11.28 ms | 11.29 ms | 0 ps | 78.22 us | 3 | 56 bytes | 19 bytes | 0 | 0 bytes | 0 bytes | - * | sql/dbopt | 57 | 4.04 ms | 70.92 us | 843.70 us | 0 ps | 186.43 us | 3.86 ms | 0 | 0 bytes | 0 bytes | 7 | 431 bytes | 62 bytes | - * | csv/data | 4 | 411.55 us | 102.89 us | 234.89 us | 0 ps | 0 ps | 411.55 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | - * | sql/misc | 22 | 340.38 us | 15.47 us | 33.77 us | 0 ps | 0 ps | 340.38 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | - * | archive/data | 39 | 277.86 us | 7.12 us | 16.18 us | 0 ps | 0 ps | 277.86 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | - * | sql/pid | 3 | 218.03 us | 72.68 us | 154.84 us | 0 ps | 21.64 us | 196.39 us | 0 | 0 bytes | 0 bytes | 1 | 6 bytes | 6 bytes | - * | sql/casetest | 5 | 197.15 us | 39.43 us | 126.31 us | 0 ps | 0 ps | 197.15 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | - * | sql/global_ddl_log | 2 | 14.60 us | 7.30 us | 12.12 us | 0 ps | 0 ps | 14.60 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | - * +-------------------------+------------+-----------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ + * +-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ + * | event_name | total | total_latency | avg_latency | max_latency | read_latency | write_latency | misc_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | + * +-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ + * | sql/file_parser | 5433 | 30.20 s | 5.56 ms | 203.65 ms | 22.08 ms | 24.89 ms | 30.16 s | 24 | 6.18 KiB | 264 bytes | 737 | 2.15 MiB | 2.99 KiB | + * | innodb/innodb_data_file | 1344 | 1.52 s | 1.13 ms | 350.70 ms | 203.82 ms | 450.96 ms | 868.21 ms | 147 | 2.30 MiB | 16.00 KiB | 1001 | 53.61 MiB | 54.84 KiB | + * | innodb/innodb_log_file | 828 | 893.48 ms | 1.08 ms | 30.11 ms | 16.32 ms | 705.89 ms | 171.27 ms | 6 | 68.00 KiB | 11.33 KiB | 413 | 2.19 MiB | 5.42 KiB | + * | myisam/kfile | 7642 | 242.34 ms | 31.71 us | 19.27 ms | 73.60 ms | 23.48 ms | 145.26 ms | 758 | 135.63 KiB | 183 bytes | 4386 | 232.52 KiB | 54 bytes | + * | myisam/dfile | 12540 | 223.47 ms | 17.82 us | 32.50 ms | 87.76 ms | 16.97 ms | 118.74 ms | 5390 | 4.49 MiB | 873 bytes | 1448 | 2.65 MiB | 1.88 KiB | + * | csv/metadata | 8 | 28.98 ms | 3.62 ms | 20.15 ms | 399.27 us | 0 ps | 28.58 ms | 2 | 70 bytes | 35 bytes | 0 | 0 bytes | 0 bytes | + * | mysys/charset | 3 | 24.24 ms | 8.08 ms | 24.15 ms | 24.15 ms | 0 ps | 93.18 us | 1 | 17.31 KiB | 17.31 KiB | 0 | 0 bytes | 0 bytes | + * | sql/ERRMSG | 5 | 20.43 ms | 4.09 ms | 19.31 ms | 20.32 ms | 0 ps | 103.20 us | 3 | 58.97 KiB | 19.66 KiB | 0 | 0 bytes | 0 bytes | + * | mysys/cnf | 5 | 11.37 ms | 2.27 ms | 11.28 ms | 11.29 ms | 0 ps | 78.22 us | 3 | 56 bytes | 19 bytes | 0 | 0 bytes | 0 bytes | + * | sql/dbopt | 57 | 4.04 ms | 70.92 us | 843.70 us | 0 ps | 186.43 us | 3.86 ms | 0 | 0 bytes | 0 bytes | 7 | 431 bytes | 62 bytes | + * | csv/data | 4 | 411.55 us | 102.89 us | 234.89 us | 0 ps | 0 ps | 411.55 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | + * | sql/misc | 22 | 340.38 us | 15.47 us | 33.77 us | 0 ps | 0 ps | 340.38 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | + * | archive/data | 39 | 277.86 us | 7.12 us | 16.18 us | 0 ps | 0 ps | 277.86 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | + * | sql/pid | 3 | 218.03 us | 72.68 us | 154.84 us | 0 ps | 21.64 us | 196.39 us | 0 | 0 bytes | 0 bytes | 1 | 6 bytes | 6 bytes | + * | sql/casetest | 5 | 197.15 us | 39.43 us | 126.31 us | 0 ps | 0 ps | 197.15 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | + * | sql/global_ddl_log | 2 | 14.60 us | 7.30 us | 12.12 us | 0 ps | 0 ps | 14.60 us | 0 | 0 bytes | 0 bytes | 0 | 0 bytes | 0 bytes | + * +-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ * */ @@ -62,20 +62,20 @@ VIEW io_global_by_wait_by_latency ( total_written, avg_written ) AS -SELECT SUBSTRING_INDEX(event_name, '/', -2) event_name, +SELECT SUBSTRING_INDEX(event_name, '/', -2) AS event_name, count_star AS total, - sys.format_time(sum_timer_wait) total_latency, - sys.format_time(avg_timer_wait) avg_latency, - sys.format_time(max_timer_wait) max_latency, - sys.format_time(sum_timer_read) read_latency, - sys.format_time(sum_timer_write) write_latency, - sys.format_time(sum_timer_misc) misc_latency, + sys.format_time(sum_timer_wait) AS total_latency, + sys.format_time(avg_timer_wait) AS avg_latency, + sys.format_time(max_timer_wait) AS max_latency, + sys.format_time(sum_timer_read) AS read_latency, + sys.format_time(sum_timer_write) AS write_latency, + sys.format_time(sum_timer_misc) AS misc_latency, count_read, - sys.format_bytes(sum_number_of_bytes_read) total_read, - sys.format_bytes(IFNULL(sum_number_of_bytes_read / count_read, 0)) avg_read, + sys.format_bytes(sum_number_of_bytes_read) AS total_read, + sys.format_bytes(IFNULL(sum_number_of_bytes_read / count_read, 0)) AS avg_read, count_write, - sys.format_bytes(sum_number_of_bytes_write) total_written, - sys.format_bytes(IFNULL(sum_number_of_bytes_write / count_write, 0)) avg_written + sys.format_bytes(sum_number_of_bytes_write) AS total_written, + sys.format_bytes(IFNULL(sum_number_of_bytes_write / count_write, 0)) AS avg_written FROM performance_schema.file_summary_by_event_name WHERE event_name LIKE 'wait/io/file/%' AND count_star > 0 @@ -87,27 +87,27 @@ SELECT SUBSTRING_INDEX(event_name, '/', -2) event_name, * Shows the top global IO consumers by latency. * * mysql> select * from x$io_global_by_wait_by_latency; - * +-------------------------+------------+----------------+-------------+--------------+--------------+---------------+----------------+------------+------------+------------+-------------+---------------+-------------+ - * | event_name | count_star | total | avg_latency | max_latency | read_latency | write_latency | misc_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | - * +-------------------------+------------+----------------+-------------+--------------+--------------+---------------+----------------+------------+------------+------------+-------------+---------------+-------------+ - * | sql/file_parser | 5945 | 33615441247050 | 5654405471 | 203652881640 | 22093704230 | 27389668280 | 33565957874540 | 26 | 7008 | 269.5385 | 808 | 2479209 | 3068.3280 | - * | sql/FRM | 6332 | 1755386796800 | 277224688 | 145624702340 | 519139578620 | 1677016640 | 1234570201540 | 2040 | 865905 | 424.4632 | 439 | 103445 | 235.6378 | - * | innodb/innodb_data_file | 1344 | 1522989889460 | 1133176798 | 350700491310 | 203817502460 | 450959403830 | 868212983170 | 147 | 2408448 | 16384.0000 | 1001 | 56213504 | 56157.3467 | - * | innodb/innodb_log_file | 828 | 893475794640 | 1079076921 | 30108124800 | 16315236730 | 705886928240 | 171273629670 | 6 | 69632 | 11605.3333 | 413 | 2294272 | 5555.1380 | - * | myisam/kfile | 7826 | 246001992860 | 31433883 | 19265276810 | 74419162870 | 23923730090 | 147659099900 | 770 | 141058 | 183.1922 | 4516 | 249602 | 55.2706 | - * | myisam/dfile | 13431 | 228191713620 | 16989882 | 32500163410 | 89162969350 | 17341973610 | 121686770660 | 5819 | 4873176 | 837.4594 | 1577 | 2853444 | 1809.4128 | - * | csv/metadata | 8 | 28975194560 | 3621899320 | 20148109020 | 399265620 | 0 | 28575928940 | 2 | 70 | 35.0000 | 0 | 0 | 0.0000 | - * | mysys/charset | 3 | 24244722970 | 8081574072 | 24151547420 | 24151547420 | 0 | 93175550 | 1 | 17722 | 17722.0000 | 0 | 0 | 0.0000 | - * | sql/ERRMSG | 5 | 20427386850 | 4085477370 | 19312386730 | 20324183100 | 0 | 103203750 | 3 | 60390 | 20130.0000 | 0 | 0 | 0.0000 | - * | mysys/cnf | 5 | 11366169230 | 2273233846 | 11283602460 | 11287953040 | 0 | 78216190 | 3 | 56 | 18.6667 | 0 | 0 | 0.0000 | - * | sql/dbopt | 57 | 4042348570 | 70918224 | 843703380 | 0 | 186430270 | 3855918300 | 0 | 0 | 0.0000 | 7 | 431 | 61.5714 | - * | csv/data | 4 | 411548280 | 102887070 | 234886080 | 0 | 0 | 411548280 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | - * | sql/misc | 24 | 369128240 | 15380092 | 33771660 | 0 | 0 | 369128240 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | - * | archive/data | 39 | 277856540 | 7124169 | 16180840 | 0 | 0 | 277856540 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | - * | sql/pid | 3 | 218026640 | 72675421 | 154841440 | 0 | 21639800 | 196386840 | 0 | 0 | 0.0000 | 1 | 6 | 6.0000 | - * | sql/casetest | 5 | 197152150 | 39430430 | 126310080 | 0 | 0 | 197152150 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | - * | sql/global_ddl_log | 2 | 14604980 | 7302490 | 12120550 | 0 | 0 | 14604980 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | - * +-------------------------+------------+----------------+-------------+--------------+--------------+---------------+----------------+------------+------------+------------+-------------+---------------+-------------+ + * +-------------------------+-------+----------------+-------------+--------------+--------------+---------------+----------------+------------+------------+------------+-------------+---------------+-------------+ + * | event_name | total | total_latency | avg_latency | max_latency | read_latency | write_latency | misc_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | + * +-------------------------+-------+----------------+-------------+--------------+--------------+---------------+----------------+------------+------------+------------+-------------+---------------+-------------+ + * | sql/file_parser | 5945 | 33615441247050 | 5654405471 | 203652881640 | 22093704230 | 27389668280 | 33565957874540 | 26 | 7008 | 269.5385 | 808 | 2479209 | 3068.3280 | + * | sql/FRM | 6332 | 1755386796800 | 277224688 | 145624702340 | 519139578620 | 1677016640 | 1234570201540 | 2040 | 865905 | 424.4632 | 439 | 103445 | 235.6378 | + * | innodb/innodb_data_file | 1344 | 1522989889460 | 1133176798 | 350700491310 | 203817502460 | 450959403830 | 868212983170 | 147 | 2408448 | 16384.0000 | 1001 | 56213504 | 56157.3467 | + * | innodb/innodb_log_file | 828 | 893475794640 | 1079076921 | 30108124800 | 16315236730 | 705886928240 | 171273629670 | 6 | 69632 | 11605.3333 | 413 | 2294272 | 5555.1380 | + * | myisam/kfile | 7826 | 246001992860 | 31433883 | 19265276810 | 74419162870 | 23923730090 | 147659099900 | 770 | 141058 | 183.1922 | 4516 | 249602 | 55.2706 | + * | myisam/dfile | 13431 | 228191713620 | 16989882 | 32500163410 | 89162969350 | 17341973610 | 121686770660 | 5819 | 4873176 | 837.4594 | 1577 | 2853444 | 1809.4128 | + * | csv/metadata | 8 | 28975194560 | 3621899320 | 20148109020 | 399265620 | 0 | 28575928940 | 2 | 70 | 35.0000 | 0 | 0 | 0.0000 | + * | mysys/charset | 3 | 24244722970 | 8081574072 | 24151547420 | 24151547420 | 0 | 93175550 | 1 | 17722 | 17722.0000 | 0 | 0 | 0.0000 | + * | sql/ERRMSG | 5 | 20427386850 | 4085477370 | 19312386730 | 20324183100 | 0 | 103203750 | 3 | 60390 | 20130.0000 | 0 | 0 | 0.0000 | + * | mysys/cnf | 5 | 11366169230 | 2273233846 | 11283602460 | 11287953040 | 0 | 78216190 | 3 | 56 | 18.6667 | 0 | 0 | 0.0000 | + * | sql/dbopt | 57 | 4042348570 | 70918224 | 843703380 | 0 | 186430270 | 3855918300 | 0 | 0 | 0.0000 | 7 | 431 | 61.5714 | + * | csv/data | 4 | 411548280 | 102887070 | 234886080 | 0 | 0 | 411548280 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | + * | sql/misc | 24 | 369128240 | 15380092 | 33771660 | 0 | 0 | 369128240 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | + * | archive/data | 39 | 277856540 | 7124169 | 16180840 | 0 | 0 | 277856540 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | + * | sql/pid | 3 | 218026640 | 72675421 | 154841440 | 0 | 21639800 | 196386840 | 0 | 0 | 0.0000 | 1 | 6 | 6.0000 | + * | sql/casetest | 5 | 197152150 | 39430430 | 126310080 | 0 | 0 | 197152150 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | + * | sql/global_ddl_log | 2 | 14604980 | 7302490 | 12120550 | 0 | 0 | 14604980 | 0 | 0 | 0.0000 | 0 | 0 | 0.0000 | + * +-------------------------+-------+----------------+-------------+--------------+--------------+---------------+----------------+------------+------------+------------+-------------+---------------+-------------+ * */ @@ -131,20 +131,20 @@ VIEW x$io_global_by_wait_by_latency ( total_written, avg_written ) AS -SELECT SUBSTRING_INDEX(event_name, '/', -2) event_name, +SELECT SUBSTRING_INDEX(event_name, '/', -2) AS event_name, count_star AS total, - sum_timer_wait total_latency, - avg_timer_wait avg_latency, - max_timer_wait max_latency, - sum_timer_read read_latency, - sum_timer_write write_latency, - sum_timer_misc misc_latency, + sum_timer_wait AS total_latency, + avg_timer_wait AS avg_latency, + max_timer_wait AS max_latency, + sum_timer_read AS read_latency, + sum_timer_write AS write_latency, + sum_timer_misc AS misc_latency, count_read, - sum_number_of_bytes_read total_read, - IFNULL(sum_number_of_bytes_read / count_read, 0) avg_read, + sum_number_of_bytes_read AS total_read, + IFNULL(sum_number_of_bytes_read / count_read, 0) AS avg_read, count_write, - sum_number_of_bytes_write total_written, - IFNULL(sum_number_of_bytes_write / count_write, 0) avg_written + sum_number_of_bytes_write AS total_written, + IFNULL(sum_number_of_bytes_write / count_write, 0) AS avg_written FROM performance_schema.file_summary_by_event_name WHERE event_name LIKE 'wait/io/file/%' AND count_star > 0 diff --git a/views/p_s/user_summary.sql b/views/p_s/user_summary.sql index 19b7748..77043df 100644 --- a/views/p_s/user_summary.sql +++ b/views/p_s/user_summary.sql @@ -31,11 +31,22 @@ CREATE OR REPLACE ALGORITHM = TEMPTABLE DEFINER = 'root'@'localhost' SQL SECURITY INVOKER -VIEW user_summary AS +VIEW user_summary ( + user, + statements, + statement_latency, + statement_avg_latency, + table_scans, + file_ios, + file_io_latency, + current_connections, + total_connections, + unique_hosts +) AS SELECT accounts.user, - SUM(stmt.count) AS statements, + SUM(stmt.total) AS statements, sys.format_time(SUM(stmt.total_latency)) AS statement_latency, - sys.format_time(SUM(stmt.total_latency) / SUM(stmt.count)) AS statement_avg_latency, + sys.format_time(SUM(stmt.total_latency) / SUM(stmt.total)) AS statement_avg_latency, SUM(stmt.full_scans) AS table_scans, SUM(io.ios) AS file_ios, sys.format_time(SUM(io.io_latency)) AS file_io_latency, @@ -66,11 +77,22 @@ CREATE OR REPLACE ALGORITHM = TEMPTABLE DEFINER = 'root'@'localhost' SQL SECURITY INVOKER -VIEW x$user_summary AS +VIEW x$user_summary ( + user, + statements, + statement_latency, + statement_avg_latency, + table_scans, + file_ios, + file_io_latency, + current_connections, + total_connections, + unique_hosts +) AS SELECT accounts.user, - SUM(stmt.count) AS statements, + SUM(stmt.total) AS statements, SUM(stmt.total_latency) AS statement_latency, - SUM(stmt.total_latency) / SUM(stmt.count) AS statement_avg_latency, + SUM(stmt.total_latency) / SUM(stmt.total) AS statement_avg_latency, SUM(stmt.full_scans) AS table_scans, SUM(io.ios) AS file_ios, SUM(io.io_latency) AS file_io_latency, diff --git a/views/p_s/user_summary_57.sql b/views/p_s/user_summary_57.sql index c027b77..8a30c7c 100644 --- a/views/p_s/user_summary_57.sql +++ b/views/p_s/user_summary_57.sql @@ -19,12 +19,12 @@ * Summarizes statement activity and connections by user * * mysql> select * from user_summary; - * +------+------------------+---------------+-------------+---------------------+-------------------+--------------+----------------+------------------------+ - * | user | total_statements | total_latency | avg_latency | current_connections | total_connections | unique_hosts | current_memory | total_memory_allocated | - * +------+------------------+---------------+-------------+---------------------+-------------------+--------------+----------------+------------------------+ - * | root | 5663 | 00:01:47.14 | 18.92 ms | 1 | 1 | 1 | 1.41 MiB | 543.55 MiB | - * | mark | 225 | 14.49 s | 64.40 ms | 1 | 1 | 1 | 707.60 KiB | 81.02 MiB | - * +------+------------------+---------------+-------------+---------------------+-------------------+--------------+----------------+------------------------+ + * +------+------------+---------------+-------------+---------------------+-------------------+--------------+----------------+------------------------+ + * | user | statements | total_latency | avg_latency | current_connections | total_connections | unique_hosts | current_memory | total_memory_allocated | + * +------+------------+---------------+-------------+---------------------+-------------------+--------------+----------------+------------------------+ + * | root | 5663 | 00:01:47.14 | 18.92 ms | 1 | 1 | 1 | 1.41 MiB | 543.55 MiB | + * | mark | 225 | 14.49 s | 64.40 ms | 1 | 1 | 1 | 707.60 KiB | 81.02 MiB | + * +------+------------+---------------+-------------+---------------------+-------------------+--------------+----------------+------------------------+ * */ @@ -32,11 +32,24 @@ CREATE OR REPLACE ALGORITHM = TEMPTABLE DEFINER = 'root'@'localhost' SQL SECURITY INVOKER -VIEW user_summary AS +VIEW user_summary ( + user, + statements, + statement_latency, + statement_avg_latency, + table_scans, + file_ios, + file_io_latency, + current_connections, + total_connections, + unique_hosts, + current_memory, + total_memory_allocated +) AS SELECT accounts.user, - SUM(stmt.count) AS statements, + SUM(stmt.total) AS statements, sys.format_time(SUM(stmt.total_latency)) AS statement_latency, - sys.format_time(SUM(stmt.total_latency) / SUM(stmt.count)) AS statement_avg_latency, + sys.format_time(SUM(stmt.total_latency) / SUM(stmt.total)) AS statement_avg_latency, SUM(stmt.full_scans) AS table_scans, SUM(io.ios) AS file_ios, sys.format_time(SUM(io.io_latency)) AS file_io_latency, @@ -58,12 +71,12 @@ SELECT accounts.user, * Summarizes statement activity and connections by user * * mysql> select * from x$user_summary; - * +------+------------------+-----------------+------------------+---------------------+-------------------+--------------+----------------+------------------------+ - * | user | total_statements | total_latency | avg_latency | current_connections | total_connections | unique_hosts | current_memory | total_memory_allocated | - * +------+------------------+-----------------+------------------+---------------------+-------------------+--------------+----------------+------------------------+ - * | root | 5685 | 107175100271000 | 18852260381.8821 | 1 | 1 | 1 | 1459022 | 572855680 | - * | mark | 225 | 14489223428000 | 64396548568.8889 | 1 | 1 | 1 | 724578 | 84958286 | - * +------+------------------+-----------------+------------------+---------------------+-------------------+--------------+----------------+------------------------+ + * +------+------------+-----------------+------------------+---------------------+-------------------+--------------+----------------+------------------------+ + * | user | statements | total_latency | avg_latency | current_connections | total_connections | unique_hosts | current_memory | total_memory_allocated | + * +------+------------+-----------------+------------------+---------------------+-------------------+--------------+----------------+------------------------+ + * | root | 5685 | 107175100271000 | 18852260381.8821 | 1 | 1 | 1 | 1459022 | 572855680 | + * | mark | 225 | 14489223428000 | 64396548568.8889 | 1 | 1 | 1 | 724578 | 84958286 | + * +------+------------+-----------------+------------------+---------------------+-------------------+--------------+----------------+------------------------+ * */ @@ -71,11 +84,24 @@ CREATE OR REPLACE ALGORITHM = TEMPTABLE DEFINER = 'root'@'localhost' SQL SECURITY INVOKER -VIEW x$user_summary AS +VIEW x$user_summary ( + user, + statements, + statement_latency, + statement_avg_latency, + table_scans, + file_ios, + file_io_latency, + current_connections, + total_connections, + unique_hosts, + current_memory, + total_memory_allocated +) AS SELECT accounts.user, - SUM(stmt.count) AS statements, + SUM(stmt.total) AS statements, SUM(stmt.total_latency) AS statement_latency, - SUM(stmt.total_latency) / SUM(stmt.count) AS statement_avg_latency, + SUM(stmt.total_latency) / SUM(stmt.total) AS statement_avg_latency, SUM(stmt.full_scans) AS table_scans, SUM(io.ios) AS file_ios, SUM(io.io_latency) AS file_io_latency, @@ -90,4 +116,3 @@ SELECT accounts.user, JOIN sys.x$memory_by_user_by_current_bytes mem ON accounts.user = mem.user WHERE accounts.user IS NOT NULL GROUP BY accounts.user; - diff --git a/views/p_s/user_summary_by_file_io_type.sql b/views/p_s/user_summary_by_file_io_type.sql index 0c794d8..48c1116 100644 --- a/views/p_s/user_summary_by_file_io_type.sql +++ b/views/p_s/user_summary_by_file_io_type.sql @@ -58,9 +58,9 @@ VIEW user_summary_by_file_io_type ( ) AS SELECT IF(user IS NULL, 'background', user) AS user, event_name, - count_star total, - sys.format_time(sum_timer_wait) latency, - sys.format_time(max_timer_wait) max_latency + count_star AS total, + sys.format_time(sum_timer_wait) AS latency, + sys.format_time(max_timer_wait) AS max_latency FROM performance_schema.events_waits_summary_by_user_by_event_name WHERE event_name LIKE 'wait/io/file%' AND count_star > 0 @@ -111,9 +111,9 @@ VIEW x$user_summary_by_file_io_type ( ) AS SELECT IF(user IS NULL, 'background', user) AS user, event_name, - count_star total, - sum_timer_wait latency, - max_timer_wait max_latency + count_star AS total, + sum_timer_wait AS latency, + max_timer_wait AS max_latency FROM performance_schema.events_waits_summary_by_user_by_event_name WHERE event_name LIKE 'wait/io/file%' AND count_star > 0 diff --git a/views/p_s/user_summary_by_stages.sql b/views/p_s/user_summary_by_stages.sql index 748ca5f..56b541f 100644 --- a/views/p_s/user_summary_by_stages.sql +++ b/views/p_s/user_summary_by_stages.sql @@ -20,7 +20,7 @@ * * mysql> select * from user_summary_by_stages; * +------+--------------------------------+-------+-----------+-----------+ - * | user | event_name | count | wait_sum | wait_avg | + * | user | event_name | total | wait_sum | wait_avg | * +------+--------------------------------+-------+-----------+-----------+ * | root | stage/sql/Opening tables | 889 | 1.97 ms | 2.22 us | * | root | stage/sql/Creating sort index | 4 | 1.79 ms | 446.30 us | @@ -49,13 +49,13 @@ CREATE OR REPLACE VIEW user_summary_by_stages ( user, event_name, - count, + total, wait_sum, wait_avg ) AS SELECT user, event_name, - count_star AS count, + count_star AS total, sys.format_time(sum_timer_wait) AS wait_sum, sys.format_time(avg_timer_wait) AS wait_avg FROM performance_schema.events_stages_summary_by_user_by_event_name @@ -70,7 +70,7 @@ SELECT user, * * mysql> select * from x$user_summary_by_stages; * +------+--------------------------------+-------+-------------+-----------+ - * | user | event_name | count | wait_sum | wait_avg | + * | user | event_name | total | wait_sum | wait_avg | * +------+--------------------------------+-------+-------------+-----------+ * | root | stage/sql/Opening tables | 1114 | 71919037000 | 64559000 | * | root | stage/sql/Creating sort index | 5 | 2245762000 | 449152000 | @@ -98,13 +98,13 @@ CREATE OR REPLACE VIEW x$user_summary_by_stages ( user, event_name, - count, + total, wait_sum, wait_avg ) AS SELECT user, event_name, - count_star AS count, + count_star AS total, sum_timer_wait AS wait_sum, avg_timer_wait AS wait_avg FROM performance_schema.events_stages_summary_by_user_by_event_name diff --git a/views/p_s/user_summary_by_statement_latency.sql b/views/p_s/user_summary_by_statement_latency.sql index 2c6b4c2..ed9c622 100644 --- a/views/p_s/user_summary_by_statement_latency.sql +++ b/views/p_s/user_summary_by_statement_latency.sql @@ -20,7 +20,7 @@ * * mysql> select * from user_summary_by_statement_latency; * +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ - * | user | count | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | + * | user | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | * +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ * | root | 3381 | 00:02:09.13 | 1.48 s | 1.07 s | 1151 | 93947 | 150 | 91 | * +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -33,7 +33,7 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW user_summary_by_statement_latency ( user, - count, + total, total_latency, max_latency, lock_latency, @@ -43,7 +43,7 @@ VIEW user_summary_by_statement_latency ( full_scans ) AS SELECT user, - SUM(count) AS count, + SUM(total) AS total, sys.format_time(SUM(total_latency)) AS total_latency, sys.format_time(SUM(max_latency)) AS max_latency, sys.format_time(SUM(lock_latency)) AS lock_latency, @@ -62,7 +62,7 @@ SELECT user, * * mysql> select * from x$user_summary_by_statement_latency; * +------+-------+-----------------+---------------+---------------+-----------+---------------+---------------+------------+ - * | user | count | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | + * | user | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | * +------+-------+-----------------+---------------+---------------+-----------+---------------+---------------+------------+ * | root | 3382 | 129134039432000 | 1483246743000 | 1069831000000 | 1152 | 94286 | 150 | 92 | * +------+-------+-----------------+---------------+---------------+-----------+---------------+---------------+------------+ @@ -75,7 +75,7 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW x$user_summary_by_statement_latency ( user, - count, + total, total_latency, max_latency, lock_latency, @@ -85,7 +85,7 @@ VIEW x$user_summary_by_statement_latency ( full_scans ) AS SELECT user, - SUM(count) AS count, + SUM(total) AS total, SUM(total_latency) AS total_latency, SUM(max_latency) AS max_latency, SUM(lock_latency) AS lock_latency, diff --git a/views/p_s/user_summary_by_statement_type.sql b/views/p_s/user_summary_by_statement_type.sql index b80b870..be04c19 100644 --- a/views/p_s/user_summary_by_statement_type.sql +++ b/views/p_s/user_summary_by_statement_type.sql @@ -20,7 +20,7 @@ * * mysql> select * from user_summary_by_statement_type; * +------+----------------------+--------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ - * | user | statement | count | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | + * | user | statement | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | * +------+----------------------+--------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ * | root | create_view | 2063 | 00:05:04.20 | 463.58 ms | 1.42 s | 0 | 0 | 0 | 0 | * | root | select | 174 | 40.87 s | 28.83 s | 858.13 ms | 5212 | 157022 | 0 | 82 | @@ -39,7 +39,7 @@ CREATE OR REPLACE VIEW user_summary_by_statement_type ( user, statement, - count, + total, total_latency, max_latency, lock_latency, @@ -50,7 +50,7 @@ VIEW user_summary_by_statement_type ( ) AS SELECT user, SUBSTRING_INDEX(event_name, '/', -1) AS statement, - count_star AS count, + count_star AS total, sys.format_time(sum_timer_wait) AS total_latency, sys.format_time(max_timer_wait) AS max_latency, sys.format_time(sum_lock_time) AS lock_latency, @@ -70,7 +70,7 @@ SELECT user, * * mysql> select * from x$user_summary_by_statement_type; * +------+----------------------+--------+-----------------+----------------+----------------+-----------+---------------+---------------+------------+ - * | user | statement | count | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | + * | user | statement | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | * +------+----------------------+--------+-----------------+----------------+----------------+-----------+---------------+---------------+------------+ * | root | create_view | 2110 | 312717366332000 | 463578029000 | 1432355000000 | 0 | 0 | 0 | 0 | * | root | select | 177 | 41115690428000 | 28827579292000 | 858709000000 | 5254 | 157437 | 0 | 83 | @@ -89,7 +89,7 @@ CREATE OR REPLACE VIEW x$user_summary_by_statement_type ( user, statement, - count, + total, total_latency, max_latency, lock_latency, @@ -100,7 +100,7 @@ VIEW x$user_summary_by_statement_type ( ) AS SELECT user, SUBSTRING_INDEX(event_name, '/', -1) AS statement, - count_star AS count, + count_star AS total, sum_timer_wait AS total_latency, max_timer_wait AS max_latency, sum_lock_time AS lock_latency, diff --git a/views/p_s/wait_classes_global_by_avg_latency.sql b/views/p_s/wait_classes_global_by_avg_latency.sql index 2ba2367..748578a 100644 --- a/views/p_s/wait_classes_global_by_avg_latency.sql +++ b/views/p_s/wait_classes_global_by_avg_latency.sql @@ -19,16 +19,16 @@ * Lists the top wait classes by average latency, ignoring idle (this may be very large). * * mysql> select * from wait_classes_global_by_avg_latency where event_class != 'idle'; - * +-------------------+--------------+---------------+-------------+-------------+-------------+ - * | event_class | total_events | total_latency | min_latency | avg_latency | max_latency | - * +-------------------+--------------+---------------+-------------+-------------+-------------+ - * | wait/io/file | 543123 | 44.60 s | 19.44 ns | 82.11 µs | 4.21 s | - * | wait/io/table | 22002 | 766.60 ms | 148.72 ns | 34.84 µs | 44.97 ms | - * | wait/io/socket | 79613 | 967.17 ms | 0 ps | 12.15 µs | 27.10 ms | - * | wait/lock/table | 35409 | 18.68 ms | 65.45 ns | 527.51 ns | 969.88 µs | - * | wait/synch/rwlock | 37935 | 4.61 ms | 21.38 ns | 121.61 ns | 34.65 µs | - * | wait/synch/mutex | 390622 | 18.60 ms | 19.44 ns | 47.61 ns | 10.32 µs | - * +-------------------+--------------+---------------+-------------+-------------+-------------+ + * +-------------------+--------+---------------+-------------+-------------+-------------+ + * | event_class | total | total_latency | min_latency | avg_latency | max_latency | + * +-------------------+--------+---------------+-------------+-------------+-------------+ + * | wait/io/file | 543123 | 44.60 s | 19.44 ns | 82.11 µs | 4.21 s | + * | wait/io/table | 22002 | 766.60 ms | 148.72 ns | 34.84 µs | 44.97 ms | + * | wait/io/socket | 79613 | 967.17 ms | 0 ps | 12.15 µs | 27.10 ms | + * | wait/lock/table | 35409 | 18.68 ms | 65.45 ns | 527.51 ns | 969.88 µs | + * | wait/synch/rwlock | 37935 | 4.61 ms | 21.38 ns | 121.61 ns | 34.65 µs | + * | wait/synch/mutex | 390622 | 18.60 ms | 19.44 ns | 47.61 ns | 10.32 µs | + * +-------------------+--------+---------------+-------------+-------------+-------------+ * */ @@ -38,18 +38,18 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW wait_classes_global_by_avg_latency ( event_class, - total_events, + total, total_latency, min_latency, avg_latency, max_latency ) AS -SELECT SUBSTRING_INDEX(event_name,'/', 3) event_class, - SUM(COUNT_STAR) total_events, - sys.format_time(CAST(SUM(sum_timer_wait) AS UNSIGNED)) total_latency, - sys.format_time(MIN(min_timer_wait)) min_latency, - sys.format_time(SUM(sum_timer_wait) / SUM(COUNT_STAR)) avg_latency, - sys.format_time(CAST(MAX(max_timer_wait) AS UNSIGNED)) max_latency +SELECT SUBSTRING_INDEX(event_name,'/', 3) AS event_class, + SUM(COUNT_STAR) AS total, + sys.format_time(CAST(SUM(sum_timer_wait) AS UNSIGNED)) AS total_latency, + sys.format_time(MIN(min_timer_wait)) AS min_latency, + sys.format_time(SUM(sum_timer_wait) / SUM(COUNT_STAR)) AS avg_latency, + sys.format_time(CAST(MAX(max_timer_wait) AS UNSIGNED)) AS max_latency FROM performance_schema.events_waits_summary_global_by_event_name WHERE sum_timer_wait > 0 AND event_name != 'idle' @@ -62,16 +62,16 @@ SELECT SUBSTRING_INDEX(event_name,'/', 3) event_class, * Lists the top wait classes by average latency, ignoring idle (this may be very large). * * mysql> select * from x$wait_classes_global_by_avg_latency; - * +-------------------+--------------+-------------------+-------------+--------------------+------------------+ - * | event_class | total_events | total_latency | min_latency | avg_latency | max_latency | - * +-------------------+--------------+-------------------+-------------+--------------------+------------------+ - * | idle | 4331 | 16044682716000000 | 2000000 | 3704613880397.1369 | 1593550454000000 | - * | wait/io/file | 23037 | 20856702551880 | 0 | 905356711.0249 | 350700491310 | - * | wait/io/table | 224924 | 719670285750 | 116870 | 3199615.3623 | 208579012460 | - * | wait/lock/table | 6972 | 3674766030 | 109330 | 527074.8752 | 8855730 | - * | wait/synch/rwlock | 11916 | 1273279800 | 37700 | 106854.6324 | 6838780 | - * | wait/synch/mutex | 1031881 | 80464286240 | 56550 | 77978.2613 | 2590408470 | - * +-------------------+--------------+-------------------+-------------+--------------------+------------------+ + * +-------------------+---------+-------------------+-------------+--------------------+------------------+ + * | event_class | total | total_latency | min_latency | avg_latency | max_latency | + * +-------------------+---------+-------------------+-------------+--------------------+------------------+ + * | idle | 4331 | 16044682716000000 | 2000000 | 3704613880397.1369 | 1593550454000000 | + * | wait/io/file | 23037 | 20856702551880 | 0 | 905356711.0249 | 350700491310 | + * | wait/io/table | 224924 | 719670285750 | 116870 | 3199615.3623 | 208579012460 | + * | wait/lock/table | 6972 | 3674766030 | 109330 | 527074.8752 | 8855730 | + * | wait/synch/rwlock | 11916 | 1273279800 | 37700 | 106854.6324 | 6838780 | + * | wait/synch/mutex | 1031881 | 80464286240 | 56550 | 77978.2613 | 2590408470 | + * +-------------------+---------+-------------------+-------------+--------------------+------------------+ * */ @@ -81,18 +81,18 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW x$wait_classes_global_by_avg_latency ( event_class, - total_events, + total, total_latency, min_latency, avg_latency, max_latency ) AS -SELECT SUBSTRING_INDEX(event_name,'/', 3) event_class, - SUM(COUNT_STAR) total_events, - SUM(sum_timer_wait) total_latency, - MIN(min_timer_wait) min_latency, - SUM(sum_timer_wait) / SUM(COUNT_STAR) avg_latency, - MAX(max_timer_wait)max_latency +SELECT SUBSTRING_INDEX(event_name,'/', 3) AS event_class, + SUM(COUNT_STAR) AS total, + SUM(sum_timer_wait) AS total_latency, + MIN(min_timer_wait) AS min_latency, + SUM(sum_timer_wait) / SUM(COUNT_STAR) AS avg_latency, + MAX(max_timer_wait) AS max_latency FROM performance_schema.events_waits_summary_global_by_event_name WHERE sum_timer_wait > 0 AND event_name != 'idle' diff --git a/views/p_s/wait_classes_global_by_latency.sql b/views/p_s/wait_classes_global_by_latency.sql index f6329e7..1db3e4c 100644 --- a/views/p_s/wait_classes_global_by_latency.sql +++ b/views/p_s/wait_classes_global_by_latency.sql @@ -19,16 +19,16 @@ * Lists the top wait classes by total latency, ignoring idle (this may be very large). * * mysql> select * from wait_classes_global_by_latency; - * +-------------------+--------------+---------------+-------------+-------------+-------------+ - * | event_class | total_events | total_latency | min_latency | avg_latency | max_latency | - * +-------------------+--------------+---------------+-------------+-------------+-------------+ - * | wait/io/file | 550470 | 46.01 s | 19.44 ns | 83.58 µs | 4.21 s | - * | wait/io/socket | 228833 | 2.71 s | 0 ps | 11.86 µs | 29.93 ms | - * | wait/io/table | 64063 | 1.89 s | 99.79 ns | 29.43 µs | 68.07 ms | - * | wait/lock/table | 76029 | 47.19 ms | 65.45 ns | 620.74 ns | 969.88 µs | - * | wait/synch/mutex | 635925 | 34.93 ms | 19.44 ns | 54.93 ns | 107.70 µs | - * | wait/synch/rwlock | 61287 | 7.62 ms | 21.38 ns | 124.37 ns | 34.65 µs | - * +-------------------+--------------+---------------+-------------+-------------+-------------+ + * +-------------------+--------+---------------+-------------+-------------+-------------+ + * | event_class | total | total_latency | min_latency | avg_latency | max_latency | + * +-------------------+--------+---------------+-------------+-------------+-------------+ + * | wait/io/file | 550470 | 46.01 s | 19.44 ns | 83.58 µs | 4.21 s | + * | wait/io/socket | 228833 | 2.71 s | 0 ps | 11.86 µs | 29.93 ms | + * | wait/io/table | 64063 | 1.89 s | 99.79 ns | 29.43 µs | 68.07 ms | + * | wait/lock/table | 76029 | 47.19 ms | 65.45 ns | 620.74 ns | 969.88 µs | + * | wait/synch/mutex | 635925 | 34.93 ms | 19.44 ns | 54.93 ns | 107.70 µs | + * | wait/synch/rwlock | 61287 | 7.62 ms | 21.38 ns | 124.37 ns | 34.65 µs | + * +-------------------+--------+---------------+-------------+-------------+-------------+ * */ @@ -38,18 +38,18 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW wait_classes_global_by_latency ( event_class, - total_events, + total, total_latency, min_latency, avg_latency, max_latency ) AS -SELECT SUBSTRING_INDEX(event_name,'/', 3) event_class, - SUM(COUNT_STAR) total_events, - sys.format_time(SUM(sum_timer_wait)) total_latency, +SELECT SUBSTRING_INDEX(event_name,'/', 3) AS event_class, + SUM(COUNT_STAR) AS total, + sys.format_time(SUM(sum_timer_wait)) AS total_latency, sys.format_time(MIN(min_timer_wait)) min_latency, - sys.format_time(SUM(sum_timer_wait) / SUM(COUNT_STAR)) avg_latency, - sys.format_time(MAX(max_timer_wait)) max_latency + sys.format_time(SUM(sum_timer_wait) / SUM(COUNT_STAR)) AS avg_latency, + sys.format_time(MAX(max_timer_wait)) AS max_latency FROM performance_schema.events_waits_summary_global_by_event_name WHERE sum_timer_wait > 0 AND event_name != 'idle' @@ -62,16 +62,16 @@ SELECT SUBSTRING_INDEX(event_name,'/', 3) event_class, * Lists the top wait classes by total latency, ignoring idle (this may be very large). * * mysql> SELECT * FROM x$wait_classes_global_by_latency; - * +-------------------+--------------+----------------+-------------+----------------+--------------+ - * | event_class | total_events | total_latency | min_latency | avg_latency | max_latency | - * +-------------------+--------------+----------------+-------------+----------------+--------------+ - * | wait/io/file | 29468 | 27100905420290 | 0 | 919672370.7170 | 350700491310 | - * | wait/io/table | 224924 | 719670285750 | 116870 | 3199615.3623 | 208579012460 | - * | wait/synch/mutex | 1532036 | 118515948070 | 56550 | 77358.4616 | 2590408470 | - * | wait/io/socket | 1193 | 10677541030 | 0 | 8950160.1257 | 287760330 | - * | wait/lock/table | 6972 | 3674766030 | 109330 | 527074.8752 | 8855730 | - * | wait/synch/rwlock | 13646 | 1579833580 | 37700 | 115772.6499 | 28293850 | - * +-------------------+--------------+----------------+-------------+----------------+--------------+ + * +-------------------+---------+----------------+-------------+----------------+--------------+ + * | event_class | total | total_latency | min_latency | avg_latency | max_latency | + * +-------------------+---------+----------------+-------------+----------------+--------------+ + * | wait/io/file | 29468 | 27100905420290 | 0 | 919672370.7170 | 350700491310 | + * | wait/io/table | 224924 | 719670285750 | 116870 | 3199615.3623 | 208579012460 | + * | wait/synch/mutex | 1532036 | 118515948070 | 56550 | 77358.4616 | 2590408470 | + * | wait/io/socket | 1193 | 10677541030 | 0 | 8950160.1257 | 287760330 | + * | wait/lock/table | 6972 | 3674766030 | 109330 | 527074.8752 | 8855730 | + * | wait/synch/rwlock | 13646 | 1579833580 | 37700 | 115772.6499 | 28293850 | + * +-------------------+---------+----------------+-------------+----------------+--------------+ * */ @@ -81,18 +81,18 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW x$wait_classes_global_by_latency ( event_class, - total_events, + total, total_latency, min_latency, avg_latency, max_latency ) AS -SELECT SUBSTRING_INDEX(event_name,'/', 3) event_class, - SUM(COUNT_STAR) total_events, - SUM(sum_timer_wait) total_latency, - MIN(min_timer_wait) min_latency, - SUM(sum_timer_wait) / SUM(COUNT_STAR) avg_latency, - MAX(max_timer_wait) max_latency +SELECT SUBSTRING_INDEX(event_name,'/', 3) AS event_class, + SUM(COUNT_STAR) AS total, + SUM(sum_timer_wait) AS total_latency, + MIN(min_timer_wait) AS min_latency, + SUM(sum_timer_wait) / SUM(COUNT_STAR) AS avg_latency, + MAX(max_timer_wait) AS max_latency FROM performance_schema.events_waits_summary_global_by_event_name WHERE sum_timer_wait > 0 AND event_name != 'idle' diff --git a/views/p_s/waits_by_user_by_latency.sql b/views/p_s/waits_by_user_by_latency.sql index 7fd9e2b..45aaf4a 100644 --- a/views/p_s/waits_by_user_by_latency.sql +++ b/views/p_s/waits_by_user_by_latency.sql @@ -19,25 +19,25 @@ * Lists the top wait events by their total latency, ignoring idle (this may be very large). * * mysql> select * from waits_by_user_by_latency; - * +------+-----------------------------------------------------+--------------+---------------+-------------+-------------+ - * | user | event | total_events | total_latency | avg_latency | max_latency | - * +------+-----------------------------------------------------+--------------+---------------+-------------+-------------+ - * | root | wait/io/file/sql/file_parser | 13743 | 00:01:00.46 | 4.40 ms | 231.88 ms | - * | root | wait/io/file/innodb/innodb_data_file | 4699 | 3.02 s | 643.38 us | 46.93 ms | - * | root | wait/io/file/sql/FRM | 11462 | 2.60 s | 226.83 us | 61.72 ms | - * | root | wait/io/file/myisam/dfile | 26776 | 746.70 ms | 27.89 us | 308.79 ms | - * | root | wait/io/file/myisam/kfile | 7126 | 462.66 ms | 64.93 us | 88.76 ms | - * | root | wait/io/file/sql/dbopt | 179 | 137.58 ms | 768.59 us | 15.46 ms | - * | root | wait/io/file/csv/metadata | 8 | 86.60 ms | 10.82 ms | 50.32 ms | - * | root | wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | 798080 | 66.46 ms | 82.94 ns | 161.03 us | - * | root | wait/io/file/sql/binlog | 19 | 49.11 ms | 2.58 ms | 9.40 ms | - * | root | wait/io/file/sql/misc | 26 | 22.38 ms | 860.80 us | 15.30 ms | - * | root | wait/io/file/csv/data | 4 | 297.46 us | 74.37 us | 111.93 us | - * | root | wait/synch/rwlock/sql/MDL_lock::rwlock | 944 | 287.86 us | 304.62 ns | 874.64 ns | - * | root | wait/io/file/archive/data | 4 | 82.71 us | 20.68 us | 40.74 us | - * | root | wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | 60 | 12.21 us | 203.20 ns | 512.72 ns | - * | root | wait/synch/mutex/innodb/trx_mutex | 81 | 5.93 us | 73.14 ns | 252.59 ns | - * +------+-----------------------------------------------------+--------------+---------------+-------------+-------------+ + * +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ + * | user | event | total | total_latency | avg_latency | max_latency | + * +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ + * | root | wait/io/file/sql/file_parser | 13743 | 00:01:00.46 | 4.40 ms | 231.88 ms | + * | root | wait/io/file/innodb/innodb_data_file | 4699 | 3.02 s | 643.38 us | 46.93 ms | + * | root | wait/io/file/sql/FRM | 11462 | 2.60 s | 226.83 us | 61.72 ms | + * | root | wait/io/file/myisam/dfile | 26776 | 746.70 ms | 27.89 us | 308.79 ms | + * | root | wait/io/file/myisam/kfile | 7126 | 462.66 ms | 64.93 us | 88.76 ms | + * | root | wait/io/file/sql/dbopt | 179 | 137.58 ms | 768.59 us | 15.46 ms | + * | root | wait/io/file/csv/metadata | 8 | 86.60 ms | 10.82 ms | 50.32 ms | + * | root | wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | 798080 | 66.46 ms | 82.94 ns | 161.03 us | + * | root | wait/io/file/sql/binlog | 19 | 49.11 ms | 2.58 ms | 9.40 ms | + * | root | wait/io/file/sql/misc | 26 | 22.38 ms | 860.80 us | 15.30 ms | + * | root | wait/io/file/csv/data | 4 | 297.46 us | 74.37 us | 111.93 us | + * | root | wait/synch/rwlock/sql/MDL_lock::rwlock | 944 | 287.86 us | 304.62 ns | 874.64 ns | + * | root | wait/io/file/archive/data | 4 | 82.71 us | 20.68 us | 40.74 us | + * | root | wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | 60 | 12.21 us | 203.20 ns | 512.72 ns | + * | root | wait/synch/mutex/innodb/trx_mutex | 81 | 5.93 us | 73.14 ns | 252.59 ns | + * +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ * */ @@ -48,14 +48,14 @@ CREATE OR REPLACE VIEW waits_by_user_by_latency ( user, event, - total_events, + total, total_latency, avg_latency, max_latency ) AS SELECT user, event_name AS event, - count_star AS total_events, + count_star AS total, sys.format_time(sum_timer_wait) AS total_latency, sys.format_time(avg_timer_wait) AS avg_latency, sys.format_time(max_timer_wait) AS max_latency @@ -71,25 +71,25 @@ SELECT user, * Lists the top wait events by their total latency, ignoring idle (this may be very large). * * mysql> select * from x$waits_by_user_by_latency; - * +------+-----------------------------------------------------+--------------+----------------+-------------+--------------+ - * | user | event | total_events | total_latency | avg_latency | max_latency | - * +------+-----------------------------------------------------+--------------+----------------+-------------+--------------+ - * | root | wait/io/file/sql/file_parser | 13745 | 60462025415480 | 4398837508 | 231881092170 | - * | root | wait/io/file/innodb/innodb_data_file | 4699 | 3023248450820 | 643381037 | 46928334180 | - * | root | wait/io/file/sql/FRM | 11467 | 2600067790580 | 226743257 | 61718277920 | - * | root | wait/io/file/myisam/dfile | 26776 | 746701506200 | 27886690 | 308785046960 | - * | root | wait/io/file/myisam/kfile | 7126 | 462661061590 | 64925432 | 88756408780 | - * | root | wait/io/file/sql/dbopt | 179 | 137577467690 | 768589146 | 15457199810 | - * | root | wait/io/file/csv/metadata | 8 | 86599791590 | 10824973666 | 50322529270 | - * | root | wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | 798080 | 66461175430 | 82940 | 161028010 | - * | root | wait/io/file/sql/binlog | 19 | 49110632610 | 2584770058 | 9400449760 | - * | root | wait/io/file/sql/misc | 26 | 22380676630 | 860795052 | 15298475270 | - * | root | wait/io/file/csv/data | 4 | 297460540 | 74365135 | 111931300 | - * | root | wait/synch/rwlock/sql/MDL_lock::rwlock | 944 | 287862120 | 304616 | 874640 | - * | root | wait/io/file/archive/data | 4 | 82713800 | 20678450 | 40738620 | - * | root | wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | 60 | 12211030 | 203203 | 512720 | - * | root | wait/synch/mutex/innodb/trx_mutex | 81 | 5926440 | 73138 | 252590 | - * +------+-----------------------------------------------------+--------------+----------------+-------------+--------------+ + * +------+-----------------------------------------------------+--------+----------------+-------------+--------------+ + * | user | event | total | total_latency | avg_latency | max_latency | + * +------+-----------------------------------------------------+--------+----------------+-------------+--------------+ + * | root | wait/io/file/sql/file_parser | 13745 | 60462025415480 | 4398837508 | 231881092170 | + * | root | wait/io/file/innodb/innodb_data_file | 4699 | 3023248450820 | 643381037 | 46928334180 | + * | root | wait/io/file/sql/FRM | 11467 | 2600067790580 | 226743257 | 61718277920 | + * | root | wait/io/file/myisam/dfile | 26776 | 746701506200 | 27886690 | 308785046960 | + * | root | wait/io/file/myisam/kfile | 7126 | 462661061590 | 64925432 | 88756408780 | + * | root | wait/io/file/sql/dbopt | 179 | 137577467690 | 768589146 | 15457199810 | + * | root | wait/io/file/csv/metadata | 8 | 86599791590 | 10824973666 | 50322529270 | + * | root | wait/synch/mutex/mysys/IO_CACHE::append_buffer_lock | 798080 | 66461175430 | 82940 | 161028010 | + * | root | wait/io/file/sql/binlog | 19 | 49110632610 | 2584770058 | 9400449760 | + * | root | wait/io/file/sql/misc | 26 | 22380676630 | 860795052 | 15298475270 | + * | root | wait/io/file/csv/data | 4 | 297460540 | 74365135 | 111931300 | + * | root | wait/synch/rwlock/sql/MDL_lock::rwlock | 944 | 287862120 | 304616 | 874640 | + * | root | wait/io/file/archive/data | 4 | 82713800 | 20678450 | 40738620 | + * | root | wait/synch/mutex/myisam/MYISAM_SHARE::intern_lock | 60 | 12211030 | 203203 | 512720 | + * | root | wait/synch/mutex/innodb/trx_mutex | 81 | 5926440 | 73138 | 252590 | + * +------+-----------------------------------------------------+--------+----------------+-------------+--------------+ * */ @@ -100,14 +100,14 @@ CREATE OR REPLACE VIEW x$waits_by_user_by_latency ( user, event, - total_events, + total, total_latency, avg_latency, max_latency ) AS SELECT user, event_name AS event, - count_star AS total_events, + count_star AS total, sum_timer_wait AS total_latency, avg_timer_wait AS avg_latency, max_timer_wait AS max_latency diff --git a/views/p_s/waits_global_by_latency.sql b/views/p_s/waits_global_by_latency.sql index 6459934..bf9d1f8 100644 --- a/views/p_s/waits_global_by_latency.sql +++ b/views/p_s/waits_global_by_latency.sql @@ -19,15 +19,15 @@ * Lists the top wait events by their total latency, ignoring idle (this may be very large). * * mysql> select * from waits_global_by_latency limit 5; - * +--------------------------------------+--------------+---------------+-------------+-------------+ - * | event | total_events | total_latency | avg_latency | max_latency | - * +--------------------------------------+--------------+---------------+-------------+-------------+ - * | wait/io/file/myisam/dfile | 3623719744 | 00:47:49.09 | 791.70 ns | 312.96 ms | - * | wait/io/table/sql/handler | 69114944 | 00:44:30.74 | 38.64 us | 879.49 ms | - * | wait/io/file/innodb/innodb_log_file | 28100261 | 00:37:42.12 | 80.50 us | 476.00 ms | - * | wait/io/socket/sql/client_connection | 200704863 | 00:18:37.81 | 5.57 us | 1.27 s | - * | wait/io/file/innodb/innodb_data_file | 2829403 | 00:08:12.89 | 174.20 us | 455.22 ms | - * +--------------------------------------+--------------+---------------+-------------+-------------+ + * +--------------------------------------+------------+---------------+-------------+-------------+ + * | event | total | total_latency | avg_latency | max_latency | + * +--------------------------------------+------------+---------------+-------------+-------------+ + * | wait/io/file/myisam/dfile | 3623719744 | 00:47:49.09 | 791.70 ns | 312.96 ms | + * | wait/io/table/sql/handler | 69114944 | 00:44:30.74 | 38.64 us | 879.49 ms | + * | wait/io/file/innodb/innodb_log_file | 28100261 | 00:37:42.12 | 80.50 us | 476.00 ms | + * | wait/io/socket/sql/client_connection | 200704863 | 00:18:37.81 | 5.57 us | 1.27 s | + * | wait/io/file/innodb/innodb_data_file | 2829403 | 00:08:12.89 | 174.20 us | 455.22 ms | + * +--------------------------------------+------------+---------------+-------------+-------------+ * */ @@ -37,13 +37,13 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW waits_global_by_latency ( events, - total_events, + total, total_latency, avg_latency, max_latency ) AS SELECT event_name AS event, - count_star AS total_events, + count_star AS total, sys.format_time(sum_timer_wait) AS total_latency, sys.format_time(avg_timer_wait) AS avg_latency, sys.format_time(max_timer_wait) AS max_latency @@ -58,15 +58,15 @@ SELECT event_name AS event, * Lists the top wait events by their total latency, ignoring idle (this may be very large). * * mysql> select * from x$waits_global_by_latency limit 5; - * +--------------------------------------+--------------+---------------+-------------+--------------+ - * | event | total_events | total_latency | avg_latency | max_latency | - * +--------------------------------------+--------------+---------------+-------------+--------------+ - * | wait/io/file/sql/file_parser | 679 | 3536136351540 | 5207858773 | 129860439800 | - * | wait/io/file/innodb/innodb_data_file | 195 | 848170566100 | 4349592637 | 350700491310 | - * | wait/io/file/sql/FRM | 1355 | 400428476500 | 295518990 | 44823120940 | - * | wait/io/file/innodb/innodb_log_file | 20 | 54298899070 | 2714944765 | 30108124800 | - * | wait/io/file/mysys/charset | 3 | 24244722970 | 8081574072 | 24151547420 | - * +--------------------------------------+--------------+---------------+-------------+--------------+ + * +--------------------------------------+-------+---------------+-------------+--------------+ + * | event | total | total_latency | avg_latency | max_latency | + * +--------------------------------------+-------+---------------+-------------+--------------+ + * | wait/io/file/sql/file_parser | 679 | 3536136351540 | 5207858773 | 129860439800 | + * | wait/io/file/innodb/innodb_data_file | 195 | 848170566100 | 4349592637 | 350700491310 | + * | wait/io/file/sql/FRM | 1355 | 400428476500 | 295518990 | 44823120940 | + * | wait/io/file/innodb/innodb_log_file | 20 | 54298899070 | 2714944765 | 30108124800 | + * | wait/io/file/mysys/charset | 3 | 24244722970 | 8081574072 | 24151547420 | + * +--------------------------------------+-------+---------------+-------------+--------------+ * */ @@ -76,13 +76,13 @@ CREATE OR REPLACE SQL SECURITY INVOKER VIEW x$waits_global_by_latency ( events, - total_events, + total, total_latency, avg_latency, max_latency ) AS SELECT event_name AS event, - count_star AS total_events, + count_star AS total, sum_timer_wait AS total_latency, avg_timer_wait AS avg_latency, max_timer_wait AS max_latency