SlideShare a Scribd company logo
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 121
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
2
MySQL 5.7:
Performance Schema Improvements
Mark Leith
Senior Software Development Manager
MySQL @ Oracle
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3
Program Agenda
What is Performance Schema anyway?
Performance Schema in MySQL 5.5 & MySQL 5.6
Improvements made to date in MySQL 5.7
Things still to come
Questions (or ask along the way)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4
Know Your Audience
Using 5.1 (yes, still)?
Using 5.5 (but I’ll upgrade soon, honest)?
Using 5.6?
Using … 5.7?
Used Performance Schema?
#monitoringlove
#monitoringhate
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5
What is Performance Schema anyway?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6
What is Performance Schema anyway?
Introduced in MySQL 5.5
A storage engine, built for recording instrumentation
– PERFORMANCE_SCHEMA
– Manages fixed buffers in memory with lock free hashes
– Real engine, unlike INFORMATION_SCHEMA
A database schema to expose the instrumentation
– performance_schema
A set of interfaces in the MySQL Server wrapping calls to trace
– i.e. pthread_mutex_lock() -> mysql_mutex_lock()
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7
What is Performance Schema anyway?
Records latency of events that happen within the server
All latency exposed to picosecond precision
– Though tracked at different precisions internally
Also tracks other information as appropriate
– Bytes, source position, object metadata, etc.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8
Performance Schema in MySQL 5.5 & MySQL 5.6
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9
Performance Schema in MySQL 5.5
Laid out the framework for instrumentation
Focused early on low level instruments
– Prove it could handle load, build from ground up
Not turned on by default, had some overhead issues
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10
Performance Schema in MySQL 5.5
17 Tables
222 Instruments
Instrument Event Class
File IO wait/io/file/%
Mutexes wait/synch/mutex/%
Read/Write
Locks
wait/synch/rwlock/%
Conditions wait/synch/cond/%
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11
Performance Schema in MySQL 5.5
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12
Performance Schema in MySQL 5.6
Fixed lots of performance issues
Focused on bringing the instrumentation to the DBA / Developer
Statements / Statement Digests
Execution Stages
Object tracking (table / index IO, table locks)
Network IO
Turned on by default, with a subset of instrumentation disabled
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13
Performance Schema in MySQL 5.6
52 Tables (+35)
545 Instruments (+323)
Instrument
Type
Event Class
Statements statement/%
Stages stage/%
Table IO wait/io/table/%
Table Locks wait/lock/table/%
Network IO wait/io/socket/%
Idle Timing idle
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14
Performance Schema in MySQL 5.6
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1215
“I really think Performance Schema overhead is reasonable for most
workloads. …
On my old server I got some 20.2K QPS with Performance Schema
Disabled and 19.4 QPS with Performance Schema enabled which is
overhead of less than 5%.
For most workloads paying 5% to have insight about what is
happening with the system is a very fair trade.”
Peter Zaitsev, CEO, Percona
http://www.mysqlperformanceblog.com/2014/02/11/performance_schema-vs-slow-query-log/
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16
Improvements made to date in MySQL 5.7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
Insert Picture Here
17
Memory Usage
Metadata Locking
Replication Configuration & Status
Prepared Statements
Transactions
Stored Programs
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18
Improvements made to date in MySQL 5.7
75 Tables (+23)
784 Instruments (+239)
Instrument Type Event Class
Transactions transaction
Memory memory/%
Metadata Locks wait/lock/metadata/%
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.19
Improvements made to date in MySQL 5.7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.20
WL#3249
PERFORMANCE SCHEMA, Instrument memory usage
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1221
“Understanding where MySQL can allocate memory can help us to find
the cause in most cases. It is not as straightforward as it should be and
I‟m very hopeful future releases of MySQL, MariaDB or Drizzle bring
improvements in this space allowing us to see directly for what
purpose memory is allocated and so detect all kinds of memory usage
problems easier.”
Peter Zaitsev, CEO, Percona
http://www.mysqlperformanceblog.com/2012/03/21/troubleshooting-mysql-memory-usage/
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.22
Instrument memory usage
Added 212 different memory instrumentation types so far
Records current, high and low water marks of allocations
Does not track latency of memory allocation
5 new tables
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
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.23
Instrument memory usage - global summary
mysql> SELECT * FROM sys.memory_global_by_current_allocatedG
*************************** 1. row ***************************
event_name: memory/performance_schema/internal_buffers
current_count: 60
current_alloc: 497.00 MiB
current_avg_alloc: 8.28 MiB
high_count: 60
high_alloc: 497.00 MiB
high_avg_alloc: 8.28 MiB
*************************** 2. row ***************************
event_name: memory/mysys/KEY_CACHE
current_count: 3
current_alloc: 8.00 MiB
current_avg_alloc: 2.67 MiB
high_count: 3
high_alloc: 8.00 MiB
high_avg_alloc: 2.67 MiB
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.24
Instrument memory usage - thread summaries
mysql> select * from memory_by_thread_by_current_allocatedG
*************************** 1. row ***************************
user: sql/main
current_count: 2407
current_alloc: 10.89 MiB
current_avg_alloc: 4.63 KiB
current_max_alloc: 8.00 MiB
total_allocated: 30.55 MiB
thread_id: 1
*************************** 2. row ***************************
user: mem@localhost
current_count: 1914
current_alloc: 1.50 MiB
current_avg_alloc: 824 bytes
current_max_alloc: 816.67 KiB
total_allocated: 9.25 GiB
thread_id: 4336
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.25
Instrument memory usage - thread details
mysql> SELECT event_name,
-> sys.format_bytes(current_number_of_bytes_used) AS current_used
-> FROM performance_schema.memory_summary_by_thread_by_event_name
-> WHERE thread_id = 24
-> ORDER BY current_number_of_bytes_used DESC;
+-----------------------------------------------------+--------------+
| event_name | current_used |
+-----------------------------------------------------+--------------+
| memory/sql/Filesort_buffer::sort_keys | 255.94 KiB |
| memory/sql/sp_head::main_mem_root | 103.64 KiB |
| memory/mysys/IO_CACHE | 64.05 KiB |
| memory/mysys/lf_dynarray | 46.17 KiB |
| memory/mysys/array_buffer | 24.20 KiB |
| memory/sql/thd::main_mem_root | 23.95 KiB |
| memory/sql/String::value | 16.13 KiB |
| memory/sql/TABLE | 9.44 KiB |
| memory/sql/TABLE_SHARE::mem_root | 8.70 KiB |
| memory/myisam/MI_INFO | 7.07 KiB |
| memory/sql/THD::transactions::mem_root | 4.02 KiB |
| memory/myisam/MYISAM_SHARE | 3.29 KiB |
…
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.26
Instrument memory usage - other details
Disabled by default
Still requires InnoDB instrumentation
UPDATE setup_instruments
SET enabled = „YES‟
WHERE name LIKE „memory/%‟;
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.27
WL#5879
PERFORMANCE SCHEMA, MDL lock instrumentation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1228
“Unfortunately, it‟s unlikely that I‟ll be able to create a reproducible test
case, because there‟s no way to actually see what is happening. I
hope that a future version of MySQL will include a more
comprehensive set of tables for inspecting locks, requests, and waits
at all layers of the server.”
Baron Schwartz, CEO, VividCortex
http://www.xaprb.com/blog/2012/08/28/debugging-metadata-locking-in-mysql-5-5/
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.29
MDL Lock Instrumentation
Added the wait/lock/metadata/sql/mdl instrument
2 new tables
metadata_locks
table_handles
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.30
Metadata Locks Table Structure
+-----------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+---------------------+------+-----+---------+-------+
| OBJECT_TYPE | varchar(64) | NO | | NULL | |
| OBJECT_SCHEMA | varchar(64) | YES | | NULL | |
| OBJECT_NAME | varchar(64) | YES | | NULL | |
| OBJECT_INSTANCE_BEGIN | bigint(20) unsigned | NO | | NULL | |
| LOCK_TYPE | varchar(32) | NO | | NULL | |
| LOCK_DURATION | varchar(32) | NO | | NULL | |
| LOCK_STATUS | varchar(32) | NO | | NULL | |
| SOURCE | varchar(64) | YES | | NULL | |
| OWNER_THREAD_ID | bigint(20) unsigned | YES | | NULL | |
| OWNER_EVENT_ID | bigint(20) unsigned | YES | | NULL | |
+-----------------------+---------------------+------+-----+---------+-------+
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.31
MDL Lock Instrumentation
OBJECT_TYPE
GLOBAL, SCHEMA, TABLE, FUNCTION, PROCEDURE, TRIGGER, EVENT,
COMMIT
LOCK_TYPE
INTENTION_EXCLUSIVE, SHARED, SHARED_HIGH_PRIO,
SHARED_READ, SHARED_WRITE, SHARED_UPGRADABLE,
SHARED_NO_WRITE, SHARED_NO_READ_WRITE, EXCLUSIVE
LOCK_DURATION
STATEMENT, TRANSACTION, EXPLICIT
LOCK_STATUS
PENDING, GRANTED, VICTIM, TIMEOUT, KILLED
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.32
Metadata Locks Table Structure
mysql> select object_type as scope, object_schema, object_name, lock_type, lock_duration, lock_status
-> from metadata_locks
-> order by object_type = 'global' desc, object_type = 'schema' desc,
-> object_type = 'table' desc, object_type = 'commit' desc;
+--------+--------------------+----------------+---------------------+---------------+-------------+
| scope | object_schema | object_name | lock_type | lock_duration | lock_status |
+--------+--------------------+----------------+---------------------+---------------+-------------+
| GLOBAL | NULL | NULL | SHARED | EXPLICIT | GRANTED |
| GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING |
| GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING |
| GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING |
| GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING |
| GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING |
| GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING |
| GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING |
|
| TABLE | mem__events | action_logs | SHARED_READ | TRANSACTION | GRANTED |
| TABLE | mem__events | events | SHARED_READ | TRANSACTION | GRANTED |
| TABLE | performance_schema | metadata_locks | SHARED_READ | TRANSACTION | GRANTED |
| COMMIT | NULL | NULL | SHARED | EXPLICIT | GRANTED |
+--------+--------------------+----------------+---------------------+---------------+-------------+
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.33
WL#3656
PERFORMANCE SCHEMA table for
SHOW SLAVE STATUS
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.34
Replication Instrumentation
6 new tables
replication_connection_configuration
replication_connection_status
replication_execute_configuration
replication_execute_status
replication_execute_status_by_coordinator
replication_execute_status_by_worker
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.35
Replication Instrumentation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.36
Replication Connection Configuration
mysql> select * from performance_schema.replication_connection_configurationG
*************************** 1. row ***************************
HOST: 127.0.0.1
PORT: 3306
USER: rpl
NETWORK_INTERFACE:
AUTO_POSITION: 1
SSL_ALLOWED: YES
SSL_CA_FILE:
SSL_CA_PATH:
SSL_CERTIFICATE:
SSL_CIPHER:
SSL_KEY:
SSL_VERIFY_SERVER_CERTIFICATE: YES
SSL_CRL_FILE:
SSL_CRL_PATH:
CONNECTION_RETRY_INTERVAL: 40
CONNECTION_RETRY_COUNT: 10
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.37
Replication Connection Status
mysql> select * from replication_connection_statusG
*************************** 1. row ***************************
SOURCE_UUID:
THREAD_ID: NULL
SERVICE_STATE: CONNECTING
RECEIVED_TRANSACTION_SET:
LAST_ERROR_NUMBER: 1045
LAST_ERROR_MESSAGE: error connecting to master 'repl@localhost:5613' - retry-
time: 60 retries: 1
LAST_ERROR_TIMESTAMP: 2014-04-02 05:41:20
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.38
Replication Execute Status
mysql> select * from replication_execute_status;
+---------------+-----------------+
| SERVICE_STATE | REMAINING_DELAY |
+---------------+-----------------+
| ON | NULL |
+---------------+-----------------+
Very high level overview of status
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.39
Replication Coordinator Status
mysql> select * from replication_execute_status_by_coordinatorG
*************************** 1. row ***************************
THREAD_ID: 1281
SERVICE_STATE: ON
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
Status of Coordinator thread in multi-threaded replication
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.40
Replication Worker Status
mysql> select * from replication_execute_status_by_worker;
+-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+
| WORKER_ID | THREAD_ID | SERVICE_STATE | LAST_SEEN_TRANSACTION | LAST_ERROR_NUMBER | LAST_ERROR_MESSAGE | LAST_ERROR_TIMESTAMP |
+-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+
| 1 | 1282 | ON | | 0 | | 0000-00-00 00:00:00 |
| 2 | 1283 | ON | | 0 | | 0000-00-00 00:00:00 |
| 3 | 1284 | ON | | 0 | | 0000-00-00 00:00:00 |
| 4 | 1285 | ON | | 0 | | 0000-00-00 00:00:00 |
| 5 | 1286 | ON | | 0 | | 0000-00-00 00:00:00 |
| 6 | 1287 | ON | | 0 | | 0000-00-00 00:00:00 |
| 7 | 1288 | ON | | 0 | | 0000-00-00 00:00:00 |
| 8 | 1289 | ON | 181f2b36-a0b4-11e3-9ac7-1025863574a7:16 | 0 | | 0000-00-00 00:00:00 |
+-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+
Status of worker threads within multi-threaded replication
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.41
WL#5768
PERFORMANCE SCHEMA, prepared statements
instrumentation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.42
Prepared Statement Instrumentation
Instrumentation depends on already existing statement instruments
statement/com/prepare, statement/com/execute
statement/sql/prepare_sql, statement/sql/execute_sql
1 new table
prepared_statements_instances
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.43
Prepared Statement Instances
mysql> select * from performance_schema.prepared_statements_instancesG
*************************** 1. row ***************************
OBJECT_INSTANCE_BEGIN: 140198306602144
STATEMENT_ID: 1
STATEMENT_NAME: stmt1
SQL_TEXT: select * from test.t1
OWNER_THREAD_ID: 54003
OWNER_EVENT_ID: 935
OWNER_OBJECT_TYPE: NULL
OWNER_OBJECT_SCHEMA: NULL
OWNER_OBJECT_NAME: NULL
TIMER_PREPARE: 15386274000
COUNT_REPREPARE: 0
COUNT_EXECUTE: 1
SUM_TIMER_EXECUTE: 217699000
MIN_TIMER_EXECUTE: 217699000
AVG_TIMER_EXECUTE: 217699000
MAX_TIMER_EXECUTE: 217699000
SUM_LOCK_TIME: 0
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 0
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 0
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.44
WL#5864
PERFORMANCE SCHEMA, instrument
TRANSACTIONS
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.45
Replication Instrumentation
Added the transaction instrument
8 new tables
events_transactions_current
events_transactions_history
events_transactions_history_long
events_transactions_summary_by_account_by_event_name
events_transactions_summary_by_host_by_event_name
events_transactions_summary_by_thread_by_event_name
events_transactions_summary_by_user_by_event_name
events_transactions_summary_global_by_event_name
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.46
Transaction Instrumentation
Exposes details of transactions in raw or summary views
Show details such as
Transaction latency
Isolation levels
Auto commit
Savepoint info
GTID or transaction IDs
Link transactions to the statements within the transactions
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.47
Current Transaction Details
mysql> select * from events_transactions_currentG
*************************** 1. row ***************************
THREAD_ID: 1
EVENT_ID: 23733
END_EVENT_ID: 23742
EVENT_NAME: transaction
STATE: COMMITTED
TRX_ID: 281479898269256
GTID: NULL
XID: NULL
XA_STATE: NULL
SOURCE: handler.cc:1246
TIMER_START: 31140612726000
TIMER_END: 31140647445000
TIMER_WAIT: 34719000
ACCESS_MODE: READ WRITE
ISOLATION_LEVEL: REPEATABLE READ
AUTOCOMMIT: YES
NUMBER_OF_SAVEPOINTS: 0
NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0
NUMBER_OF_RELEASE_SAVEPOINT: 0
OBJECT_INSTANCE_BEGIN: NULL
NESTING_EVENT_ID: NULL
NESTING_EVENT_TYPE: NULL
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.48
Transaction Summary - per user
mysql> select * from events_transactions_summary_by_user_by_event_nameG
*************************** 1. row ***************************
USER: mem
EVENT_NAME: transaction
COUNT_STAR: 400044
SUM_TIMER_WAIT: 21208048458267000
MIN_TIMER_WAIT: 160744000
AVG_TIMER_WAIT: 53014289000
MAX_TIMER_WAIT: 24028520397000
COUNT_READ_WRITE: 400044
SUM_TIMER_READ_WRITE: 21208048458267000
MIN_TIMER_READ_WRITE: 160744000
AVG_TIMER_READ_WRITE: 53014289000
MAX_TIMER_READ_WRITE: 24028520397000
COUNT_READ_ONLY: 0
SUM_TIMER_READ_ONLY: 0
MIN_TIMER_READ_ONLY: 0
AVG_TIMER_READ_ONLY: 0
MAX_TIMER_READ_ONLY: 0
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.49
WL#5766
PERFORMANCE SCHEMA, stored programs
instrumentation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.50
Stored Program Instrumentation
Tracks Stored Procedures, Stored Functions, Triggers and Events
Added 16 new statement/sp/% instruments
Expose the different work flows that stored programs use, such as
cursor operations, workflow controls etc.
Integrated in to the normal statement instrumentation
1 new tables
events_statements_summary_by_program
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.51
Stored Program Summary
mysql> select * from events_statements_summary_by_programG
*************************** 1. row ***************************
OBJECT_TYPE: PROCEDURE
OBJECT_SCHEMA: ps_demo
OBJECT_NAME: ps_demo_proc
COUNT_STAR: 1
SUM_TIMER_WAIT: 6970931000
MIN_TIMER_WAIT: 6970931000
AVG_TIMER_WAIT: 6970931000
MAX_TIMER_WAIT: 6970931000
COUNT_STATEMENTS: 5
SUM_STATEMENTS_WAIT: 6802181000
MIN_STATEMENTS_WAIT: 16372000
AVG_STATEMENTS_WAIT: 1360436000
MAX_STATEMENTS_WAIT: 6484366000
SUM_LOCK_TIME: 176401000000
SUM_ERRORS: 0
SUM_WARNINGS: 0
SUM_ROWS_AFFECTED: 1
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 1
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_CREATED_TMP_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_FULL_RANGE_JOIN: 0
SUM_SELECT_RANGE: 0
SUM_SELECT_RANGE_CHECK: 0
SUM_SELECT_SCAN: 0
SUM_SORT_MERGE_PASSES: 0
SUM_SORT_RANGE: 0
SUM_SORT_ROWS: 0
SUM_SORT_SCAN: 0
SUM_NO_INDEX_USED: 0
SUM_NO_GOOD_INDEX_USED: 0
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.52
Stored Program Instrumentation
Like Transaction instrumentation, stored programs link to the
statements within them, or even link to transactions within them,
which in turn link to their statements
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.53
Full Hierarchy of New Instrumentation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1254
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1255
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1256
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1257
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1258
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1259
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.60
Things still to come
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.61
Status / Variable Instrumentation
Deprecate I_S.[GLOBAL|SESSION]_[STATUS|VARIABLES]
Replace with tables that show true state / aggregates
Per thread, user, host, account
See session statistics or configuration individually
Improve SHOW commands to only show appropriate variables
SHOW SESSION STATUS to only show session specific items
Backwards compatibility switch available
Less internal mutex contention for polling status
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.62
Further Replication Statistics
Redesigned lag monitoring
Consistently check lag across a replication chain
Further statistics on load of the replication threads
Queue lengths
Event counting
Busy times
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.63
Stage Progress Tracking
View the progress of longer stages of execution
Extends stage tables with “estimate” and “completed” columns
Bounded (“estimated”) or unbounded (only “completed” filled in)
Units depend on stage
stage/sql/copy to tmp table - 130 (rows) completed
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.64
Performance Schema Indexes
Add indexes for the PERFORMANCE_SCHEMA engine
Index key search fields across the schema
Will alleviate processing overhead for queries
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.65
Continued focus …
On performance!
On filling missing instrumentation points!
On consolidating instrumentation within Performance schema!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.66
The preceding 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.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
67
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
68

More Related Content

ODP
Performance schema and_ps_helper
ODP
Getting to Know MySQL Enterprise Monitor
PDF
Performance Schema and Sys Schema in MySQL 5.7
ODP
MySQL Administration and Monitoring
ODP
Introduction to MySQL Enterprise Monitor
PDF
Instrumenting plugins for Performance Schema
PDF
The MySQL SYS Schema
PDF
Performance schema and sys schema
Performance schema and_ps_helper
Getting to Know MySQL Enterprise Monitor
Performance Schema and Sys Schema in MySQL 5.7
MySQL Administration and Monitoring
Introduction to MySQL Enterprise Monitor
Instrumenting plugins for Performance Schema
The MySQL SYS Schema
Performance schema and sys schema

What's hot (20)

PDF
MySQL for Oracle DBAs
PDF
MySQL sys schema deep dive
PDF
MySQL's Performance Schema, SYS Schema and Workbench Integration
ODP
MySQL Monitoring Mechanisms
PDF
Mysql tech day_paris_ps_and_sys
ODP
MySQL Monitoring Mechanisms
PPT
Developing Information Schema Plugins
PDF
Extending MySQL Enterprise Monitor
PDF
Basic MySQL Troubleshooting for Oracle DBAs
PDF
Double the Performance of Oracle SOA Suite 11g? Absolutely!
PDF
What's next after Upgrade to 12c
PDF
Enterprise manager 13c
PDF
Oracle Enterprise Manager Cloud Control 13c for DBAs
PDF
MySQL Enterprise Backup - BnR Scenarios
PDF
Oracle Failover Database Cluster with Grid Infrastructure 12c
PPTX
OUGLS 2016: Guided Tour On The MySQL Source Code
PDF
MySQL Troubleshooting with the Performance Schema
PDF
Posscon my sql56
PDF
Oracle - Enterprise Manager 12c Overview
PPT
EM12c Monitoring, Metric Extensions and Performance Pages
MySQL for Oracle DBAs
MySQL sys schema deep dive
MySQL's Performance Schema, SYS Schema and Workbench Integration
MySQL Monitoring Mechanisms
Mysql tech day_paris_ps_and_sys
MySQL Monitoring Mechanisms
Developing Information Schema Plugins
Extending MySQL Enterprise Monitor
Basic MySQL Troubleshooting for Oracle DBAs
Double the Performance of Oracle SOA Suite 11g? Absolutely!
What's next after Upgrade to 12c
Enterprise manager 13c
Oracle Enterprise Manager Cloud Control 13c for DBAs
MySQL Enterprise Backup - BnR Scenarios
Oracle Failover Database Cluster with Grid Infrastructure 12c
OUGLS 2016: Guided Tour On The MySQL Source Code
MySQL Troubleshooting with the Performance Schema
Posscon my sql56
Oracle - Enterprise Manager 12c Overview
EM12c Monitoring, Metric Extensions and Performance Pages
Ad

Viewers also liked (9)

PDF
MySQL Performance Metrics that Matter
PDF
MySQL sys schema deep dive
PDF
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
PDF
U C2007 My S Q L Performance Cookbook
PDF
Mysql administration
PDF
Making MySQL Administration a Breeze - A Look Into a MySQL DBA's Toolchest
PDF
Managing MySQL with Ansible
KEY
MySQL Performance - SydPHP October 2011
PDF
The MySQL Performance Schema & New SYS Schema
MySQL Performance Metrics that Matter
MySQL sys schema deep dive
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
U C2007 My S Q L Performance Cookbook
Mysql administration
Making MySQL Administration a Breeze - A Look Into a MySQL DBA's Toolchest
Managing MySQL with Ansible
MySQL Performance - SydPHP October 2011
The MySQL Performance Schema & New SYS Schema
Ad

Similar to MySQL 5.7: Performance Schema Improvements (20)

PPTX
MySQL Performance Schema : fossasia
PDF
Performance Schema for MySQL Troubleshooting
PDF
New features in Performance Schema 5.7 in action
PPTX
Mysql Performance Schema - fossasia 2016
PDF
20150110 my sql-performanceschema
PDF
Performance Schema for MySQL Troubleshooting
PDF
MySQL Performance Schema in Action
PDF
MySQL Performance schema missing_manual_flossuk
PDF
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
PDF
MySQL Performance Schema in Action: the Complete Tutorial
PPTX
MySQL Performance Schema, Open Source India, 2015
PDF
How to analyze and tune sql queries for better performance
PDF
How to analyze and tune sql queries for better performance vts2016
PPTX
MySQL Performance Schema in MySQL 8.0
PDF
sveta smirnova - my sql performance schema in action
PDF
Performance Schema in Action: demo
PDF
Performance Schema for MySQL Troubleshooting
PDF
01 demystifying mysq-lfororacledbaanddeveloperv1
PPT
Empower my sql server administration with 5.7 instruments
PDF
MySQL Enterprise Monitor
MySQL Performance Schema : fossasia
Performance Schema for MySQL Troubleshooting
New features in Performance Schema 5.7 in action
Mysql Performance Schema - fossasia 2016
20150110 my sql-performanceschema
Performance Schema for MySQL Troubleshooting
MySQL Performance Schema in Action
MySQL Performance schema missing_manual_flossuk
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema, Open Source India, 2015
How to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performance vts2016
MySQL Performance Schema in MySQL 8.0
sveta smirnova - my sql performance schema in action
Performance Schema in Action: demo
Performance Schema for MySQL Troubleshooting
01 demystifying mysq-lfororacledbaanddeveloperv1
Empower my sql server administration with 5.7 instruments
MySQL Enterprise Monitor

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Encapsulation theory and applications.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
Chapter 3 Spatial Domain Image Processing.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
NewMind AI Monthly Chronicles - July 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Building Integrated photovoltaic BIPV_UPV.pdf
The AUB Centre for AI in Media Proposal.docx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation theory and applications.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto

MySQL 5.7: Performance Schema Improvements

  • 1. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 121
  • 2. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 2 MySQL 5.7: Performance Schema Improvements Mark Leith Senior Software Development Manager MySQL @ Oracle
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3 Program Agenda What is Performance Schema anyway? Performance Schema in MySQL 5.5 & MySQL 5.6 Improvements made to date in MySQL 5.7 Things still to come Questions (or ask along the way)
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4 Know Your Audience Using 5.1 (yes, still)? Using 5.5 (but I’ll upgrade soon, honest)? Using 5.6? Using … 5.7? Used Performance Schema? #monitoringlove #monitoringhate
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5 What is Performance Schema anyway?
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6 What is Performance Schema anyway? Introduced in MySQL 5.5 A storage engine, built for recording instrumentation – PERFORMANCE_SCHEMA – Manages fixed buffers in memory with lock free hashes – Real engine, unlike INFORMATION_SCHEMA A database schema to expose the instrumentation – performance_schema A set of interfaces in the MySQL Server wrapping calls to trace – i.e. pthread_mutex_lock() -> mysql_mutex_lock()
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7 What is Performance Schema anyway? Records latency of events that happen within the server All latency exposed to picosecond precision – Though tracked at different precisions internally Also tracks other information as appropriate – Bytes, source position, object metadata, etc.
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8 Performance Schema in MySQL 5.5 & MySQL 5.6
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9 Performance Schema in MySQL 5.5 Laid out the framework for instrumentation Focused early on low level instruments – Prove it could handle load, build from ground up Not turned on by default, had some overhead issues
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10 Performance Schema in MySQL 5.5 17 Tables 222 Instruments Instrument Event Class File IO wait/io/file/% Mutexes wait/synch/mutex/% Read/Write Locks wait/synch/rwlock/% Conditions wait/synch/cond/%
  • 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11 Performance Schema in MySQL 5.5
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12 Performance Schema in MySQL 5.6 Fixed lots of performance issues Focused on bringing the instrumentation to the DBA / Developer Statements / Statement Digests Execution Stages Object tracking (table / index IO, table locks) Network IO Turned on by default, with a subset of instrumentation disabled
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13 Performance Schema in MySQL 5.6 52 Tables (+35) 545 Instruments (+323) Instrument Type Event Class Statements statement/% Stages stage/% Table IO wait/io/table/% Table Locks wait/lock/table/% Network IO wait/io/socket/% Idle Timing idle
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14 Performance Schema in MySQL 5.6
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1215 “I really think Performance Schema overhead is reasonable for most workloads. … On my old server I got some 20.2K QPS with Performance Schema Disabled and 19.4 QPS with Performance Schema enabled which is overhead of less than 5%. For most workloads paying 5% to have insight about what is happening with the system is a very fair trade.” Peter Zaitsev, CEO, Percona http://www.mysqlperformanceblog.com/2014/02/11/performance_schema-vs-slow-query-log/
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16 Improvements made to date in MySQL 5.7
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 Insert Picture Here 17 Memory Usage Metadata Locking Replication Configuration & Status Prepared Statements Transactions Stored Programs
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18 Improvements made to date in MySQL 5.7 75 Tables (+23) 784 Instruments (+239) Instrument Type Event Class Transactions transaction Memory memory/% Metadata Locks wait/lock/metadata/%
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.19 Improvements made to date in MySQL 5.7
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.20 WL#3249 PERFORMANCE SCHEMA, Instrument memory usage
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1221 “Understanding where MySQL can allocate memory can help us to find the cause in most cases. It is not as straightforward as it should be and I‟m very hopeful future releases of MySQL, MariaDB or Drizzle bring improvements in this space allowing us to see directly for what purpose memory is allocated and so detect all kinds of memory usage problems easier.” Peter Zaitsev, CEO, Percona http://www.mysqlperformanceblog.com/2012/03/21/troubleshooting-mysql-memory-usage/
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.22 Instrument memory usage Added 212 different memory instrumentation types so far Records current, high and low water marks of allocations Does not track latency of memory allocation 5 new tables 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
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.23 Instrument memory usage - global summary mysql> SELECT * FROM sys.memory_global_by_current_allocatedG *************************** 1. row *************************** event_name: memory/performance_schema/internal_buffers current_count: 60 current_alloc: 497.00 MiB current_avg_alloc: 8.28 MiB high_count: 60 high_alloc: 497.00 MiB high_avg_alloc: 8.28 MiB *************************** 2. row *************************** event_name: memory/mysys/KEY_CACHE current_count: 3 current_alloc: 8.00 MiB current_avg_alloc: 2.67 MiB high_count: 3 high_alloc: 8.00 MiB high_avg_alloc: 2.67 MiB
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.24 Instrument memory usage - thread summaries mysql> select * from memory_by_thread_by_current_allocatedG *************************** 1. row *************************** user: sql/main current_count: 2407 current_alloc: 10.89 MiB current_avg_alloc: 4.63 KiB current_max_alloc: 8.00 MiB total_allocated: 30.55 MiB thread_id: 1 *************************** 2. row *************************** user: mem@localhost current_count: 1914 current_alloc: 1.50 MiB current_avg_alloc: 824 bytes current_max_alloc: 816.67 KiB total_allocated: 9.25 GiB thread_id: 4336
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.25 Instrument memory usage - thread details mysql> SELECT event_name, -> sys.format_bytes(current_number_of_bytes_used) AS current_used -> FROM performance_schema.memory_summary_by_thread_by_event_name -> WHERE thread_id = 24 -> ORDER BY current_number_of_bytes_used DESC; +-----------------------------------------------------+--------------+ | event_name | current_used | +-----------------------------------------------------+--------------+ | memory/sql/Filesort_buffer::sort_keys | 255.94 KiB | | memory/sql/sp_head::main_mem_root | 103.64 KiB | | memory/mysys/IO_CACHE | 64.05 KiB | | memory/mysys/lf_dynarray | 46.17 KiB | | memory/mysys/array_buffer | 24.20 KiB | | memory/sql/thd::main_mem_root | 23.95 KiB | | memory/sql/String::value | 16.13 KiB | | memory/sql/TABLE | 9.44 KiB | | memory/sql/TABLE_SHARE::mem_root | 8.70 KiB | | memory/myisam/MI_INFO | 7.07 KiB | | memory/sql/THD::transactions::mem_root | 4.02 KiB | | memory/myisam/MYISAM_SHARE | 3.29 KiB | …
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.26 Instrument memory usage - other details Disabled by default Still requires InnoDB instrumentation UPDATE setup_instruments SET enabled = „YES‟ WHERE name LIKE „memory/%‟;
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.27 WL#5879 PERFORMANCE SCHEMA, MDL lock instrumentation
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1228 “Unfortunately, it‟s unlikely that I‟ll be able to create a reproducible test case, because there‟s no way to actually see what is happening. I hope that a future version of MySQL will include a more comprehensive set of tables for inspecting locks, requests, and waits at all layers of the server.” Baron Schwartz, CEO, VividCortex http://www.xaprb.com/blog/2012/08/28/debugging-metadata-locking-in-mysql-5-5/
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.29 MDL Lock Instrumentation Added the wait/lock/metadata/sql/mdl instrument 2 new tables metadata_locks table_handles
  • 30. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.30 Metadata Locks Table Structure +-----------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+---------------------+------+-----+---------+-------+ | OBJECT_TYPE | varchar(64) | NO | | NULL | | | OBJECT_SCHEMA | varchar(64) | YES | | NULL | | | OBJECT_NAME | varchar(64) | YES | | NULL | | | OBJECT_INSTANCE_BEGIN | bigint(20) unsigned | NO | | NULL | | | LOCK_TYPE | varchar(32) | NO | | NULL | | | LOCK_DURATION | varchar(32) | NO | | NULL | | | LOCK_STATUS | varchar(32) | NO | | NULL | | | SOURCE | varchar(64) | YES | | NULL | | | OWNER_THREAD_ID | bigint(20) unsigned | YES | | NULL | | | OWNER_EVENT_ID | bigint(20) unsigned | YES | | NULL | | +-----------------------+---------------------+------+-----+---------+-------+
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.31 MDL Lock Instrumentation OBJECT_TYPE GLOBAL, SCHEMA, TABLE, FUNCTION, PROCEDURE, TRIGGER, EVENT, COMMIT LOCK_TYPE INTENTION_EXCLUSIVE, SHARED, SHARED_HIGH_PRIO, SHARED_READ, SHARED_WRITE, SHARED_UPGRADABLE, SHARED_NO_WRITE, SHARED_NO_READ_WRITE, EXCLUSIVE LOCK_DURATION STATEMENT, TRANSACTION, EXPLICIT LOCK_STATUS PENDING, GRANTED, VICTIM, TIMEOUT, KILLED
  • 32. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.32 Metadata Locks Table Structure mysql> select object_type as scope, object_schema, object_name, lock_type, lock_duration, lock_status -> from metadata_locks -> order by object_type = 'global' desc, object_type = 'schema' desc, -> object_type = 'table' desc, object_type = 'commit' desc; +--------+--------------------+----------------+---------------------+---------------+-------------+ | scope | object_schema | object_name | lock_type | lock_duration | lock_status | +--------+--------------------+----------------+---------------------+---------------+-------------+ | GLOBAL | NULL | NULL | SHARED | EXPLICIT | GRANTED | | GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING | | GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING | | GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING | | GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING | | GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING | | GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING | | GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING | | | TABLE | mem__events | action_logs | SHARED_READ | TRANSACTION | GRANTED | | TABLE | mem__events | events | SHARED_READ | TRANSACTION | GRANTED | | TABLE | performance_schema | metadata_locks | SHARED_READ | TRANSACTION | GRANTED | | COMMIT | NULL | NULL | SHARED | EXPLICIT | GRANTED | +--------+--------------------+----------------+---------------------+---------------+-------------+
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.33 WL#3656 PERFORMANCE SCHEMA table for SHOW SLAVE STATUS
  • 34. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.34 Replication Instrumentation 6 new tables replication_connection_configuration replication_connection_status replication_execute_configuration replication_execute_status replication_execute_status_by_coordinator replication_execute_status_by_worker
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.35 Replication Instrumentation
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.36 Replication Connection Configuration mysql> select * from performance_schema.replication_connection_configurationG *************************** 1. row *************************** HOST: 127.0.0.1 PORT: 3306 USER: rpl NETWORK_INTERFACE: AUTO_POSITION: 1 SSL_ALLOWED: YES SSL_CA_FILE: SSL_CA_PATH: SSL_CERTIFICATE: SSL_CIPHER: SSL_KEY: SSL_VERIFY_SERVER_CERTIFICATE: YES SSL_CRL_FILE: SSL_CRL_PATH: CONNECTION_RETRY_INTERVAL: 40 CONNECTION_RETRY_COUNT: 10
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.37 Replication Connection Status mysql> select * from replication_connection_statusG *************************** 1. row *************************** SOURCE_UUID: THREAD_ID: NULL SERVICE_STATE: CONNECTING RECEIVED_TRANSACTION_SET: LAST_ERROR_NUMBER: 1045 LAST_ERROR_MESSAGE: error connecting to master 'repl@localhost:5613' - retry- time: 60 retries: 1 LAST_ERROR_TIMESTAMP: 2014-04-02 05:41:20
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.38 Replication Execute Status mysql> select * from replication_execute_status; +---------------+-----------------+ | SERVICE_STATE | REMAINING_DELAY | +---------------+-----------------+ | ON | NULL | +---------------+-----------------+ Very high level overview of status
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.39 Replication Coordinator Status mysql> select * from replication_execute_status_by_coordinatorG *************************** 1. row *************************** THREAD_ID: 1281 SERVICE_STATE: ON LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00 Status of Coordinator thread in multi-threaded replication
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.40 Replication Worker Status mysql> select * from replication_execute_status_by_worker; +-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+ | WORKER_ID | THREAD_ID | SERVICE_STATE | LAST_SEEN_TRANSACTION | LAST_ERROR_NUMBER | LAST_ERROR_MESSAGE | LAST_ERROR_TIMESTAMP | +-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+ | 1 | 1282 | ON | | 0 | | 0000-00-00 00:00:00 | | 2 | 1283 | ON | | 0 | | 0000-00-00 00:00:00 | | 3 | 1284 | ON | | 0 | | 0000-00-00 00:00:00 | | 4 | 1285 | ON | | 0 | | 0000-00-00 00:00:00 | | 5 | 1286 | ON | | 0 | | 0000-00-00 00:00:00 | | 6 | 1287 | ON | | 0 | | 0000-00-00 00:00:00 | | 7 | 1288 | ON | | 0 | | 0000-00-00 00:00:00 | | 8 | 1289 | ON | 181f2b36-a0b4-11e3-9ac7-1025863574a7:16 | 0 | | 0000-00-00 00:00:00 | +-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+ Status of worker threads within multi-threaded replication
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.41 WL#5768 PERFORMANCE SCHEMA, prepared statements instrumentation
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.42 Prepared Statement Instrumentation Instrumentation depends on already existing statement instruments statement/com/prepare, statement/com/execute statement/sql/prepare_sql, statement/sql/execute_sql 1 new table prepared_statements_instances
  • 43. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.43 Prepared Statement Instances mysql> select * from performance_schema.prepared_statements_instancesG *************************** 1. row *************************** OBJECT_INSTANCE_BEGIN: 140198306602144 STATEMENT_ID: 1 STATEMENT_NAME: stmt1 SQL_TEXT: select * from test.t1 OWNER_THREAD_ID: 54003 OWNER_EVENT_ID: 935 OWNER_OBJECT_TYPE: NULL OWNER_OBJECT_SCHEMA: NULL OWNER_OBJECT_NAME: NULL TIMER_PREPARE: 15386274000 COUNT_REPREPARE: 0 COUNT_EXECUTE: 1 SUM_TIMER_EXECUTE: 217699000 MIN_TIMER_EXECUTE: 217699000 AVG_TIMER_EXECUTE: 217699000 MAX_TIMER_EXECUTE: 217699000 SUM_LOCK_TIME: 0 SUM_ERRORS: 0 SUM_WARNINGS: 0 SUM_ROWS_AFFECTED: 0 SUM_ROWS_SENT: 0 SUM_ROWS_EXAMINED: 0 SUM_CREATED_TMP_DISK_TABLES: 0 SUM_CREATED_TMP_TABLES: 0 SUM_SELECT_FULL_JOIN: 0 SUM_SELECT_FULL_RANGE_JOIN: 0 SUM_SELECT_RANGE: 0 SUM_SELECT_RANGE_CHECK: 0 SUM_SELECT_SCAN: 0 SUM_SORT_MERGE_PASSES: 0 SUM_SORT_RANGE: 0 SUM_SORT_ROWS: 0 SUM_SORT_SCAN: 0 SUM_NO_INDEX_USED: 0 SUM_NO_GOOD_INDEX_USED: 0
  • 44. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.44 WL#5864 PERFORMANCE SCHEMA, instrument TRANSACTIONS
  • 45. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.45 Replication Instrumentation Added the transaction instrument 8 new tables events_transactions_current events_transactions_history events_transactions_history_long events_transactions_summary_by_account_by_event_name events_transactions_summary_by_host_by_event_name events_transactions_summary_by_thread_by_event_name events_transactions_summary_by_user_by_event_name events_transactions_summary_global_by_event_name
  • 46. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.46 Transaction Instrumentation Exposes details of transactions in raw or summary views Show details such as Transaction latency Isolation levels Auto commit Savepoint info GTID or transaction IDs Link transactions to the statements within the transactions
  • 47. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.47 Current Transaction Details mysql> select * from events_transactions_currentG *************************** 1. row *************************** THREAD_ID: 1 EVENT_ID: 23733 END_EVENT_ID: 23742 EVENT_NAME: transaction STATE: COMMITTED TRX_ID: 281479898269256 GTID: NULL XID: NULL XA_STATE: NULL SOURCE: handler.cc:1246 TIMER_START: 31140612726000 TIMER_END: 31140647445000 TIMER_WAIT: 34719000 ACCESS_MODE: READ WRITE ISOLATION_LEVEL: REPEATABLE READ AUTOCOMMIT: YES NUMBER_OF_SAVEPOINTS: 0 NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0 NUMBER_OF_RELEASE_SAVEPOINT: 0 OBJECT_INSTANCE_BEGIN: NULL NESTING_EVENT_ID: NULL NESTING_EVENT_TYPE: NULL
  • 48. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.48 Transaction Summary - per user mysql> select * from events_transactions_summary_by_user_by_event_nameG *************************** 1. row *************************** USER: mem EVENT_NAME: transaction COUNT_STAR: 400044 SUM_TIMER_WAIT: 21208048458267000 MIN_TIMER_WAIT: 160744000 AVG_TIMER_WAIT: 53014289000 MAX_TIMER_WAIT: 24028520397000 COUNT_READ_WRITE: 400044 SUM_TIMER_READ_WRITE: 21208048458267000 MIN_TIMER_READ_WRITE: 160744000 AVG_TIMER_READ_WRITE: 53014289000 MAX_TIMER_READ_WRITE: 24028520397000 COUNT_READ_ONLY: 0 SUM_TIMER_READ_ONLY: 0 MIN_TIMER_READ_ONLY: 0 AVG_TIMER_READ_ONLY: 0 MAX_TIMER_READ_ONLY: 0
  • 49. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.49 WL#5766 PERFORMANCE SCHEMA, stored programs instrumentation
  • 50. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.50 Stored Program Instrumentation Tracks Stored Procedures, Stored Functions, Triggers and Events Added 16 new statement/sp/% instruments Expose the different work flows that stored programs use, such as cursor operations, workflow controls etc. Integrated in to the normal statement instrumentation 1 new tables events_statements_summary_by_program
  • 51. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.51 Stored Program Summary mysql> select * from events_statements_summary_by_programG *************************** 1. row *************************** OBJECT_TYPE: PROCEDURE OBJECT_SCHEMA: ps_demo OBJECT_NAME: ps_demo_proc COUNT_STAR: 1 SUM_TIMER_WAIT: 6970931000 MIN_TIMER_WAIT: 6970931000 AVG_TIMER_WAIT: 6970931000 MAX_TIMER_WAIT: 6970931000 COUNT_STATEMENTS: 5 SUM_STATEMENTS_WAIT: 6802181000 MIN_STATEMENTS_WAIT: 16372000 AVG_STATEMENTS_WAIT: 1360436000 MAX_STATEMENTS_WAIT: 6484366000 SUM_LOCK_TIME: 176401000000 SUM_ERRORS: 0 SUM_WARNINGS: 0 SUM_ROWS_AFFECTED: 1 SUM_ROWS_SENT: 0 SUM_ROWS_EXAMINED: 1 SUM_CREATED_TMP_DISK_TABLES: 0 SUM_CREATED_TMP_TABLES: 0 SUM_SELECT_FULL_JOIN: 0 SUM_SELECT_FULL_RANGE_JOIN: 0 SUM_SELECT_RANGE: 0 SUM_SELECT_RANGE_CHECK: 0 SUM_SELECT_SCAN: 0 SUM_SORT_MERGE_PASSES: 0 SUM_SORT_RANGE: 0 SUM_SORT_ROWS: 0 SUM_SORT_SCAN: 0 SUM_NO_INDEX_USED: 0 SUM_NO_GOOD_INDEX_USED: 0
  • 52. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.52 Stored Program Instrumentation Like Transaction instrumentation, stored programs link to the statements within them, or even link to transactions within them, which in turn link to their statements
  • 53. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.53 Full Hierarchy of New Instrumentation
  • 54. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1254
  • 55. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1255
  • 56. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1256
  • 57. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1257
  • 58. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1258
  • 59. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1259
  • 60. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.60 Things still to come
  • 61. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.61 Status / Variable Instrumentation Deprecate I_S.[GLOBAL|SESSION]_[STATUS|VARIABLES] Replace with tables that show true state / aggregates Per thread, user, host, account See session statistics or configuration individually Improve SHOW commands to only show appropriate variables SHOW SESSION STATUS to only show session specific items Backwards compatibility switch available Less internal mutex contention for polling status
  • 62. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.62 Further Replication Statistics Redesigned lag monitoring Consistently check lag across a replication chain Further statistics on load of the replication threads Queue lengths Event counting Busy times
  • 63. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.63 Stage Progress Tracking View the progress of longer stages of execution Extends stage tables with “estimate” and “completed” columns Bounded (“estimated”) or unbounded (only “completed” filled in) Units depend on stage stage/sql/copy to tmp table - 130 (rows) completed
  • 64. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.64 Performance Schema Indexes Add indexes for the PERFORMANCE_SCHEMA engine Index key search fields across the schema Will alleviate processing overhead for queries
  • 65. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.65 Continued focus … On performance! On filling missing instrumentation points! On consolidating instrumentation within Performance schema!
  • 66. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.66 The preceding 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.
  • 67. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 67
  • 68. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 68