2. About
MyDBOPS
•
MySQL
Consulting
•
MySQL
Support
•
Remote
DBA
support.
•
Expert
MySQL
solutions
•
MariaDB,
Percona,
Galera,
TokuDB
are
supported
too.
4. Introduction
Ø
Improvement
over
PS_helper
Ø
MySQL
5.7.7
and
higher
includes
the
sys
schema
by
default
Ø
Set
of
objects
that
helps
DBAs
and
developers
interpret
data
collected
by
the
Performance
Schema
and
other
internals.
Ø
sys
schema
objects
can
be
used
for
typical
tuning
and
diagnosis
use
cases.
Ø
Ease
up
the
DBA’s
task
in
understanding
the
internals.
.
5. Introduction
Ø
Mark
Leith
is
the
Major
Contributor.
Ø
Similar
to
Oracle
V$
and
X$
views
that
helps
DBA’s.
§
Views
that
summarize
Performance
Schema
data
into
more
easily
understandable
form.
§
Stored
procedures
that
perform
operaNons
such
as
Performance
Schema
configuraNon
and
generaNng
diagnosNc
reports.
§
Stored
funcNons
that
query
Performance
Schema
configuraNon
and
provide
formaQng
services
§
FormaQng
and
helper
funcNons.
6. Installation
Ø The
sys
schema
requires
MySQL
5.5
or
higher.
Ø Can
be
installed
through
Workbench.
Ø Else
need
to
download
sys_56.sql
or
sys_57.sql
(depends
if
you
use
5.6
or
5.7).just
import
the
sql
file
as
usual
Install
$
git
clone
hXps://github.com/MarkLeith/mysql-‐sys.git
/tmp/sys
cd
/tmp/sys
Link
to
download:
hXps://github.com/mysql/mysql-‐sys/archive/master.zip
10. Summary
Views
Ø
Contains
many
views
that
summarize
Performance
Schema
tables
in
various
ways.
Display
all
running
and
acNve
real
Nme
process.
Ø
Most
of
these
views
come
in
pairs,
such
that
one
member
of
the
pair
has
the
same
name
as
the
other
member,
plus
a
x$
prefix.
For
Ex:
mysql>
SELECT
*
FROM
host_summary_by_file_io;
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
host
|
ios
|
io_latency
|
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
localhost
|
67570
|
5.38
s
|
|
background
|
3468
|
4.18
s
|
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
mysql>
SELECT
*
FROM
x$host_summary_by_file_io;
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
host
|
ios
|
io_latency
|
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
localhost
|
67574
|
5380678125144
|
|
background
|
3474
|
4758696829416
|
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
11. Summary
Views
Resource
Consuming
user
mysql>
select
*
from
user_summaryG
***************************
1.
row
***************************
user:
root
statements:
3185
statement_latency:
2.67
h
statement_avg_latency:
3.02
s
table_scans:
190
file_ios:
548019
file_io_latency:
15.58
m
current_connections:
3
total_connections:
6
unique_hosts:
1
current_memory:
0
bytes
total_memory_allocated:
0
bytes
***************************
2.
row
***************************
12. Summary
Views
Internal
File
IO
ConsumpNon
mysql>
select
*
from
user_summary_by_file_io_type
where
user
=
'root';
+-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
user
|
event_name
|
total
|
latency
|
max_latency
|
+-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
root
|
wait/io/file/innodb/innodb_data_file
|
538430
|
13.57
m
|
1.11
s
|
|
root
|
wait/io/file/innodb/innodb_log_file
|
3608
|
2.05
m
|
512.93
ms
|
|
root
|
wait/io/file/sql/FRM
|
10579
|
7.95
s
|
315.66
ms
|
|
root
|
wait/io/file/myisam/dfile
|
69
|
361.88
ms
|
287.33
ms
|
|
root
|
wait/io/file/sql/io_cache
|
487
|
67.34
ms
|
39.98
ms
|
|
root
|
wait/io/file/sql/file_parser
|
204
|
16.90
ms
|
14.78
ms
|
|
root
|
wait/io/file/archive/data
|
256
|
853.56
us
|
13.89
us
|
|
root
|
wait/io/file/sql/dbopt
|
33
|
564.94
us
|
67.70
us
|
|
root
|
wait/io/file/myisam/kfile
|
85
|
304.53
us
|
74.57
us
|
|
root
|
wait/io/file/sql/misc
|
7
|
145.62
us
|
33.73
us
|
+-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
13. Summary
Views
Resource
ConsumpNon
based
on
Statements
mysql>
select
*
from
user_summary_by_statement_type
where
user
=
'root';
+-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
user
|
statement
|
total
|
total_latency
|
max_latency
|
lock_latency
|
rows_sent
|
rows_examined
|
rows_affected
|
full_scans
|
+-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
root
|
insert
|
1232
|
2.69
h
|
19.52
s
|
0
ps
|
0
|
0
|
10367218
|
0
|
|
root
|
create_table
|
128
|
1.04
m
|
4.41
s
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
drop_table
|
150
|
31.18
s
|
2.74
s
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
select
|
101
|
9.38
s
|
889.77
ms
|
1.14
s
|
44807
|
65631
|
0
|
45
|
|
root
|
Field
List
|
134
|
6.21
s
|
1.15
s
|
1.49
s
|
0
|
0
|
0
|
0
|
|
root
|
unlock_tables
|
128
|
1.85
s
|
149.67
ms
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
show_tables
|
7
|
779.85
ms
|
414.56
ms
|
701.33
ms
|
345
|
345
|
0
|
7
|
|
root
|
error
|
1
|
748.68
ms
|
748.68
ms
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
show_databases
|
8
|
703.16
ms
|
644.97
ms
|
585.93
ms
|
75
|
75
|
0
|
8
|
|
root
|
show_variables
|
2
|
389.08
ms
|
388.09
ms
|
45.45
ms
|
1
|
1008
|
0
|
2
|
|
root
|
show_processlist
|
80
|
334.39
ms
|
236.12
ms
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
set_option
|
586
|
224.78
ms
|
190.99
ms
|
205.00
us
|
0
|
0
|
0
|
0
|
|
root
|
show_create_table
|
34
|
116.54
ms
|
108.95
ms
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
lock_tables
|
129
|
73.91
ms
|
10.81
ms
|
70.90
ms
|
0
|
0
|
0
|
0
|
|
root
|
alter_table
|
255
|
36.52
ms
|
6.93
ms
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
change_db
|
33
|
25.66
ms
|
24.29
ms
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
show_fields
|
66
|
22.35
ms
|
2.10
ms
|
0
ps
|
276
|
276
|
0
|
66
|
|
root
|
show_triggers
|
33
|
17.33
ms
|
1.59
ms
|
0
ps
|
0
|
0
|
0
|
33
|
|
root
|
show_table_status
|
33
|
8.69
ms
|
384.26
us
|
0
ps
|
33
|
33
|
0
|
33
|
|
root
|
create_db
|
7
|
1.47
ms
|
332.44
us
|
0
ps
|
0
|
0
|
7
|
0
|
|
root
|
flush
|
1
|
902.74
us
|
902.74
us
|
822.00
us
|
0
|
0
|
0
|
0
|
|
root
|
jump_if_not
|
295
|
833.81
us
|
20.04
us
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
create_procedure
|
2
|
393.48
us
|
226.63
us
|
220.00
us
|
0
|
0
|
0
|
0
|
|
root
|
drop_procedure
|
2
|
392.08
us
|
301.71
us
|
289.00
us
|
0
|
0
|
0
|
0
|
|
root
|
Init
DB
|
10
|
338.30
us
|
73.47
us
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
freturn
|
46
|
281.04
us
|
39.39
us
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
Statistics
|
3
|
67.26
us
|
31.78
us
|
0
ps
|
0
|
0
|
0
|
0
|
|
root
|
Quit
|
3
|
54.40
us
|
19.70
us
|
0
ps
|
0
|
0
|
0
|
0
|
+-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
14. Summary
Views
Resource
ConsumpNon
based
on
host
connecNvity
mysql>
select
*
from
sys.host_summaryG
***************************
1.
row
***************************
host:
localhost
statements:
15588
statement_latency:
2.76
h
statement_avg_latency:
637.81
ms
table_scans:
198
file_ios:
566859
file_io_latency:
16.10
m
current_connections:
3
total_connections:
6
unique_users:
1
current_memory:
0
bytes
total_memory_allocated:
0
bytes
1
row
in
set
(0.15
sec)
18. Summary
Views
Finding
the
Global
Wait
Latency
mysql>
select
*
from
waits_global_by_latency
limit
10;
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
events
|
total
|
total_latency
|
avg_latency
|
max_latency
|
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
|
wait/io/file/innodb/innodb_data_file
|
3025950
|
2.84
h
|
3.38
ms
|
1.11
s
|
|
wait/io/table/sql/handler
|
11025308
|
2.83
h
|
923.86
us
|
1.56
s
|
|
wait/io/file/innodb/innodb_log_file
|
56941
|
32.53
m
|
34.28
ms
|
565.85
ms
|
|
wait/io/file/sql/FRM
|
12044
|
7.96
s
|
660.69
us
|
315.66
ms
|
|
wait/io/file/myisam/dfile
|
93
|
361.95
ms
|
3.89
ms
|
287.33
ms
|
|
wait/io/file/sql/io_cache
|
487
|
67.34
ms
|
138.28
us
|
39.98
ms
|
|
wait/io/file/sql/file_parser
|
104
|
15.29
ms
|
147.05
us
|
14.78
ms
|
|
wait/io/file/archive/data
|
256
|
853.56
us
|
3.33
us
|
13.89
us
|
|
wait/io/file/sql/dbopt
|
33
|
564.94
us
|
17.12
us
|
67.70
us
|
|
wait/io/file/sql/ERRMSG
|
5
|
518.37
us
|
103.67
us
|
468.87
us
|
|
wait/io/file/myisam/kfile
|
118
|
403.17
us
|
3.42
us
|
74.57
us
|
|
wait/lock/table/sql/handler
|
127
|
301.39
us
|
2.37
us
|
5.13
us
|
|
wait/io/file/sql/misc
|
7
|
145.62
us
|
20.80
us
|
33.73
us
|
|
wait/io/file/sql/casetest
|
10
|
142.10
us
|
14.21
us
|
80.76
us
|
|
wait/io/file/sql/pid
|
3
|
136.44
us
|
45.48
us
|
108.86
us
|
|
wait/io/file/mysys/cnf
|
5
|
51.82
us
|
10.36
us
|
20.47
us
|
|
wait/io/file/mysys/charset
|
3
|
25.89
us
|
8.63
us
|
13.81
us
|
|
wait/io/file/keyring_file/keyring_file_data
|
4
|
18.76
us
|
4.69
us
|
13.98
us
|
|
wait/io/file/sql/global_ddl_log
|
2
|
6.06
us
|
3.03
us
|
3.49
us
|
|
wait/io/file/keyring_file/keyring_backup_file_data
|
1
|
4.35
us
|
4.35
us
|
4.35
us
|
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
22. Summary
Views
• Sys
schema
can
help
a
lot
in
monitoring
and
Fine
Tuning.
• Monitoring
and
alert
systems
can
benefitted
a
lot
by
it.
• Seems
like
MEM
3.2
has
implemented
most
of
sys
schema
tables.
• Large
scale
MySQL
Farms
can
poll
the
sys
schema
views
to
centralized
servers
for
historical
data
analysis.
23. How MyDBOPS Can Help You ?
•
MySQL
Consulting
•
MySQL
Support
•
Remote
DBA
•
MySQL
Health
Audit
•
24
*
7
Support
Contact
:
mysqlsupport@mydbops.com