1. Mysql Performance Schema in Action
Presenter by
S Kannan
Database Engineer
Mydbops 12th Webinar
www.mydbops.com info@mydbops.com
2. ❏ Database Engineer
❏ Interest on Mysql and its related tech
❏ Active Learner
About Me
3. Mydbops at a Glance
● Founded in 2015, HQ in Bangalore India, 70+ Employees.
● Mydbops is on Database Consulting with core specialization on MySQL, MongoDB and PostgreSQL
Administration and Support.
● Mydbops was created with a motto of developing a DevOPS model for Database Administration.
● We help organisations to scale in MySQL/Mongodb/postgresql and implement the advanced technologies in
MySQL/Mongodb/PostgreSQL.
5. Agenda
● Introduction
● Performance Schema
● How performance schema Works ?
● Performance schema Terminology
● What is Instruments and how instruments get Data
● Instruments on various Mysql version
● Sys schema
● Demo
7. What is Performance schema ?
❏Performance Schema is a feature for monitoring MySQL Server execution at a low level .
❏It was introduced in MySQL 5.5 .
❏It provides a way to inspect internal execution of the server at runtime .
❏Performance Schema events are specific to a given instance of the MySQL Server
❏It gives an insight what is happening behind the screen .
❏It was implemented as a Storage engine.
10. Instruments:
❖Instruments are the code points where the measurements are done.
❖There are two types of instruments:
1) Timed instruments (Events)
2) Untimed instruments (count errors and memory usage)
❖Name of the monitored activity
❖Stored in performance_schema.setup_instruments table
❖More than 1200 instruments are in mysql 8
11. Config Server:
● Config servers store metadata and configuration settings for the cluster. As of MongoDB 3.4, config servers must
be deployed as a replica set (CSRS).
● If your cluster has a single config server, then the config server is a single point of failure.
● If the config server is inaccessible, the cluster is not accessible.
● If you cannot recover the data on a config server, the cluster will be inoperable.
● Always use three config servers for production deployments
How Instruments get data ?
12. S Consumers:
❖ It Process the data collected by the instruments and make it available on performance schema
❖ The consumers are defined in the setup_consumers table
❖ consumer name has a column to specify whether the consumer is enabled
13. S Events:
❖ An event is the result of a consumer recording the data collected by an instrument.
❖ It is used to observe the flow in mysql.
❖ Events are linked such that in general an event both has a parent and one or more child event.
15. S Threads:
❏ A thread is a fundamental concept in the Performance Schema.
❏ It handles a connections or Performing background operations.
❏ Mysql have several threads in parallel .
❏ Each thread has an Id (thread id).
❏ Stored in performance_schema.threads table
19. nstruments on various mysql version:
Mysql 5.6 Mysql 8
52 Tables 102 Ta
561 Instruments 10202 Instrume
589 ( percona server) 1229 (percona ser
31 Variables 44 variab
Mysql
87 Ta
1029 Instrume
1067 ( percona ser
42 Variables
20. High level Instruments on mysql 8
❏Memory
❏Idle
❏Stage
❏Transaction
❏Wait
❏Statement
❏error
21. S Sys schema:
❖ Sys schema reads and present the data.
❖ This is "user friendly" Performance Schema .
❖ The sys schema includes tables and triggers, views, and stored procedures and functions .
❖ The sys schema contains many views that summarize Performance Schema tables in various ways.
❖ Sys schema objects can be used for typical tuning and diagnosis use cases .