SlideShare a Scribd company logo
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
MySQL Performance Schema
Out of the Box in MySQL 5.7
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.
Mayank Prasad
Principal Member Technical Staff
Oracle, MySQL
November 20, 2015
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
2
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Need and Design
Instruments and instrumentation
Statistics tables
Use cases
What’s new in MySQL 5.7
1
2
3
4
5
3
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Need and Design
Instruments and instrumentation
Statistics tables
Use cases
What’s new in MySQL 5.7
1
2
3
4
5
4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Why Performance Schema?
System
Low throughput?
?
5
DBA
Hot table?
Network
High traffic on link?
Storage
Too much Disk spin?App Developer
Slow application?
MySQL Developer
Code contention?
End User
stuck session?
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
MySQL 5.7 Performance Schema : Design
Block Diagram
MySQL
Server
Instrumentation points
(P_S hooks)
P_S Internal Buffers
P_S
Storage
Engine
Storage
Engine
Interface
Statistics
Report
Fetch
Data
SQL Query
Collect Data
Store
Data
P_S
Tables
6
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Need and Design
Instruments and instrumentation
Statistics tables
Use cases
What’s new in MySQL 5.7
1
2
3
4
5
7
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Instruments
8
• Name of monitored activity.
• Tree like structure. Separated by ‘/’.
• Left to right : More generic to more specific.
• 1000+ instruments in MySQL 5.7.
• Stored in setup_instruments table.
wait/io/file/myisam/log
statement/sql/select
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Need and Design
Instruments and instrumentation
Statistics tables
Use cases
What’s new in MySQL 5.7
1
2
3
4
5
9
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Statistics Tables in Performance Schema
10
SETUP
TABLES
Instruments
Actors
Objects
Consumers
TIMERS
EVENTS
TABLES
Transactions
Statements
Stages
Waits
Idle
REPLICATION
SUMMARY
SYSTEM
VARIABLES
STATUS
VARIABLES
LOCK TABLES
Metadata
locks
Table Handles
SUMMARY
TABLES
Events
Memory
File I/O,
Table I/O,
Table locks
Socket
Connection
…
CONNECTION
Attribute
Type
INSTANCE
TABLES
Mutex
RW_locks
File
Sockets
Cond MISC
By_global By_thread By_user/host By_account By_digest
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Need and Design
Instruments and instrumentation
Statistics tables
Use cases
What’s new in MySQL 5.7
1
2
3
4
5
11
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
What does Performance Schema provide …
update setup_instruments set ENABLED='YES', TIMED='YES';
12
Connection 1 (Thread 24)
start transaction;
insert into test.t1 values('11');
commit;
start transaction;
insert into test.t1 values('12');
commit;
start transaction;
insert into test.t1 values('13');
commit;
select * from test.t1;
Connection 2 (Thread 25)
start transaction;
insert into test.t2 values('21');
commit;
start transaction;
insert into test.t2 values('22');
commit;
Three
inserts
Two
inserts
Latest
Statement
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
What does Performance Schema provide … (cont.)
Statements Statistics
* Timer unit is PICOSECOND.
EVENTS_STATEMENTS_CURRENT
THREAD_ID 24 25
EVENT_NAME
statement/sql
/select
statement/sql/
commit
TIMER_WAIT 876585000 15998287000
SQL_TEXT
select * from
test.t1
commit
ROWS_SENT 3 0
NO_INDEX_USED 0 0
SELECT_SCAN 1 0
13
EVENTS_STATEMENTS_SUMMARY_BY_THREAD_BY_EVENT
_NAME
THREAD_ID 24 25
EVENT_NAME
statement/sql
/insert
statement/sql
/insert
COUNT_STAR 3 2
SUM_TIMER_WAIT 35181659000 3477432000
SUM_ROWS_AFFECTED 3 2
SUM_SELECT_SCAN 0 0
SUM_NO_INDEX_USED 0 0
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
What does Performance Schema provide … (cont.)
Statements Statistics (cont.)
* Timer unit is PICOSECOND.
14
EVENTS_STATEMENTS_SUMMARY_GLOBAL_BY_EVENT_NAME
EVENT_NAME statement/sql/insert statement/sql/commit
COUNT_STAR 5 5
SUM_TIMER_WAIT 38659091000 65812216000
… …
SUM_ROWS_AFFECTED 5 0
… … …
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Use case 1
Description
15
• Multiple queries running for long on MySQL Server
• Few long running query (taking lots of time)
• No idea which one
• No idea why
• What to do ? …
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Use case 1
Diagnosis
16
– THREAD_ID: 25
– EVENT_ID: 89
– EVENT_NAME: statement/sql/select
– SQL_TEXT : select bla bla bla…;
• Wait ! There’s more!
– SELECT_SCAN : 1
– NO_INDEX_USED: 1
• Aha !!
SELECT * FROM events_statements_history WHERE TIMER_WAIT > ‘X’;
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Use case 2
Statements giving errors ( or warnings)
17
SELECT DIGEST_TEXT, SCHEMA_NAME, COUNT_STAR, SUM_ERRORS, SUM_WARNINGS
FROM events_statements_summary_by_digest WHERE SUM_ERRORS > 0
ORDER BY SUM_ERRORS DESC limit 1G;
EVENTS_STATEMENTS_SUMMARY_BY_DIGEST
DIGEST_TEXT CREATE TEMPORARY TABLE IF NOT ... _logs` ( `id` INT8 NOT NULL )!
SCHEMA_NAME mem
COUNT_STAR 1725
SUM_ERRORS 1725
SUM_WARNINGS 0
FIRST_SEEN 2014-05-20 10:42:32
LAST_SEEN 2014-05-21 18:39:22
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Use case 3
Description
18
• Multithreaded environment
• My session is stuck
• No idea why
• What to do ? …
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Use case 3
• What T1 is waiting for
– Say T1 is waiting for mutex_A (column OBJECT_INSTANCE_BEGIN)
• Lets see who has taken this mutex_A
– Ok, so thread T2 is holding mutex_A (column LOCKED_BY_THREAD_ID)
• Find out what thread t2 is waiting for
• And so on…
SELECT * FROM mutex_instances WHERE OBJECT_INSTANCE_BEGIN = mutex_A;
SELECT * FROM events_waits_current WHERE THREAD_ID = T2;
Diagnosis
19
SELECT * FROM events_waits_current WHERE THREAD_ID = T1;
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Replication Summary Tables
Tables for replication statistics
20
Replication status
Connection Information Execute Information
Connection Configuration Connection Status
Execute Configuration Execute Status
Coordinator/SQL
Thread
Worker Thread
replication_connection
_configuration
replication_connection
_status
replication_execute_status
_by_coordinator
replication_execute_status
_by_worker
replication_execute
_status
replication_execute
_configuration
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Replication Summary Tables
Tables for replication statistics
Table Information
replication_connection_configuration (Host, Port, User etc.)
replication_connection_status
(Server UUID, Receiver thread ID, Service
State etc.)
replication_execute_configuration (Desired Delay)
replication_execute_status (Remaining Delay)
replication_execute_status_by_coordinator (Thread Id, Service State, Last Error info.)
replication_execute_status_by_worker (WID, WTID, Service State, Last error Info.)
21
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Replication Summary Tables
Tables for replication statistics
22
SHOW SLAVE STATUS (Limitations)
– No logical division of information.
– Lots of information packed together.
– No cherry picking (difficult for automation).
– Difficult to scale (more new fields).
Why Performance Schema Tables?
– Split logically into different tables.
– SQL Interface. Fetch what is required.
– Easier to extend.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Event Hierarchy
23
event_id
nesting_event_id
event_id
nesting_event_id
event_id
nesting_event_id
event_id
nesting_event_id
event_id
nesting_event_id
event_id
nesting_event_id
event_id
nesting_event_id
event_id
nesting_event_id
Transactions Statements Stages Waits
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Need and Design
Instruments and instrumentation
Statistics tables
Use cases
What’s new in MySQL 5.7
1
2
3
4
5
24
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
What’s new in MySQL 5.7
2525
EnhancementsNew
Instruments
transactionsMemory
usage
Stored
programs
Prepared
statements
Metadata
locks
Connection
type InnoDB
Stages
User
variables
Replication
summary
tables
History per
session
Scalable
memory
allocation
Configurable
digest size
…
MySQL 5.7
Global/Session
variables/status
87 Tables and 1000+ Instruments
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
SYS Schema (earlier known as P_S Helper)
What’s new in MySQL 5.7
Procedures Functions Views
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Thank You

More Related Content

PDF
Replication featuresinmysql5.7andbeyond osi-final
PDF
MySQL-InnoDB
PDF
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
PPTX
MySQL Performance Schema : fossasia
PPT
OSI_MySQL_Performance Schema
PPTX
MySQL Performance Schema in MySQL 8.0
PDF
Introduction to MySQL Cluster
PDF
01 demystifying mysq-lfororacledbaanddeveloperv1
Replication featuresinmysql5.7andbeyond osi-final
MySQL-InnoDB
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL Performance Schema : fossasia
OSI_MySQL_Performance Schema
MySQL Performance Schema in MySQL 8.0
Introduction to MySQL Cluster
01 demystifying mysq-lfororacledbaanddeveloperv1

What's hot (20)

PPTX
What to Expect From Oracle database 19c
PDF
Getting optimal performance from oracle e business suite(aioug aug2015)
PDF
TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...
PDF
Mysql tech day_paris_ps_and_sys
PPTX
What_to_expect_from_oracle_database_12c
PDF
LAD -GroundBreakers-Jul 2019 - The Machine Learning behind the Autonomous Dat...
PDF
OUG Harmony 2012 - Using SQL Plan Baselines for Performance Testing
PDF
Machine Learning and AI at Oracle
PDF
MySQL 5.7 - What's new, How to upgrade and Document Store
PDF
Introduction to Machine Learning - From DBA's to Data Scientists - OGBEMEA
PDF
Session 319
PDF
Oracle RAC 19c with Standard Edition (SE) 2 - Support Update
PDF
LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...
PPTX
Protect Sensitive Data: Implementing Fine-Grained Access Control in Oracle
PDF
AWR, ASH with EM13 at HotSos 2016
PDF
Upgrading to my sql 8.0
PDF
Oracle Database In-Memory Advisor (English)
PDF
Oracle Database 19c - poslední z rodiny 12.2 a co přináší nového
PDF
MySQL Enterprise Monitor
PPTX
Dimensional modeling in oracle sql developer
What to Expect From Oracle database 19c
Getting optimal performance from oracle e business suite(aioug aug2015)
TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...
Mysql tech day_paris_ps_and_sys
What_to_expect_from_oracle_database_12c
LAD -GroundBreakers-Jul 2019 - The Machine Learning behind the Autonomous Dat...
OUG Harmony 2012 - Using SQL Plan Baselines for Performance Testing
Machine Learning and AI at Oracle
MySQL 5.7 - What's new, How to upgrade and Document Store
Introduction to Machine Learning - From DBA's to Data Scientists - OGBEMEA
Session 319
Oracle RAC 19c with Standard Edition (SE) 2 - Support Update
LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...
Protect Sensitive Data: Implementing Fine-Grained Access Control in Oracle
AWR, ASH with EM13 at HotSos 2016
Upgrading to my sql 8.0
Oracle Database In-Memory Advisor (English)
Oracle Database 19c - poslední z rodiny 12.2 a co přináší nového
MySQL Enterprise Monitor
Dimensional modeling in oracle sql developer
Ad

Viewers also liked (14)

PDF
Nlnn 51 0_cap nuoc sinh hoat va cong nghiep15
DOCX
Libro de ejercicios word 2007
PDF
International Journal of Engineering Research and Development (IJERD)
PPTX
Virus informaticos
DOCX
Encuestas producto a y b spss resultados
PDF
1 harper-kp-keynote
PPT
Summer in Salla 2013
DOCX
PPTX
Ruth's (u) OWBC 31: When You Find You're A Broken Down Critter
PPTX
Fuchs That! A Trailer Park Challenge #5
PPTX
Inovação esamc
PDF
MySQL sys schema deep dive
PPTX
Aula - Planejamento para Competitividade
PPTX
Indah r.a xii ips 2
Nlnn 51 0_cap nuoc sinh hoat va cong nghiep15
Libro de ejercicios word 2007
International Journal of Engineering Research and Development (IJERD)
Virus informaticos
Encuestas producto a y b spss resultados
1 harper-kp-keynote
Summer in Salla 2013
Ruth's (u) OWBC 31: When You Find You're A Broken Down Critter
Fuchs That! A Trailer Park Challenge #5
Inovação esamc
MySQL sys schema deep dive
Aula - Planejamento para Competitividade
Indah r.a xii ips 2
Ad

Similar to MySQL Performance Schema, Open Source India, 2015 (20)

PPTX
Mysql Performance Schema - fossasia 2016
PPTX
OUGLS 2016: How profiling works in MySQL
PDF
20150110 my sql-performanceschema
PDF
The MySQL Performance Schema & New SYS Schema
PDF
MySQL's Performance Schema, SYS Schema and Workbench Integration
ODP
MySQL Monitoring Mechanisms
ODP
MySQL Monitoring Mechanisms
ODP
Performance schema and_ps_helper
PPT
MySQL 5.7: Performance Schema Improvements
PPT
Empower my sql server administration with 5.7 instruments
PDF
Performance Schema and Sys Schema in MySQL 5.7
PDF
MySQL Troubleshooting with the Performance Schema
PDF
MySQL Performance schema missing_manual_flossuk
PDF
Performance Schema for MySQL Troubleshooting
PDF
MySQL Performance Schema in Action: the Complete Tutorial
PDF
MySQL Performance Schema in Action
PDF
New features in Performance Schema 5.7 in action
PDF
MySQL Enterprise Monitor
PDF
제3회난공불락 오픈소스 인프라세미나 - MySQL Performance
PDF
MySQL sys schema deep dive
Mysql Performance Schema - fossasia 2016
OUGLS 2016: How profiling works in MySQL
20150110 my sql-performanceschema
The MySQL Performance Schema & New SYS Schema
MySQL's Performance Schema, SYS Schema and Workbench Integration
MySQL Monitoring Mechanisms
MySQL Monitoring Mechanisms
Performance schema and_ps_helper
MySQL 5.7: Performance Schema Improvements
Empower my sql server administration with 5.7 instruments
Performance Schema and Sys Schema in MySQL 5.7
MySQL Troubleshooting with the Performance Schema
MySQL Performance schema missing_manual_flossuk
Performance Schema for MySQL Troubleshooting
MySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action
New features in Performance Schema 5.7 in action
MySQL Enterprise Monitor
제3회난공불락 오픈소스 인프라세미나 - MySQL Performance
MySQL sys schema deep dive

Recently uploaded (20)

PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Understanding Forklifts - TECH EHS Solution
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
assetexplorer- product-overview - presentation
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Digital Strategies for Manufacturing Companies
PPTX
Transform Your Business with a Software ERP System
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Design an Analysis of Algorithms II-SECS-1021-03
Understanding Forklifts - TECH EHS Solution
PTS Company Brochure 2025 (1).pdf.......
assetexplorer- product-overview - presentation
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Digital Strategies for Manufacturing Companies
Transform Your Business with a Software ERP System
Softaken Excel to vCard Converter Software.pdf
Computer Software and OS of computer science of grade 11.pptx
top salesforce developer skills in 2025.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Digital Systems & Binary Numbers (comprehensive )
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
ai tools demonstartion for schools and inter college
Navsoft: AI-Powered Business Solutions & Custom Software Development
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Reimagine Home Health with the Power of Agentic AI​
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus

MySQL Performance Schema, Open Source India, 2015

  • 1. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | MySQL Performance Schema Out of the Box in MySQL 5.7 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Mayank Prasad Principal Member Technical Staff Oracle, MySQL November 20, 2015
  • 2. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda Need and Design Instruments and instrumentation Statistics tables Use cases What’s new in MySQL 5.7 1 2 3 4 5 3
  • 4. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda Need and Design Instruments and instrumentation Statistics tables Use cases What’s new in MySQL 5.7 1 2 3 4 5 4
  • 5. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Why Performance Schema? System Low throughput? ? 5 DBA Hot table? Network High traffic on link? Storage Too much Disk spin?App Developer Slow application? MySQL Developer Code contention? End User stuck session?
  • 6. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | MySQL 5.7 Performance Schema : Design Block Diagram MySQL Server Instrumentation points (P_S hooks) P_S Internal Buffers P_S Storage Engine Storage Engine Interface Statistics Report Fetch Data SQL Query Collect Data Store Data P_S Tables 6
  • 7. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda Need and Design Instruments and instrumentation Statistics tables Use cases What’s new in MySQL 5.7 1 2 3 4 5 7
  • 8. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Instruments 8 • Name of monitored activity. • Tree like structure. Separated by ‘/’. • Left to right : More generic to more specific. • 1000+ instruments in MySQL 5.7. • Stored in setup_instruments table. wait/io/file/myisam/log statement/sql/select
  • 9. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda Need and Design Instruments and instrumentation Statistics tables Use cases What’s new in MySQL 5.7 1 2 3 4 5 9
  • 10. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Statistics Tables in Performance Schema 10 SETUP TABLES Instruments Actors Objects Consumers TIMERS EVENTS TABLES Transactions Statements Stages Waits Idle REPLICATION SUMMARY SYSTEM VARIABLES STATUS VARIABLES LOCK TABLES Metadata locks Table Handles SUMMARY TABLES Events Memory File I/O, Table I/O, Table locks Socket Connection … CONNECTION Attribute Type INSTANCE TABLES Mutex RW_locks File Sockets Cond MISC By_global By_thread By_user/host By_account By_digest
  • 11. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda Need and Design Instruments and instrumentation Statistics tables Use cases What’s new in MySQL 5.7 1 2 3 4 5 11
  • 12. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | What does Performance Schema provide … update setup_instruments set ENABLED='YES', TIMED='YES'; 12 Connection 1 (Thread 24) start transaction; insert into test.t1 values('11'); commit; start transaction; insert into test.t1 values('12'); commit; start transaction; insert into test.t1 values('13'); commit; select * from test.t1; Connection 2 (Thread 25) start transaction; insert into test.t2 values('21'); commit; start transaction; insert into test.t2 values('22'); commit; Three inserts Two inserts Latest Statement
  • 13. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | What does Performance Schema provide … (cont.) Statements Statistics * Timer unit is PICOSECOND. EVENTS_STATEMENTS_CURRENT THREAD_ID 24 25 EVENT_NAME statement/sql /select statement/sql/ commit TIMER_WAIT 876585000 15998287000 SQL_TEXT select * from test.t1 commit ROWS_SENT 3 0 NO_INDEX_USED 0 0 SELECT_SCAN 1 0 13 EVENTS_STATEMENTS_SUMMARY_BY_THREAD_BY_EVENT _NAME THREAD_ID 24 25 EVENT_NAME statement/sql /insert statement/sql /insert COUNT_STAR 3 2 SUM_TIMER_WAIT 35181659000 3477432000 SUM_ROWS_AFFECTED 3 2 SUM_SELECT_SCAN 0 0 SUM_NO_INDEX_USED 0 0
  • 14. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | What does Performance Schema provide … (cont.) Statements Statistics (cont.) * Timer unit is PICOSECOND. 14 EVENTS_STATEMENTS_SUMMARY_GLOBAL_BY_EVENT_NAME EVENT_NAME statement/sql/insert statement/sql/commit COUNT_STAR 5 5 SUM_TIMER_WAIT 38659091000 65812216000 … … SUM_ROWS_AFFECTED 5 0 … … …
  • 15. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Use case 1 Description 15 • Multiple queries running for long on MySQL Server • Few long running query (taking lots of time) • No idea which one • No idea why • What to do ? …
  • 16. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Use case 1 Diagnosis 16 – THREAD_ID: 25 – EVENT_ID: 89 – EVENT_NAME: statement/sql/select – SQL_TEXT : select bla bla bla…; • Wait ! There’s more! – SELECT_SCAN : 1 – NO_INDEX_USED: 1 • Aha !! SELECT * FROM events_statements_history WHERE TIMER_WAIT > ‘X’;
  • 17. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Use case 2 Statements giving errors ( or warnings) 17 SELECT DIGEST_TEXT, SCHEMA_NAME, COUNT_STAR, SUM_ERRORS, SUM_WARNINGS FROM events_statements_summary_by_digest WHERE SUM_ERRORS > 0 ORDER BY SUM_ERRORS DESC limit 1G; EVENTS_STATEMENTS_SUMMARY_BY_DIGEST DIGEST_TEXT CREATE TEMPORARY TABLE IF NOT ... _logs` ( `id` INT8 NOT NULL )! SCHEMA_NAME mem COUNT_STAR 1725 SUM_ERRORS 1725 SUM_WARNINGS 0 FIRST_SEEN 2014-05-20 10:42:32 LAST_SEEN 2014-05-21 18:39:22
  • 18. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Use case 3 Description 18 • Multithreaded environment • My session is stuck • No idea why • What to do ? …
  • 19. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Use case 3 • What T1 is waiting for – Say T1 is waiting for mutex_A (column OBJECT_INSTANCE_BEGIN) • Lets see who has taken this mutex_A – Ok, so thread T2 is holding mutex_A (column LOCKED_BY_THREAD_ID) • Find out what thread t2 is waiting for • And so on… SELECT * FROM mutex_instances WHERE OBJECT_INSTANCE_BEGIN = mutex_A; SELECT * FROM events_waits_current WHERE THREAD_ID = T2; Diagnosis 19 SELECT * FROM events_waits_current WHERE THREAD_ID = T1;
  • 20. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Replication Summary Tables Tables for replication statistics 20 Replication status Connection Information Execute Information Connection Configuration Connection Status Execute Configuration Execute Status Coordinator/SQL Thread Worker Thread replication_connection _configuration replication_connection _status replication_execute_status _by_coordinator replication_execute_status _by_worker replication_execute _status replication_execute _configuration
  • 21. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Replication Summary Tables Tables for replication statistics Table Information replication_connection_configuration (Host, Port, User etc.) replication_connection_status (Server UUID, Receiver thread ID, Service State etc.) replication_execute_configuration (Desired Delay) replication_execute_status (Remaining Delay) replication_execute_status_by_coordinator (Thread Id, Service State, Last Error info.) replication_execute_status_by_worker (WID, WTID, Service State, Last error Info.) 21
  • 22. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Replication Summary Tables Tables for replication statistics 22 SHOW SLAVE STATUS (Limitations) – No logical division of information. – Lots of information packed together. – No cherry picking (difficult for automation). – Difficult to scale (more new fields). Why Performance Schema Tables? – Split logically into different tables. – SQL Interface. Fetch what is required. – Easier to extend.
  • 23. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Event Hierarchy 23 event_id nesting_event_id event_id nesting_event_id event_id nesting_event_id event_id nesting_event_id event_id nesting_event_id event_id nesting_event_id event_id nesting_event_id event_id nesting_event_id Transactions Statements Stages Waits
  • 24. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda Need and Design Instruments and instrumentation Statistics tables Use cases What’s new in MySQL 5.7 1 2 3 4 5 24
  • 25. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | What’s new in MySQL 5.7 2525 EnhancementsNew Instruments transactionsMemory usage Stored programs Prepared statements Metadata locks Connection type InnoDB Stages User variables Replication summary tables History per session Scalable memory allocation Configurable digest size … MySQL 5.7 Global/Session variables/status 87 Tables and 1000+ Instruments
  • 26. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | SYS Schema (earlier known as P_S Helper) What’s new in MySQL 5.7 Procedures Functions Views
  • 27. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Thank You

Editor's Notes

  • #3: This is a Safe Harbor Front slide, one of two Safe Harbor Statement slides included in this template. One of the Safe Harbor slides must be used if your presentation covers material affected by Oracle’s Revenue Recognition Policy To learn more about this policy, e-mail: Revrec-americasiebc_us@oracle.com For internal communication, Safe Harbor Statements are not required. However, there is an applicable disclaimer (Exhibit E) that should be used, found in the Oracle Revenue Recognition Policy for Future Product Communications. Copy and paste this link into a web browser, to find out more information.   http://my.oracle.com/site/fin/gfo/GlobalProcesses/cnt452504.pdf For all external communications such as press release, roadmaps, PowerPoint presentations, Safe Harbor Statements are required. You can refer to the link mentioned above to find out additional information/disclaimers required depending on your audience.