SlideShare a Scribd company logo
1 of 86
Download to read offline
Performance Schema
for MySQL Troubleshooting
April, 25, 2017
Sveta Smirnova
• MySQL Support engineer
• Author of
• MySQL Troubleshooting
• JSON UDF functions
• FILTER clause for MySQL
• Speaker
• Percona Live, OOW, Fosdem,
DevConf, HighLoad...
Sveta Smirnova
2
•Overview and Configuration
•Statements
•Memory Usage
•Locks Diagnostics
•Variables and Status
•Connection Diagnostics
•Replication
•Server Internals
Table of Contents
3
Overview and Configuration
4
5.6
• 52 tables
• 554 instrs
• 31 variables
5.7
• 87 tables
• 1019 instrs
• 42 variables
8.0
• 100 tables
• 1160 instrs
• 43 variables
What is Inside?
5
• Which statements are less optimal
• Which operations take most of the time
• Which locks and mutexes taken most often
• What happens inside session
• How much memory is allocated
• Why users cannot connect from a host
• More
What Can be Found?
6
• ON by default
• Only global, thread, statements and
transactions instrumentation enabled
• All other consumers are disabled
Performance Schema Defaults
7
• Memory allocated on demand
• You don’t need to limit size of tables anymore
Configuraiton Improvements in 5.7
8
• Memory allocated on demand
• You don’t need to limit size of tables anymore
• Sys schema is in the standard distribution
Configuraiton Improvements in 5.7
8
• Memory allocated on demand
• You don’t need to limit size of tables anymore
• Sys schema is in the standard distribution
• You can turn statistics ON or OFF for
particular host and/or user
Configuraiton Improvements in 5.7
8
• Memory allocated on demand
• You don’t need to limit size of tables anymore
• Sys schema is in the standard distribution
• You can turn statistics ON or OFF for
particular host and/or user
• Size of SQL DIGEST is tunable
Configuraiton Improvements in 5.7
8
• Use pattern
update performance_schema.setup_consumers set enabled=’yes’ 
where name like ’OUR_REQUIREMENT_%’;
update performance_schema.setup_instruments set enabled=’yes’, 
timed=’yes’ where name like ’OUR_REQUIREMENT_%’;
How to Configure
9
• Use pattern
• Or easier
call sys.ps_setup_enable_consumer(YOUR_CONSUMER);
Requires sys schema
call sys.ps_setup_enable_instrument(YOUR_INSTRUMENT);
Needs separate install before 5.7
How to Configure
9
• Use pattern
• Or easier
• Be careful!
• They are memory and CPU intensive
• Do not turn them all ON until needed
How to Configure
9
Statements
10
• For regular SQL statements
• Prepared statements
• Stored routines
• Stages of statements execution
Statements Instrumentation
11
• Why statements are slow?
• Per-query statistics
• Most evolving stages
What Can We Discover?
12
• Why statements are slow?
• Per-query statistics
• Most evolving stages
• What was executed inside stored routine?
What Can We Discover?
12
• events statements * and
prepared statements instances tables
• Important field names
CREATED TMP DISK TABLES
CREATED TMP TABLES
SELECT FULL JOIN
SELECT RANGE CHECK
SELECT SCAN
SORT MERGE PASSES
SORT SCAN
Why Statements are Slow?
13
• events statements * and
prepared statements instances tables
• Views in sys schema
• Important view names
statement analysis
statements with full table scans
statements with runtimes in 95th percentile
statements with sorting
statements with temp tables
statements with errors or warnings
Why Statements are Slow?
13
mysql> SELECT THREAD_ID TID, SUBSTR(SQL_TEXT, 1, 50) SQL_TEXT, ROWS_SENT RS,
-> ROWS_EXAMINED RE,CREATED_TMP_TABLES,NO_INDEX_USED,NO_GOOD_INDEX_USED
-> FROM performance_schema.events_statements_history
-> WHERE NO_INDEX_USED=1 OR NO_GOOD_INDEX_USED=1G
********************** 1. row **********************
TID: 10124
SQL_TEXT: select emp_no, first_name, last_name from employee
RS: 97750
RE: 397774
CREATED_TMP_TABLES: 0
NO_INDEX_USED: 1
NO_GOOD_INDEX_USED: 0
...
Which Queries Do Not Use Indexes?
14
mysql> SELECT query, total_latency, no_index_used_count, rows_sent,
-> rows_examined
-> FROM sys.statements_with_full_table_scans
-> WHERE db=’employees’ AND query NOT LIKE ’%performance_schema%’G
********************** 1. row **********************
query: SELECT COUNT ( ‘emp_no‘ ) FROM ... ‘emp_no‘ )
WHERE ‘title‘ = ?
total_latency: 805.37 ms
no_index_used_count: 1
rows_sent: 1
rows_examined: 397774
...
Take it Easy: Index Usage with sys Schema
15
mysql> prepare stmt from ’select dept_no, sum(salary) from employees e ...
mysql> set @d1=’d001’, @d2=’d002’, @d3=’d003’, @d4=’d004’;
mysql> execute stmt using @d1, @d2, @d3, @d4;
+---------+-------------+
| dept_no | sum(salary) |
+---------+-------------+
| d001 | 13725425266 |
| d002 | 11650834677 |
| d003 | 9363811425 |
| d004 | 41554438942 |
| d005 | 2494260927 |
...
Prepared Statements Diagnostics
16
mysql> select * from performance_schema.prepared_statements_instancesG
*************************** 1. row ***************************
OBJECT_INSTANCE_BEGIN: 139956274327632
STATEMENT_ID: 1
STATEMENT_NAME: stmt
SQL_TEXT: select dept_no, sum(salary) from employees e...
OWNER_THREAD_ID: 28
...
COUNT_REPREPARE: 0
COUNT_EXECUTE: 1
...
Prepared Statements Diagnostics
17
...
SUM_ROWS_SENT: 9
SUM_ROWS_EXAMINED: 2011495
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 1
...
SUM_SELECT_SCAN: 1
...
SUM_SORT_ROWS: 9
SUM_SORT_SCAN: 1
Prepared Statements Diagnostics
18
• What happens inside a routine
• Queries, called from the routine
• statement/sp/statement
Stored Routines Instrumentation
19
• We will use this procedure
CREATE DEFINER=‘root‘@‘localhost‘ PROCEDURE ‘sp_test‘(val int)
BEGIN
DECLARE CONTINUE HANDLER FOR 1364, 1048, 1366
BEGIN
INSERT IGNORE INTO t1 VALUES(’Some string’);
GET STACKED DIAGNOSTICS CONDITION 1 @st_state = RETURNED_SQLSTATE;
GET STACKED DIAGNOSTICS CONDITION 1 @stacked_msg = MESSAGE_TEXT;
END;
INSERT INTO t1 VALUES(val);
END
• When HANDLER called?
Stored Routines: example
20
mysql> call sp_test(1);
Query OK, 1 row affected (0.07 sec)
mysql> select thread_id, event_name, sql_text from events_statements_history
-> where event_name like ’statement/sp%’;
+-----------+-------------------------+----------------------------+
| thread_id | event_name | sql_text |
+-----------+-------------------------+----------------------------+
| 24 | statement/sp/hpush_jump | NULL |
| 24 | statement/sp/stmt | INSERT INTO t1 VALUES(val) |
| 24 | statement/sp/hpop | NULL |
+-----------+-------------------------+----------------------------+
3 rows in set (0.00 sec)
Correct Value
21
mysql> call sp_test(NULL);
Query OK, 1 row affected (0.07 sec)
mysql> select thread_id, event_name, sql_text from events_statements_history
-> where event_name like ’statement/sp%’;
+-----------+-------------------------+-------------------------------------------+
| thread_id | event_name | sql_text |
+-----------+-------------------------+-------------------------------------------+
| 24 | statement/sp/hpush_jump | NULL |
| 24 | statement/sp/stmt | INSERT INTO t1 VALUES(val) |
| 24 | statement/sp/stmt | INSERT IGNORE INTO t1 VALUES(’Som... |
| 24 | statement/sp/stmt | GET STACKED DIAGNOSTICS CONDITION... |
| 24 | statement/sp/stmt | GET STACKED DIAGNOSTICS CONDITION... |
| 24 | statement/sp/hreturn | NULL |
| 24 | statement/sp/hpop | NULL |
+-----------+-------------------------+
7 rows in set (0.00 sec)
HANDLER call
22
• events stages * tables
Statements Deep Dive
23
• events stages * tables
• Same information as in table
INFORMATION SCHEMA.PROCESSLIST
or SHOW PROCESSLIST output
• init
• executing
• Opening tables
Statements Deep Dive
23
• events stages * tables
• Same information as in table
INFORMATION SCHEMA.PROCESSLIST
or SHOW PROCESSLIST output
• init
• executing
• Opening tables
• Replacement for SHOW PROFILE
Statements Deep Dive
23
• events stages * tables
• Same information as in table
INFORMATION SCHEMA.PROCESSLIST
or SHOW PROCESSLIST output
• init
• executing
• Opening tables
• Replacement for SHOW PROFILE
• Only server-level
• No storage engine information!
Statements Deep Dive
23
• Everything, related to temporary tables
• EVENT NAME LIKE ’stage/sql/%tmp%’
• Everything, related to locks
• EVENT NAME LIKE ’stage/sql/%lock%’
• Everything in state ”Waiting for”
• EVENT NAME LIKE ’stage/%/Waiting for%’
• Frequently met issues
Stages Shortcuts
24
• Everything, related to temporary tables
• Everything, related to locks
• Everything in state ”Waiting for”
• Frequently met issues
• EVENT NAME=’stage/sql/freeing items’
• EVENT NAME=’stage/sql/Sending data’
• EVENT NAME=’stage/sql/cleaning up’
• EVENT NAME=’stage/sql/closing tables’
• EVENT NAME=’stage/sql/end’
Stages Shortcuts
24
mysql> SELECT eshl.event_name, sql_text, eshl.timer_wait/1000000000000 w_s
-> FROM performance_schema.events_stages_history_long eshl
-> JOIN performance_schema.events_statements_history_long esthl
-> ON (eshl.nesting_event_id = esthl.event_id)
-> WHERE eshl.timer_wait > 1*10000000000G
*************************** 1. row ***************************
event_name: stage/sql/Sending data
sql_text: SELECT COUNT(emp_no) FROM employees JOIN salaries USING(emp_no)
WHERE hire_date=from_date
w_s: 0.8170
1 row in set (0.00 sec)
Stages Example: Which Stage Run Critically Long?
25
Memory Usage Analysis
26
• Since version 5.7
• Answers on question: how memory used?
• Overall and detailed statistics
Memory Instrumentation
27
• Since version 5.7
• Answers on question: how memory used?
• Overall and detailed statistics
• Memory usage per server
mysql> select * from sys.memory_global_total;
+-----------------+
| total_allocated |
+-----------------+
| 319.69 MiB |
+-----------------+
1 row in set (0.05 sec)
Memory Instrumentation
27
mysql> select thread_id tid, user, current_allocated ca, total_allocated
-> from sys.memory_by_thread_by_current_bytes;
+-----+-------------------------+-------------+-----------------+
| tid | user | ca | total_allocated |
+-----+-------------------------+-------------+-----------------+
| 1 | sql/main | 2.53 GiB | 2.69 GiB |
| 150 | root@127.0.0.1 | 4.06 MiB | 32.17 MiB |
| 146 | sql/slave_sql | 1.31 MiB | 1.44 MiB |
| 145 | sql/slave_io | 1.08 MiB | 2.79 MiB |
...
| 4 | innodb/io_log_thread | -2880 bytes | 132.38 KiB |
| 72 | innodb/io_write_thread | -7632 bytes | 1.10 MiB |
+-----+-------------------------+-------------+-----------------+
145 rows in set (2.65 sec)
Detailed Memory Statistics
28
• memory summary by account by event name
• memory summary by host by event name
• memory summary by thread by event name
• memory summary by user by event name
• memory summary global by event name
• sys schema includes user account
RAW Performance Schema Tables
29
• NAME@HOST - regular user
• System users
• sql/main
• innodb/*
• ...
• Data comes from table THREADS
Users in sys.memory * Tables
30
Locks Diagnostics
31
• Metadata locks
• Table METADATA LOCKS
• Table-level locks
• Table TABLE HANDLES
• Engine-dependent locks, transactions
• Tables EVENTS TRANSACTIONS *
• This is not exactly lock information!
What can Block Your Queries?
32
• Table METADATA LOCKS
• Which thread is waiting for a lock
• Which thread holds the lock
• Not only for tables:
GLOBAL, SCHEMA, TABLE, FUNCTION, PROCEDURE, EVENT, COMMIT, USER LEVEL LOCK,
TABLESPACE
Metadata Locks
33
mysql> select processlist_id, object_type, lock_type, lock_status, source
-> from metadata_locks join threads on (owner_thread_id=thread_id)
-> where object_schema=’employees’ and object_name=’titles’G
*************************** 1. row ***************************
processlist_id: 4
object_type: TABLE
lock_type: EXCLUSIVE
lock_status: PENDING -- waits
source: mdl.cc:3263
*************************** 2. row ***************************
processlist_id: 5
object_type: TABLE
lock_type: SHARED_READ
lock_status: GRANTED -- holds
source: sql_parse.cc:5707
METADATA LOCKS: example
34
• Table TABLE HANDLES
• Not only locks, but all open tables
• FLUSH TABLES removes data from this table
Table Locks
35
mysql> select * from table_handlesG
*************************** 1. row ***************************
OBJECT_TYPE: TABLE
OBJECT_SCHEMA: employees
OBJECT_NAME: titles
OBJECT_INSTANCE_BEGIN: 140663937105248
OWNER_THREAD_ID: 28
OWNER_EVENT_ID: 951
INTERNAL_LOCK: NULL
EXTERNAL_LOCK: READ EXTERNAL - Read lock
(I run LOCK TABLE ... READ)
Table Locks: example
36
*************************** 2. row ***************************
OBJECT_TYPE: TABLE
OBJECT_SCHEMA: employees
OBJECT_NAME: emp
OBJECT_INSTANCE_BEGIN: 140663879605856
OWNER_THREAD_ID: 26
OWNER_EVENT_ID: 10419193
INTERNAL_LOCK: WRITE - Table lock for MyISAM table
EXTERNAL_LOCK: WRITE EXTERNAL - Write lock
2 rows in set (0.00 sec)
Table Locks: example
37
• Tables EVENTS TRANSACTIONS *
• Transaction information even if engine is not
transactional - One more tool to hunt MDL
• GTIDs
• Background transactions
Transactions at Server Level
38
mysql> select processlist_ID, STATE, GTID, SOURCE, ACCESS_MODE,
-> ISOLATION_LEVEL, AUTOCOMMIT
-> from events_transactions_current join threads using(thread_id)G
************************ 1. row ************************
processlist_ID: NULL
STATE: COMMITTED
GTID: NULL
SOURCE: handler.cc:1248
ACCESS_MODE: READ WRITE
ISOLATION_LEVEL: REPEATABLE READ
AUTOCOMMIT: YES
...
Background Transaction
39
mysql> select processlist_ID, STATE, GTID, SOURCE,
-> ACCESS_MODE, ISOLATION_LEVEL, AUTOCOMMIT
-> from events_transactions_current join threads using(thread_id)G
************************ 2. row ************************
processlist_ID: 4
STATE: COMMITTED
GTID: AUTOMATIC - GTID information here
SOURCE: transaction.cc:150
ACCESS_MODE: READ WRITE
ISOLATION_LEVEL: REPEATABLE READ
AUTOCOMMIT: NO
Transaction in BEGIN ... COMMIT Block
40
mysql> select processlist_ID, STATE, GTID, SOURCE,
-> ACCESS_MODE, ISOLATION_LEVEL, AUTOCOMMIT
-> from events_transactions_current join threads using(thread_id)G
************************ 3. row ************************
processlist_ID: 5
STATE: COMMITTED
GTID: NULL
SOURCE: handler.cc:1248
ACCESS_MODE: READ WRITE
ISOLATION_LEVEL: REPEATABLE READ
AUTOCOMMIT: YES
...
Autocommitted Transaction
41
Variables and Status
42
• Now in Performance Schema
• Global
• Session
• User-defined - First time ever!
Variables and Status
43
• Now in Performance Schema
• Global
• Session
• User-defined - First time ever!
• Tables in Information Schema
• Deprecated in 5.7
• Removed in 8.0.1
Variables and Status
43
• Variables
• Global
• Session
• By thread
• User variables
• By thread
• Status variables
• Global
• Session
• Account
• Host
• User
• Thread
Groupped by
44
• Variables
mysql> select * from variables_by_thread
-> where variable_name=’tx_isolation’;
+-----------+---------------+-----------------+
| THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE |
+-----------+---------------+-----------------+
| 71 | tx_isolation | REPEATABLE-READ |
| 83 | tx_isolation | REPEATABLE-READ |
| 84 | tx_isolation | SERIALIZABLE |
+-----------+---------------+-----------------+
3 rows in set, 3 warnings (0.00 sec)
Variables and Status: example
45
• Variables
• User variables
mysql> select * from user_variables_by_thread;
+-----------+---------------+----------------+
| THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE |
+-----------+---------------+----------------+
| 71 | baz | boo |
| 84 | foo | bar |
+-----------+---------------+----------------+
2 rows in set (0.00 sec)
Variables and Status: example
45
• Variables
• User variables
• Status variables
mysql> select * from status_by_thread
-> where variable_name=’Handler_write’;
+-----------+---------------+----------------+
| THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE |
+-----------+---------------+----------------+
| 71 | Handler_write | 94 |
| 83 | Handler_write | 477 | -- Most writes
| 84 | Handler_write | 101 |
+-----------+---------------+----------------+
3 rows in set (0.00 sec)
Variables and Status: example
45
Connection Diagnostics
46
• Tables accounts, users, hosts
mysql> select user, host, current_connections as cur,
-> total_connections as total from accounts;
+------+-----------+-----+-------+
| user | host | cur | total |
+------+-----------+-----+-------+
| foo | localhost | 0 | 3 |
| root | localhost | 1 | 3 |
| NULL | NULL | 14 | 17 |
+------+-----------+-----+-------+
3 rows in set (0.01 sec)
• Connection attributes
Connection Diagnostics
47
• Connection attributes
mysql> SELECT ATTR_NAME, ATTR_VALUE FROM session_account_connect_attrs
-> WHERE processlist_id != @@pseudo_thread_id;
+-----------------+--------------------------+
| ATTR_NAME | ATTR_VALUE |
+-----------------+--------------------------+
| _os | Linux |
| _client_name | libmysql |
| _pid | 4729 |
| program_name | PLMCE-2017 |
| _platform | x86_64 |
| session | MySQL Performance Schema |
| author | Sveta Smirnova |
| _client_version | 5.7.17-13 |
+-----------------+--------------------------+
Connection Diagnostics
47
• Content of DNS cache
• Errors from:
• Name Server
• Connection
• Authentication
• max connect errors, max user errors, etc.
• Your first assistant in case of connection
issue
Host Cache
48
Replication
49
• Data from SHOW SLAVE STATUS available
in replication * tables
• Not full replacement
• Binary, relay log names and positions are in
mysql.slave * tables
• GTID information for single-threaded slave is
in gtid executed variable
Replication Diagnostics
50
• Data from SHOW SLAVE STATUS available
in replication * tables
• Not full replacement
• Binary, relay log names and positions are in
mysql.slave * tables
• GTID information for single-threaded slave is
in gtid executed variable
• Support of Replication Channels
(Multi-threaded slave)
Replication Diagnostics
50
• Data from SHOW SLAVE STATUS available
in replication * tables
• Not full replacement
• Binary, relay log names and positions are in
mysql.slave * tables
• GTID information for single-threaded slave is
in gtid executed variable
• Support of Replication Channels
(Multi-threaded slave)
• GTID instrumentation
Replication Diagnostics
50
• No need to parse SHOW output
SLAVE STATUS
51
• No need to parse SHOW output
• Configuration
• replication connection configuration
• replication applier configuration
SLAVE STATUS
51
• No need to parse SHOW output
• Configuration
• IO thread
• replication connection status
SLAVE STATUS
51
• No need to parse SHOW output
• Configuration
• IO thread
• SQL thread
• replication applier status
• replication applier status by coordinator
• replication applier status by worker - MTS only
SLAVE STATUS
51
• Configuration
mysql> select * from replication_connection_configuration
-> join replication_applier_configuration using(channel_name)G
*************************** 1. row ***************************
CHANNEL_NAME:
HOST: 127.0.0.1
PORT: 13000
USER: root
NETWORK_INTERFACE:
AUTO_POSITION: 1
SSL_ALLOWED: NO
SSL_CA_FILE:
...
SLAVE STATUS
52
• Configuration
...
CONNECTION_RETRY_INTERVAL: 60
CONNECTION_RETRY_COUNT: 10
HEARTBEAT_INTERVAL: 60.000
CHANNEL_NAME:
DESIRED_DELAY: 0
1 row in set (0.00 sec)
SLAVE STATUS
53
• State of IO Thread
mysql> select * from replication_connection_statusG
*************************** 1. row ***************************
CHANNEL_NAME:
GROUP_NAME:
SOURCE_UUID: d0753e78-14ec-11e5-b3fb-28b2bd7442fd
THREAD_ID: 21
SERVICE_STATE: ON
COUNT_RECEIVED_HEARTBEATS: 17
LAST_HEARTBEAT_TIMESTAMP: 2015-06-17 15:49:08
RECEIVED_TRANSACTION_SET:
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
1 row in set (0.00 sec)
SLAVE STATUS
54
• State of SQL Thread
mysql> select * from replication_applier_status join
-> replication_applier_status_by_coordinator using(channel_name)G
*************************** 1. row ***************************
CHANNEL_NAME:
SERVICE_STATE: ON
REMAINING_DELAY: NULL
COUNT_TRANSACTIONS_RETRIES: 0
THREAD_ID: 22
SERVICE_STATE: ON
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
1 row in set (0.00 sec)
SLAVE STATUS
55
Server Internals
56
• EVENTS WAITS * tables
• EVENT NAME
wait/synch/rwlock/innodb/dict operation lock
• SOURCE
Line of the source code
• OPERATION
Kind of operation: read, lock, write
Server Internals
57
• wait/lock - Metadata and table locks
• wait/synch/cond - InnoDB, MyISAM, sql
• wait/synch/mutex - sql, mysys, engines
• wait/synch/rwlock - sql, InnoDB, MyISAM
• wait/synch/sxlock - InnoDB global locks
• wait/io/file - Operations with files
• wait/io/socket
• wait/io/table/sql/handler
Which Kind of Events Can We Examine?
58
• file instances - Opened files
• socket instances - Connections
• cond instances
• rwlock instances
select * from rwlock_instances where READ_LOCKED_BY_COUNT > 0;
select * from rwlock_instances where WRITE_LOCKED_BY_THREAD_ID > 0;
• mutex instances -
LOCKED BY THREAD ID
* INSTANCES Tables
59
• Tables in sys schema
• io *
• host summary *
• user summary *
• waits *
Diagnostic Sugar
60
• Tables in sys schema
• Digests events waits summary *
• *by account by event name
• *by host by event name
• *by instance
• *by thread by event name
• *by user by event name
• *by event name
Diagnostic Sugar
60
In Graphs: PMM
61
• Blog of developers team
• Blog of Mark Leith: author of sys schema
• Official reference manual
• PMM Demo
More informaiton
62
???
Time For Questions
63
http://www.slideshare.net/SvetaSmirnova
https://twitter.com/svetsmirnova
Thank you!
64

More Related Content

What's hot

How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraSveta Smirnova
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in ActionSveta Smirnova
 
Why MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it BackWhy MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it BackSveta Smirnova
 
How to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsHow to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsSveta Smirnova
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOpsSveta Smirnova
 
MySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsMySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsSveta Smirnova
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite PluginsSveta Smirnova
 
Lessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationLessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationSveta Smirnova
 
MongoDB Engines: Demystified
MongoDB Engines: DemystifiedMongoDB Engines: Demystified
MongoDB Engines: DemystifiedSveta Smirnova
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf TuningHighLoad2009
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionSveta Smirnova
 
Troubleshooting MySQL Performance
Troubleshooting MySQL PerformanceTroubleshooting MySQL Performance
Troubleshooting MySQL PerformanceSveta Smirnova
 
Basic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database AdministratorsBasic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database AdministratorsSveta Smirnova
 
How Safe is Asynchronous Master-Master Setup?
 How Safe is Asynchronous Master-Master Setup? How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?Sveta Smirnova
 
What you wanted to know about MySQL, but could not find using inernal instrum...
What you wanted to know about MySQL, but could not find using inernal instrum...What you wanted to know about MySQL, but could not find using inernal instrum...
What you wanted to know about MySQL, but could not find using inernal instrum...Sveta Smirnova
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTanel Poder
 
Introducing new SQL syntax and improving performance with preparse Query Rewr...
Introducing new SQL syntax and improving performance with preparse Query Rewr...Introducing new SQL syntax and improving performance with preparse Query Rewr...
Introducing new SQL syntax and improving performance with preparse Query Rewr...Sveta Smirnova
 
Percona Live 2012PPT: introduction-to-mysql-replication
Percona Live 2012PPT: introduction-to-mysql-replicationPercona Live 2012PPT: introduction-to-mysql-replication
Percona Live 2012PPT: introduction-to-mysql-replicationmysqlops
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 

What's hot (20)

How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with Galera
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
 
Why MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it BackWhy MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it Back
 
How to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsHow to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tears
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOps
 
MySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsMySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAs
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite Plugins
 
Lessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationLessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting Replication
 
MongoDB Engines: Demystified
MongoDB Engines: DemystifiedMongoDB Engines: Demystified
MongoDB Engines: Demystified
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
 
Troubleshooting MySQL Performance
Troubleshooting MySQL PerformanceTroubleshooting MySQL Performance
Troubleshooting MySQL Performance
 
MySQL 5.5 Guide to InnoDB Status
MySQL 5.5 Guide to InnoDB StatusMySQL 5.5 Guide to InnoDB Status
MySQL 5.5 Guide to InnoDB Status
 
Basic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database AdministratorsBasic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database Administrators
 
How Safe is Asynchronous Master-Master Setup?
 How Safe is Asynchronous Master-Master Setup? How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?
 
What you wanted to know about MySQL, but could not find using inernal instrum...
What you wanted to know about MySQL, but could not find using inernal instrum...What you wanted to know about MySQL, but could not find using inernal instrum...
What you wanted to know about MySQL, but could not find using inernal instrum...
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
 
Introducing new SQL syntax and improving performance with preparse Query Rewr...
Introducing new SQL syntax and improving performance with preparse Query Rewr...Introducing new SQL syntax and improving performance with preparse Query Rewr...
Introducing new SQL syntax and improving performance with preparse Query Rewr...
 
Percona Live 2012PPT: introduction-to-mysql-replication
Percona Live 2012PPT: introduction-to-mysql-replicationPercona Live 2012PPT: introduction-to-mysql-replication
Percona Live 2012PPT: introduction-to-mysql-replication
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 

Similar to Performance Schema for MySQL Troubleshooting

sveta smirnova - my sql performance schema in action
sveta smirnova - my sql performance schema in actionsveta smirnova - my sql performance schema in action
sveta smirnova - my sql performance schema in actionDariia Seimova
 
MySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action: the Complete TutorialMySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action: the Complete TutorialSveta Smirnova
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in ActionSveta Smirnova
 
Performance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshootingPerformance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshootingSveta Smirnova
 
End-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL ServerEnd-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL ServerKevin Kline
 
Performance Schema for MySQL Troubleshooting
 Performance Schema for MySQL Troubleshooting Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
Scaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersScaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersJonathan Levin
 
10x improvement-mysql-100419105218-phpapp02
10x improvement-mysql-100419105218-phpapp0210x improvement-mysql-100419105218-phpapp02
10x improvement-mysql-100419105218-phpapp02promethius
 
10x Performance Improvements
10x Performance Improvements10x Performance Improvements
10x Performance ImprovementsRonald Bradford
 
Query Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New TricksQuery Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New TricksMYXPLAIN
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
Optimizing applications and database performance
Optimizing applications and database performanceOptimizing applications and database performance
Optimizing applications and database performanceInam Bukhary
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1sqlserver.co.il
 
MySQL Troubleshooting with the Performance Schema
MySQL Troubleshooting with the Performance SchemaMySQL Troubleshooting with the Performance Schema
MySQL Troubleshooting with the Performance SchemaSveta Smirnova
 
Oracle Enteprise Manager Cloud Control 12c - Setting Up Metrics and Monitorin...
Oracle Enteprise Manager Cloud Control 12c - Setting Up Metrics and Monitorin...Oracle Enteprise Manager Cloud Control 12c - Setting Up Metrics and Monitorin...
Oracle Enteprise Manager Cloud Control 12c - Setting Up Metrics and Monitorin...Leighton Nelson
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Antonios Chatzipavlis
 
Empower my sql server administration with 5.7 instruments
Empower my sql server administration with 5.7 instrumentsEmpower my sql server administration with 5.7 instruments
Empower my sql server administration with 5.7 instrumentsMarco Tusa
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsfMao Geng
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowDean Richards
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWRpasalapudi
 

Similar to Performance Schema for MySQL Troubleshooting (20)

sveta smirnova - my sql performance schema in action
sveta smirnova - my sql performance schema in actionsveta smirnova - my sql performance schema in action
sveta smirnova - my sql performance schema in action
 
MySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action: the Complete TutorialMySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action: the Complete Tutorial
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
 
Performance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshootingPerformance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshooting
 
End-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL ServerEnd-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL Server
 
Performance Schema for MySQL Troubleshooting
 Performance Schema for MySQL Troubleshooting Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
Scaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersScaling MySQL Strategies for Developers
Scaling MySQL Strategies for Developers
 
10x improvement-mysql-100419105218-phpapp02
10x improvement-mysql-100419105218-phpapp0210x improvement-mysql-100419105218-phpapp02
10x improvement-mysql-100419105218-phpapp02
 
10x Performance Improvements
10x Performance Improvements10x Performance Improvements
10x Performance Improvements
 
Query Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New TricksQuery Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New Tricks
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
Optimizing applications and database performance
Optimizing applications and database performanceOptimizing applications and database performance
Optimizing applications and database performance
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
 
MySQL Troubleshooting with the Performance Schema
MySQL Troubleshooting with the Performance SchemaMySQL Troubleshooting with the Performance Schema
MySQL Troubleshooting with the Performance Schema
 
Oracle Enteprise Manager Cloud Control 12c - Setting Up Metrics and Monitorin...
Oracle Enteprise Manager Cloud Control 12c - Setting Up Metrics and Monitorin...Oracle Enteprise Manager Cloud Control 12c - Setting Up Metrics and Monitorin...
Oracle Enteprise Manager Cloud Control 12c - Setting Up Metrics and Monitorin...
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 
Empower my sql server administration with 5.7 instruments
Empower my sql server administration with 5.7 instrumentsEmpower my sql server administration with 5.7 instruments
Empower my sql server administration with 5.7 instruments
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should Know
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
 

More from Sveta Smirnova

MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?Sveta Smirnova
 
Database in Kubernetes: Diagnostics and Monitoring
Database in Kubernetes: Diagnostics and MonitoringDatabase in Kubernetes: Diagnostics and Monitoring
Database in Kubernetes: Diagnostics and MonitoringSveta Smirnova
 
MySQL Database Monitoring: Must, Good and Nice to Have
MySQL Database Monitoring: Must, Good and Nice to HaveMySQL Database Monitoring: Must, Good and Nice to Have
MySQL Database Monitoring: Must, Good and Nice to HaveSveta Smirnova
 
MySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersMySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersSveta Smirnova
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOpsSveta Smirnova
 
MySQL Test Framework для поддержки клиентов и верификации багов
MySQL Test Framework для поддержки клиентов и верификации баговMySQL Test Framework для поддержки клиентов и верификации багов
MySQL Test Framework для поддержки клиентов и верификации баговSveta Smirnova
 
MySQL Cookbook: Recipes for Your Business
MySQL Cookbook: Recipes for Your BusinessMySQL Cookbook: Recipes for Your Business
MySQL Cookbook: Recipes for Your BusinessSveta Smirnova
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sSveta Smirnova
 
Производительность MySQL для DevOps
 Производительность MySQL для DevOps Производительность MySQL для DevOps
Производительность MySQL для DevOpsSveta Smirnova
 
Modern solutions for modern database load: improvements in the latest MariaDB...
Modern solutions for modern database load: improvements in the latest MariaDB...Modern solutions for modern database load: improvements in the latest MariaDB...
Modern solutions for modern database load: improvements in the latest MariaDB...Sveta Smirnova
 
How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?Sveta Smirnova
 
Современному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
Современному хайлоду - современные решения: MySQL 8.0 и улучшения PerconaСовременному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
Современному хайлоду - современные решения: MySQL 8.0 и улучшения PerconaSveta Smirnova
 
Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Sveta Smirnova
 
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...Sveta Smirnova
 
Что нужно знать о трёх топовых фичах MySQL
Что нужно знать  о трёх топовых фичах  MySQLЧто нужно знать  о трёх топовых фичах  MySQL
Что нужно знать о трёх топовых фичах MySQLSveta Smirnova
 
Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Sveta Smirnova
 
Optimizer Histograms: When they Help and When Do Not?
Optimizer Histograms: When they Help and When Do Not?Optimizer Histograms: When they Help and When Do Not?
Optimizer Histograms: When they Help and When Do Not?Sveta Smirnova
 
Billion Goods in Few Categories: how Histograms Save a Life?
Billion Goods in Few Categories: how Histograms Save a Life?Billion Goods in Few Categories: how Histograms Save a Life?
Billion Goods in Few Categories: how Histograms Save a Life?Sveta Smirnova
 

More from Sveta Smirnova (18)

MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
 
Database in Kubernetes: Diagnostics and Monitoring
Database in Kubernetes: Diagnostics and MonitoringDatabase in Kubernetes: Diagnostics and Monitoring
Database in Kubernetes: Diagnostics and Monitoring
 
MySQL Database Monitoring: Must, Good and Nice to Have
MySQL Database Monitoring: Must, Good and Nice to HaveMySQL Database Monitoring: Must, Good and Nice to Have
MySQL Database Monitoring: Must, Good and Nice to Have
 
MySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersMySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for Developers
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOps
 
MySQL Test Framework для поддержки клиентов и верификации багов
MySQL Test Framework для поддержки клиентов и верификации баговMySQL Test Framework для поддержки клиентов и верификации багов
MySQL Test Framework для поддержки клиентов и верификации багов
 
MySQL Cookbook: Recipes for Your Business
MySQL Cookbook: Recipes for Your BusinessMySQL Cookbook: Recipes for Your Business
MySQL Cookbook: Recipes for Your Business
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]s
 
Производительность MySQL для DevOps
 Производительность MySQL для DevOps Производительность MySQL для DevOps
Производительность MySQL для DevOps
 
Modern solutions for modern database load: improvements in the latest MariaDB...
Modern solutions for modern database load: improvements in the latest MariaDB...Modern solutions for modern database load: improvements in the latest MariaDB...
Modern solutions for modern database load: improvements in the latest MariaDB...
 
How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?
 
Современному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
Современному хайлоду - современные решения: MySQL 8.0 и улучшения PerconaСовременному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
Современному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
 
Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?
 
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
 
Что нужно знать о трёх топовых фичах MySQL
Что нужно знать  о трёх топовых фичах  MySQLЧто нужно знать  о трёх топовых фичах  MySQL
Что нужно знать о трёх топовых фичах MySQL
 
Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?
 
Optimizer Histograms: When they Help and When Do Not?
Optimizer Histograms: When they Help and When Do Not?Optimizer Histograms: When they Help and When Do Not?
Optimizer Histograms: When they Help and When Do Not?
 
Billion Goods in Few Categories: how Histograms Save a Life?
Billion Goods in Few Categories: how Histograms Save a Life?Billion Goods in Few Categories: how Histograms Save a Life?
Billion Goods in Few Categories: how Histograms Save a Life?
 

Recently uploaded

Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 

Recently uploaded (20)

Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 

Performance Schema for MySQL Troubleshooting

  • 1. Performance Schema for MySQL Troubleshooting April, 25, 2017 Sveta Smirnova
  • 2. • MySQL Support engineer • Author of • MySQL Troubleshooting • JSON UDF functions • FILTER clause for MySQL • Speaker • Percona Live, OOW, Fosdem, DevConf, HighLoad... Sveta Smirnova 2
  • 3. •Overview and Configuration •Statements •Memory Usage •Locks Diagnostics •Variables and Status •Connection Diagnostics •Replication •Server Internals Table of Contents 3
  • 5. 5.6 • 52 tables • 554 instrs • 31 variables 5.7 • 87 tables • 1019 instrs • 42 variables 8.0 • 100 tables • 1160 instrs • 43 variables What is Inside? 5
  • 6. • Which statements are less optimal • Which operations take most of the time • Which locks and mutexes taken most often • What happens inside session • How much memory is allocated • Why users cannot connect from a host • More What Can be Found? 6
  • 7. • ON by default • Only global, thread, statements and transactions instrumentation enabled • All other consumers are disabled Performance Schema Defaults 7
  • 8. • Memory allocated on demand • You don’t need to limit size of tables anymore Configuraiton Improvements in 5.7 8
  • 9. • Memory allocated on demand • You don’t need to limit size of tables anymore • Sys schema is in the standard distribution Configuraiton Improvements in 5.7 8
  • 10. • Memory allocated on demand • You don’t need to limit size of tables anymore • Sys schema is in the standard distribution • You can turn statistics ON or OFF for particular host and/or user Configuraiton Improvements in 5.7 8
  • 11. • Memory allocated on demand • You don’t need to limit size of tables anymore • Sys schema is in the standard distribution • You can turn statistics ON or OFF for particular host and/or user • Size of SQL DIGEST is tunable Configuraiton Improvements in 5.7 8
  • 12. • Use pattern update performance_schema.setup_consumers set enabled=’yes’ where name like ’OUR_REQUIREMENT_%’; update performance_schema.setup_instruments set enabled=’yes’, timed=’yes’ where name like ’OUR_REQUIREMENT_%’; How to Configure 9
  • 13. • Use pattern • Or easier call sys.ps_setup_enable_consumer(YOUR_CONSUMER); Requires sys schema call sys.ps_setup_enable_instrument(YOUR_INSTRUMENT); Needs separate install before 5.7 How to Configure 9
  • 14. • Use pattern • Or easier • Be careful! • They are memory and CPU intensive • Do not turn them all ON until needed How to Configure 9
  • 16. • For regular SQL statements • Prepared statements • Stored routines • Stages of statements execution Statements Instrumentation 11
  • 17. • Why statements are slow? • Per-query statistics • Most evolving stages What Can We Discover? 12
  • 18. • Why statements are slow? • Per-query statistics • Most evolving stages • What was executed inside stored routine? What Can We Discover? 12
  • 19. • events statements * and prepared statements instances tables • Important field names CREATED TMP DISK TABLES CREATED TMP TABLES SELECT FULL JOIN SELECT RANGE CHECK SELECT SCAN SORT MERGE PASSES SORT SCAN Why Statements are Slow? 13
  • 20. • events statements * and prepared statements instances tables • Views in sys schema • Important view names statement analysis statements with full table scans statements with runtimes in 95th percentile statements with sorting statements with temp tables statements with errors or warnings Why Statements are Slow? 13
  • 21. mysql> SELECT THREAD_ID TID, SUBSTR(SQL_TEXT, 1, 50) SQL_TEXT, ROWS_SENT RS, -> ROWS_EXAMINED RE,CREATED_TMP_TABLES,NO_INDEX_USED,NO_GOOD_INDEX_USED -> FROM performance_schema.events_statements_history -> WHERE NO_INDEX_USED=1 OR NO_GOOD_INDEX_USED=1G ********************** 1. row ********************** TID: 10124 SQL_TEXT: select emp_no, first_name, last_name from employee RS: 97750 RE: 397774 CREATED_TMP_TABLES: 0 NO_INDEX_USED: 1 NO_GOOD_INDEX_USED: 0 ... Which Queries Do Not Use Indexes? 14
  • 22. mysql> SELECT query, total_latency, no_index_used_count, rows_sent, -> rows_examined -> FROM sys.statements_with_full_table_scans -> WHERE db=’employees’ AND query NOT LIKE ’%performance_schema%’G ********************** 1. row ********************** query: SELECT COUNT ( ‘emp_no‘ ) FROM ... ‘emp_no‘ ) WHERE ‘title‘ = ? total_latency: 805.37 ms no_index_used_count: 1 rows_sent: 1 rows_examined: 397774 ... Take it Easy: Index Usage with sys Schema 15
  • 23. mysql> prepare stmt from ’select dept_no, sum(salary) from employees e ... mysql> set @d1=’d001’, @d2=’d002’, @d3=’d003’, @d4=’d004’; mysql> execute stmt using @d1, @d2, @d3, @d4; +---------+-------------+ | dept_no | sum(salary) | +---------+-------------+ | d001 | 13725425266 | | d002 | 11650834677 | | d003 | 9363811425 | | d004 | 41554438942 | | d005 | 2494260927 | ... Prepared Statements Diagnostics 16
  • 24. mysql> select * from performance_schema.prepared_statements_instancesG *************************** 1. row *************************** OBJECT_INSTANCE_BEGIN: 139956274327632 STATEMENT_ID: 1 STATEMENT_NAME: stmt SQL_TEXT: select dept_no, sum(salary) from employees e... OWNER_THREAD_ID: 28 ... COUNT_REPREPARE: 0 COUNT_EXECUTE: 1 ... Prepared Statements Diagnostics 17
  • 25. ... SUM_ROWS_SENT: 9 SUM_ROWS_EXAMINED: 2011495 SUM_CREATED_TMP_DISK_TABLES: 0 SUM_CREATED_TMP_TABLES: 1 ... SUM_SELECT_SCAN: 1 ... SUM_SORT_ROWS: 9 SUM_SORT_SCAN: 1 Prepared Statements Diagnostics 18
  • 26. • What happens inside a routine • Queries, called from the routine • statement/sp/statement Stored Routines Instrumentation 19
  • 27. • We will use this procedure CREATE DEFINER=‘root‘@‘localhost‘ PROCEDURE ‘sp_test‘(val int) BEGIN DECLARE CONTINUE HANDLER FOR 1364, 1048, 1366 BEGIN INSERT IGNORE INTO t1 VALUES(’Some string’); GET STACKED DIAGNOSTICS CONDITION 1 @st_state = RETURNED_SQLSTATE; GET STACKED DIAGNOSTICS CONDITION 1 @stacked_msg = MESSAGE_TEXT; END; INSERT INTO t1 VALUES(val); END • When HANDLER called? Stored Routines: example 20
  • 28. mysql> call sp_test(1); Query OK, 1 row affected (0.07 sec) mysql> select thread_id, event_name, sql_text from events_statements_history -> where event_name like ’statement/sp%’; +-----------+-------------------------+----------------------------+ | thread_id | event_name | sql_text | +-----------+-------------------------+----------------------------+ | 24 | statement/sp/hpush_jump | NULL | | 24 | statement/sp/stmt | INSERT INTO t1 VALUES(val) | | 24 | statement/sp/hpop | NULL | +-----------+-------------------------+----------------------------+ 3 rows in set (0.00 sec) Correct Value 21
  • 29. mysql> call sp_test(NULL); Query OK, 1 row affected (0.07 sec) mysql> select thread_id, event_name, sql_text from events_statements_history -> where event_name like ’statement/sp%’; +-----------+-------------------------+-------------------------------------------+ | thread_id | event_name | sql_text | +-----------+-------------------------+-------------------------------------------+ | 24 | statement/sp/hpush_jump | NULL | | 24 | statement/sp/stmt | INSERT INTO t1 VALUES(val) | | 24 | statement/sp/stmt | INSERT IGNORE INTO t1 VALUES(’Som... | | 24 | statement/sp/stmt | GET STACKED DIAGNOSTICS CONDITION... | | 24 | statement/sp/stmt | GET STACKED DIAGNOSTICS CONDITION... | | 24 | statement/sp/hreturn | NULL | | 24 | statement/sp/hpop | NULL | +-----------+-------------------------+ 7 rows in set (0.00 sec) HANDLER call 22
  • 30. • events stages * tables Statements Deep Dive 23
  • 31. • events stages * tables • Same information as in table INFORMATION SCHEMA.PROCESSLIST or SHOW PROCESSLIST output • init • executing • Opening tables Statements Deep Dive 23
  • 32. • events stages * tables • Same information as in table INFORMATION SCHEMA.PROCESSLIST or SHOW PROCESSLIST output • init • executing • Opening tables • Replacement for SHOW PROFILE Statements Deep Dive 23
  • 33. • events stages * tables • Same information as in table INFORMATION SCHEMA.PROCESSLIST or SHOW PROCESSLIST output • init • executing • Opening tables • Replacement for SHOW PROFILE • Only server-level • No storage engine information! Statements Deep Dive 23
  • 34. • Everything, related to temporary tables • EVENT NAME LIKE ’stage/sql/%tmp%’ • Everything, related to locks • EVENT NAME LIKE ’stage/sql/%lock%’ • Everything in state ”Waiting for” • EVENT NAME LIKE ’stage/%/Waiting for%’ • Frequently met issues Stages Shortcuts 24
  • 35. • Everything, related to temporary tables • Everything, related to locks • Everything in state ”Waiting for” • Frequently met issues • EVENT NAME=’stage/sql/freeing items’ • EVENT NAME=’stage/sql/Sending data’ • EVENT NAME=’stage/sql/cleaning up’ • EVENT NAME=’stage/sql/closing tables’ • EVENT NAME=’stage/sql/end’ Stages Shortcuts 24
  • 36. mysql> SELECT eshl.event_name, sql_text, eshl.timer_wait/1000000000000 w_s -> FROM performance_schema.events_stages_history_long eshl -> JOIN performance_schema.events_statements_history_long esthl -> ON (eshl.nesting_event_id = esthl.event_id) -> WHERE eshl.timer_wait > 1*10000000000G *************************** 1. row *************************** event_name: stage/sql/Sending data sql_text: SELECT COUNT(emp_no) FROM employees JOIN salaries USING(emp_no) WHERE hire_date=from_date w_s: 0.8170 1 row in set (0.00 sec) Stages Example: Which Stage Run Critically Long? 25
  • 38. • Since version 5.7 • Answers on question: how memory used? • Overall and detailed statistics Memory Instrumentation 27
  • 39. • Since version 5.7 • Answers on question: how memory used? • Overall and detailed statistics • Memory usage per server mysql> select * from sys.memory_global_total; +-----------------+ | total_allocated | +-----------------+ | 319.69 MiB | +-----------------+ 1 row in set (0.05 sec) Memory Instrumentation 27
  • 40. mysql> select thread_id tid, user, current_allocated ca, total_allocated -> from sys.memory_by_thread_by_current_bytes; +-----+-------------------------+-------------+-----------------+ | tid | user | ca | total_allocated | +-----+-------------------------+-------------+-----------------+ | 1 | sql/main | 2.53 GiB | 2.69 GiB | | 150 | root@127.0.0.1 | 4.06 MiB | 32.17 MiB | | 146 | sql/slave_sql | 1.31 MiB | 1.44 MiB | | 145 | sql/slave_io | 1.08 MiB | 2.79 MiB | ... | 4 | innodb/io_log_thread | -2880 bytes | 132.38 KiB | | 72 | innodb/io_write_thread | -7632 bytes | 1.10 MiB | +-----+-------------------------+-------------+-----------------+ 145 rows in set (2.65 sec) Detailed Memory Statistics 28
  • 41. • memory summary by account by event name • memory summary by host by event name • memory summary by thread by event name • memory summary by user by event name • memory summary global by event name • sys schema includes user account RAW Performance Schema Tables 29
  • 42. • NAME@HOST - regular user • System users • sql/main • innodb/* • ... • Data comes from table THREADS Users in sys.memory * Tables 30
  • 44. • Metadata locks • Table METADATA LOCKS • Table-level locks • Table TABLE HANDLES • Engine-dependent locks, transactions • Tables EVENTS TRANSACTIONS * • This is not exactly lock information! What can Block Your Queries? 32
  • 45. • Table METADATA LOCKS • Which thread is waiting for a lock • Which thread holds the lock • Not only for tables: GLOBAL, SCHEMA, TABLE, FUNCTION, PROCEDURE, EVENT, COMMIT, USER LEVEL LOCK, TABLESPACE Metadata Locks 33
  • 46. mysql> select processlist_id, object_type, lock_type, lock_status, source -> from metadata_locks join threads on (owner_thread_id=thread_id) -> where object_schema=’employees’ and object_name=’titles’G *************************** 1. row *************************** processlist_id: 4 object_type: TABLE lock_type: EXCLUSIVE lock_status: PENDING -- waits source: mdl.cc:3263 *************************** 2. row *************************** processlist_id: 5 object_type: TABLE lock_type: SHARED_READ lock_status: GRANTED -- holds source: sql_parse.cc:5707 METADATA LOCKS: example 34
  • 47. • Table TABLE HANDLES • Not only locks, but all open tables • FLUSH TABLES removes data from this table Table Locks 35
  • 48. mysql> select * from table_handlesG *************************** 1. row *************************** OBJECT_TYPE: TABLE OBJECT_SCHEMA: employees OBJECT_NAME: titles OBJECT_INSTANCE_BEGIN: 140663937105248 OWNER_THREAD_ID: 28 OWNER_EVENT_ID: 951 INTERNAL_LOCK: NULL EXTERNAL_LOCK: READ EXTERNAL - Read lock (I run LOCK TABLE ... READ) Table Locks: example 36
  • 49. *************************** 2. row *************************** OBJECT_TYPE: TABLE OBJECT_SCHEMA: employees OBJECT_NAME: emp OBJECT_INSTANCE_BEGIN: 140663879605856 OWNER_THREAD_ID: 26 OWNER_EVENT_ID: 10419193 INTERNAL_LOCK: WRITE - Table lock for MyISAM table EXTERNAL_LOCK: WRITE EXTERNAL - Write lock 2 rows in set (0.00 sec) Table Locks: example 37
  • 50. • Tables EVENTS TRANSACTIONS * • Transaction information even if engine is not transactional - One more tool to hunt MDL • GTIDs • Background transactions Transactions at Server Level 38
  • 51. mysql> select processlist_ID, STATE, GTID, SOURCE, ACCESS_MODE, -> ISOLATION_LEVEL, AUTOCOMMIT -> from events_transactions_current join threads using(thread_id)G ************************ 1. row ************************ processlist_ID: NULL STATE: COMMITTED GTID: NULL SOURCE: handler.cc:1248 ACCESS_MODE: READ WRITE ISOLATION_LEVEL: REPEATABLE READ AUTOCOMMIT: YES ... Background Transaction 39
  • 52. mysql> select processlist_ID, STATE, GTID, SOURCE, -> ACCESS_MODE, ISOLATION_LEVEL, AUTOCOMMIT -> from events_transactions_current join threads using(thread_id)G ************************ 2. row ************************ processlist_ID: 4 STATE: COMMITTED GTID: AUTOMATIC - GTID information here SOURCE: transaction.cc:150 ACCESS_MODE: READ WRITE ISOLATION_LEVEL: REPEATABLE READ AUTOCOMMIT: NO Transaction in BEGIN ... COMMIT Block 40
  • 53. mysql> select processlist_ID, STATE, GTID, SOURCE, -> ACCESS_MODE, ISOLATION_LEVEL, AUTOCOMMIT -> from events_transactions_current join threads using(thread_id)G ************************ 3. row ************************ processlist_ID: 5 STATE: COMMITTED GTID: NULL SOURCE: handler.cc:1248 ACCESS_MODE: READ WRITE ISOLATION_LEVEL: REPEATABLE READ AUTOCOMMIT: YES ... Autocommitted Transaction 41
  • 55. • Now in Performance Schema • Global • Session • User-defined - First time ever! Variables and Status 43
  • 56. • Now in Performance Schema • Global • Session • User-defined - First time ever! • Tables in Information Schema • Deprecated in 5.7 • Removed in 8.0.1 Variables and Status 43
  • 57. • Variables • Global • Session • By thread • User variables • By thread • Status variables • Global • Session • Account • Host • User • Thread Groupped by 44
  • 58. • Variables mysql> select * from variables_by_thread -> where variable_name=’tx_isolation’; +-----------+---------------+-----------------+ | THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE | +-----------+---------------+-----------------+ | 71 | tx_isolation | REPEATABLE-READ | | 83 | tx_isolation | REPEATABLE-READ | | 84 | tx_isolation | SERIALIZABLE | +-----------+---------------+-----------------+ 3 rows in set, 3 warnings (0.00 sec) Variables and Status: example 45
  • 59. • Variables • User variables mysql> select * from user_variables_by_thread; +-----------+---------------+----------------+ | THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE | +-----------+---------------+----------------+ | 71 | baz | boo | | 84 | foo | bar | +-----------+---------------+----------------+ 2 rows in set (0.00 sec) Variables and Status: example 45
  • 60. • Variables • User variables • Status variables mysql> select * from status_by_thread -> where variable_name=’Handler_write’; +-----------+---------------+----------------+ | THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE | +-----------+---------------+----------------+ | 71 | Handler_write | 94 | | 83 | Handler_write | 477 | -- Most writes | 84 | Handler_write | 101 | +-----------+---------------+----------------+ 3 rows in set (0.00 sec) Variables and Status: example 45
  • 62. • Tables accounts, users, hosts mysql> select user, host, current_connections as cur, -> total_connections as total from accounts; +------+-----------+-----+-------+ | user | host | cur | total | +------+-----------+-----+-------+ | foo | localhost | 0 | 3 | | root | localhost | 1 | 3 | | NULL | NULL | 14 | 17 | +------+-----------+-----+-------+ 3 rows in set (0.01 sec) • Connection attributes Connection Diagnostics 47
  • 63. • Connection attributes mysql> SELECT ATTR_NAME, ATTR_VALUE FROM session_account_connect_attrs -> WHERE processlist_id != @@pseudo_thread_id; +-----------------+--------------------------+ | ATTR_NAME | ATTR_VALUE | +-----------------+--------------------------+ | _os | Linux | | _client_name | libmysql | | _pid | 4729 | | program_name | PLMCE-2017 | | _platform | x86_64 | | session | MySQL Performance Schema | | author | Sveta Smirnova | | _client_version | 5.7.17-13 | +-----------------+--------------------------+ Connection Diagnostics 47
  • 64. • Content of DNS cache • Errors from: • Name Server • Connection • Authentication • max connect errors, max user errors, etc. • Your first assistant in case of connection issue Host Cache 48
  • 66. • Data from SHOW SLAVE STATUS available in replication * tables • Not full replacement • Binary, relay log names and positions are in mysql.slave * tables • GTID information for single-threaded slave is in gtid executed variable Replication Diagnostics 50
  • 67. • Data from SHOW SLAVE STATUS available in replication * tables • Not full replacement • Binary, relay log names and positions are in mysql.slave * tables • GTID information for single-threaded slave is in gtid executed variable • Support of Replication Channels (Multi-threaded slave) Replication Diagnostics 50
  • 68. • Data from SHOW SLAVE STATUS available in replication * tables • Not full replacement • Binary, relay log names and positions are in mysql.slave * tables • GTID information for single-threaded slave is in gtid executed variable • Support of Replication Channels (Multi-threaded slave) • GTID instrumentation Replication Diagnostics 50
  • 69. • No need to parse SHOW output SLAVE STATUS 51
  • 70. • No need to parse SHOW output • Configuration • replication connection configuration • replication applier configuration SLAVE STATUS 51
  • 71. • No need to parse SHOW output • Configuration • IO thread • replication connection status SLAVE STATUS 51
  • 72. • No need to parse SHOW output • Configuration • IO thread • SQL thread • replication applier status • replication applier status by coordinator • replication applier status by worker - MTS only SLAVE STATUS 51
  • 73. • Configuration mysql> select * from replication_connection_configuration -> join replication_applier_configuration using(channel_name)G *************************** 1. row *************************** CHANNEL_NAME: HOST: 127.0.0.1 PORT: 13000 USER: root NETWORK_INTERFACE: AUTO_POSITION: 1 SSL_ALLOWED: NO SSL_CA_FILE: ... SLAVE STATUS 52
  • 74. • Configuration ... CONNECTION_RETRY_INTERVAL: 60 CONNECTION_RETRY_COUNT: 10 HEARTBEAT_INTERVAL: 60.000 CHANNEL_NAME: DESIRED_DELAY: 0 1 row in set (0.00 sec) SLAVE STATUS 53
  • 75. • State of IO Thread mysql> select * from replication_connection_statusG *************************** 1. row *************************** CHANNEL_NAME: GROUP_NAME: SOURCE_UUID: d0753e78-14ec-11e5-b3fb-28b2bd7442fd THREAD_ID: 21 SERVICE_STATE: ON COUNT_RECEIVED_HEARTBEATS: 17 LAST_HEARTBEAT_TIMESTAMP: 2015-06-17 15:49:08 RECEIVED_TRANSACTION_SET: LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00 1 row in set (0.00 sec) SLAVE STATUS 54
  • 76. • State of SQL Thread mysql> select * from replication_applier_status join -> replication_applier_status_by_coordinator using(channel_name)G *************************** 1. row *************************** CHANNEL_NAME: SERVICE_STATE: ON REMAINING_DELAY: NULL COUNT_TRANSACTIONS_RETRIES: 0 THREAD_ID: 22 SERVICE_STATE: ON LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00 1 row in set (0.00 sec) SLAVE STATUS 55
  • 78. • EVENTS WAITS * tables • EVENT NAME wait/synch/rwlock/innodb/dict operation lock • SOURCE Line of the source code • OPERATION Kind of operation: read, lock, write Server Internals 57
  • 79. • wait/lock - Metadata and table locks • wait/synch/cond - InnoDB, MyISAM, sql • wait/synch/mutex - sql, mysys, engines • wait/synch/rwlock - sql, InnoDB, MyISAM • wait/synch/sxlock - InnoDB global locks • wait/io/file - Operations with files • wait/io/socket • wait/io/table/sql/handler Which Kind of Events Can We Examine? 58
  • 80. • file instances - Opened files • socket instances - Connections • cond instances • rwlock instances select * from rwlock_instances where READ_LOCKED_BY_COUNT > 0; select * from rwlock_instances where WRITE_LOCKED_BY_THREAD_ID > 0; • mutex instances - LOCKED BY THREAD ID * INSTANCES Tables 59
  • 81. • Tables in sys schema • io * • host summary * • user summary * • waits * Diagnostic Sugar 60
  • 82. • Tables in sys schema • Digests events waits summary * • *by account by event name • *by host by event name • *by instance • *by thread by event name • *by user by event name • *by event name Diagnostic Sugar 60
  • 84. • Blog of developers team • Blog of Mark Leith: author of sys schema • Official reference manual • PMM Demo More informaiton 62