Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit b3de07c

Browse files
committed
Create host_summary_by_file_io_type.sql
1 parent 9c95442 commit b3de07c

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
3+
This program is free software; you can redistribute it and/or modify
4+
it under the terms of the GNU General Public License as published by
5+
the Free Software Foundation; version 2 of the License.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
GNU General Public License for more details.
11+
12+
You should have received a copy of the GNU General Public License
13+
along with this program; if not, write to the Free Software
14+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15+
16+
/*
17+
* View: host_summary_by_file_io_type
18+
*
19+
* Summarizes file IO by event type per host.
20+
*
21+
*
22+
* mysql> select * from host_summary_by_file_io_type;
23+
* +------------+--------------------------------------+-------+-----------+-------------+
24+
* | host | event_name | total | latency | max_latency |
25+
* +------------+--------------------------------------+-------+-----------+-------------+
26+
* | hal1 | wait/io/file/sql/FRM | 871 | 168.15 ms | 18.48 ms |
27+
* | hal1 | wait/io/file/innodb/innodb_data_file | 173 | 129.56 ms | 34.09 ms |
28+
* | hal1 | wait/io/file/innodb/innodb_log_file | 20 | 77.53 ms | 60.66 ms |
29+
* | hal1 | wait/io/file/myisam/dfile | 40 | 6.54 ms | 4.58 ms |
30+
* | hal1 | wait/io/file/mysys/charset | 3 | 4.79 ms | 4.71 ms |
31+
* | hal1 | wait/io/file/myisam/kfile | 67 | 4.38 ms | 300.04 us |
32+
* | hal1 | wait/io/file/sql/ERRMSG | 5 | 2.72 ms | 1.69 ms |
33+
* | hal1 | wait/io/file/sql/pid | 3 | 266.30 us | 185.47 us |
34+
* | hal1 | wait/io/file/sql/casetest | 5 | 246.81 us | 150.19 us |
35+
* | hal1 | wait/io/file/sql/global_ddl_log | 2 | 21.24 us | 18.59 us |
36+
* | hal2 | wait/io/file/sql/file_parser | 1422 | 4.80 s | 135.14 ms |
37+
* | hal2 | wait/io/file/sql/FRM | 865 | 85.82 ms | 9.81 ms |
38+
* | hal2 | wait/io/file/myisam/kfile | 1073 | 37.14 ms | 15.79 ms |
39+
* | hal2 | wait/io/file/myisam/dfile | 2991 | 25.53 ms | 5.25 ms |
40+
* | hal2 | wait/io/file/sql/dbopt | 20 | 1.07 ms | 153.07 us |
41+
* | hal2 | wait/io/file/sql/misc | 4 | 59.71 us | 33.75 us |
42+
* | hal2 | wait/io/file/archive/data | 1 | 13.91 us | 13.91 us |
43+
* +------------+--------------------------------------+-------+-----------+-------------+
44+
*
45+
*/
46+
47+
CREATE OR REPLACE
48+
ALGORITHM = MERGE
49+
DEFINER = 'root'@'localhost'
50+
SQL SECURITY INVOKER
51+
VIEW host_summary_by_file_io_type (
52+
host,
53+
event_name,
54+
total,
55+
latency,
56+
max_latency
57+
) AS
58+
SELECT host AS host,
59+
event_name,
60+
count_star AS total,
61+
sys.format_time(sum_timer_wait) AS latency,
62+
sys.format_time(max_timer_wait) AS max_latency
63+
FROM performance_schema.events_waits_summary_by_host_by_event_name
64+
WHERE event_name LIKE 'wait/io/file%'
65+
AND count_star > 0
66+
ORDER BY host, sum_timer_wait DESC;
67+
68+
/*
69+
* View: x$host_summary_by_file_io_type
70+
*
71+
* Summarizes file IO by event type per host.
72+
*
73+
*
74+
* mysql> select * from x$host_summary_by_file_io_type;
75+
* +------------+--------------------------------------+-------+---------------+--------------+
76+
* | host | event_name | total | latency | max_latency |
77+
* +------------+--------------------------------------+-------+---------------+--------------+
78+
* | hal1 | wait/io/file/sql/FRM | 871 | 168148450470 | 18482624810 |
79+
* | hal1 | wait/io/file/innodb/innodb_data_file | 173 | 129564287450 | 34087423890 |
80+
* | hal1 | wait/io/file/innodb/innodb_log_file | 20 | 77525706960 | 60657475320 |
81+
* | hal1 | wait/io/file/myisam/dfile | 40 | 6544493800 | 4580546230 |
82+
* | hal1 | wait/io/file/mysys/charset | 3 | 4793558770 | 4713476430 |
83+
* | hal1 | wait/io/file/myisam/kfile | 67 | 4384332810 | 300035450 |
84+
* | hal1 | wait/io/file/sql/ERRMSG | 5 | 2717434850 | 1687316280 |
85+
* | hal1 | wait/io/file/sql/pid | 3 | 266301490 | 185468920 |
86+
* | hal1 | wait/io/file/sql/casetest | 5 | 246814360 | 150193030 |
87+
* | hal1 | wait/io/file/sql/global_ddl_log | 2 | 21236410 | 18593640 |
88+
* | hal2 | wait/io/file/sql/file_parser | 1422 | 4801104756760 | 135138518970 |
89+
* | hal2 | wait/io/file/sql/FRM | 865 | 85818594810 | 9812303410 |
90+
* | hal2 | wait/io/file/myisam/kfile | 1073 | 37143664870 | 15793838190 |
91+
* | hal2 | wait/io/file/myisam/dfile | 2991 | 25528215700 | 5252232050 |
92+
* | hal2 | wait/io/file/sql/dbopt | 20 | 1067339780 | 153073310 |
93+
* | hal2 | wait/io/file/sql/misc | 4 | 59713030 | 33752810 |
94+
* | hal2 | wait/io/file/archive/data | 1 | 13907530 | 13907530 |
95+
* +------------+--------------------------------------+-------+---------------+--------------+
96+
*
97+
*/
98+
99+
CREATE OR REPLACE
100+
ALGORITHM = MERGE
101+
DEFINER = 'root'@'localhost'
102+
SQL SECURITY INVOKER
103+
VIEW x$host_summary_by_file_io_type (
104+
host,
105+
event_name,
106+
total,
107+
latency,
108+
max_latency
109+
) AS
110+
SELECT host AS host,
111+
event_name,
112+
count_star AS total,
113+
sum_timer_wait AS latency,
114+
max_timer_wait AS max_latency
115+
FROM performance_schema.events_waits_summary_by_host_by_event_name
116+
WHERE event_name LIKE 'wait/io/file%'
117+
AND count_star > 0
118+
ORDER BY host, sum_timer_wait DESC;

0 commit comments

Comments
 (0)