SlideShare a Scribd company logo
1 of 32
Download to read offline
www.fromdual.com
1 / 32
PERFORMANCE_SCHEMA
and sys schema
What can we do with it?
FOSDEM 2016, January 30th
, Brussels
Oli Sennhauser
Senior MySQL Consultant at FromDual GmbH
oli.sennhauser@fromdual.com
www.fromdual.com
2 / 32
About FromDual GmbH
Support
remote-DBA
Training
Consulting
www.fromdual.com
3 / 32
Contents
PERFORMANCE_SCHEMA and sys schema
➢
Database Profiling
➢
PERFORMANCE_SCHEMA (P_S)
➢
Installation, configuration, instrumentation, etc.
➢
sys schema
➢
Installation, configuration, etc.
➢
Use cases
www.fromdual.com
4 / 32
Database Profiling
● Where has my time gone?
● Where have my resources gone?
function x() {
  start = current_time();
  count[x]++;
  …
  end = current_time();
  duration[x] += (end ­ start);
}
function   count   time
x            123     156.25     0.8%
y             19     827.30     4.1%
z              2   19280.00    95.1%
Total        144   20263.55   100.0%
time
a
b
c
d
e
f
g h j
i
www.fromdual.com
5 / 32
MySQL Profiler
● Since MySQL 5.0
● SET profiling = 1;
SELECT …;
SHOW PROFILE;
● Deprecated in 5.6
● So what now?
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
| Status               | Duration |
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
| starting             | 0.000059 |
| checking permissions | 0.000008 |
| Opening tables       | 0.000017 |
| init                 | 0.000023 |
| System lock          | 0.000009 |
| optimizing           | 0.000006 |
| statistics           | 0.000014 |
| preparing            | 0.000011 |
| Creating tmp table   | 0.000023 |
| Sorting result       | 0.000005 |
| executing            | 0.000003 |
| Sending data         | 1.253803 |
| Creating sort index  | 0.000049 |
| end                  | 0.000005 |
| removing tmp table   | 0.000019 |
| end                  | 0.000006 |
| query end            | 0.000009 |
| closing tables       | 0.000012 |
| freeing items        | 0.000019 |
| logging slow query   | 0.000004 |
| cleaning up          | 0.000011 |
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
www.fromdual.com
6 / 32
PERFORMANCE_SCHEMA (P_S)
● Discussed at least since 2006
● Introduced in MySQL 5.5 (2010)
● Disabled by default
● Not really useful yet
● Improved in MySQL 5.6 (2011/12)
● Enabled by default
● Became useful and interesting
● More improvements in MySQL 5.7 (2013-15)
● More probes, more information:
● Memory, Transactions, Replication, Session/Status variables
● Overhead 2% - 200%
● Depends on how you do it → careful!
www.fromdual.com
7 / 32
Goal of P_S
● Monitoring MySQL server execution at a low level
● Inspect internal execution of the server at runtime
● How: Server is instrumented to collect timing information
● Output: SQL queries on normal MySQL ring-buffer tables
● Events is anything the server does:
● Function call
● Wait for the O/S
● SQL statement, stages
● Memory
www.fromdual.com
8 / 32
P_S installation & configuration
● Installed by default
● mysql_upgrade → do restart afterwards
● Configuration in my.cnf
● 5.5 off
● performance_schema = 1
● 5.6 and later on
● Tuning (my.cnf)
● performance_schema_events_waits_long = 10000
● SHOW GLOBAL VARIABLES LIKE 'PERF%'; 
● SHOW GLOBAL STATUS LIKE 'PERF%';
www.fromdual.com
9 / 32
Online enabling / disabling
● setup_* tables
● Actors
● Which user and host is profiled (default %)
● Consumers
● Which P_S tables are filled with data (e.g. events_state_current, some are off!)
● Instruments
● Which probes are activated (expensive ones are disabled)
● Objects
● Database objects (table, trigger, procedure, function, event) to profile (on for user obj.)
● Timers
● Default is in nanoseconds (10-9 s)
UPDATE setup_instruments
   SET ENABLED = 'YES', TIMED = 'YES'
 WHERE name = 'wait/synch/mutex/innodb/autoinc_mutex';
www.fromdual.com
10 / 32
Instrumentation depth
● Enable probes:
●
events_transactions_* → unknown
● events_statements_* → moderate expensive
● events_stages_* → expensive!
● events_waits_* → very expensive!
● end
●
events_memory_* → very expensive?
● end
● end
● end
●
End
● Can have a performance impact!
www.fromdual.com
11 / 32
Consumer types and hierarchies
● events_*_current → one per thread
● events_*_history → most recent n events per thread (default 10)
● events_*_history_long → most recent n events (10000)
● events_*_summary_global_by_event_name
● events_*_summary_by_account_by_event_name → (host + user)
● events_*_summary_by_host_by_event_name → e.g. 127.0.0.1
● events_*_summary_by_user_by_event_name → e.g. root
● events_*_summary_by_thread_by_event_name → thread (connection)
● events_*_summary_by_digest → normalized query: WHERE a = ?
● events_*_summary_by_program → procedure, function, trigger, event
● events_*_summary_by_instance → file, mutex, prep stmt, rwlock, socket,
condition
● Can be truncate with TRUCATE TABLE ...
www.fromdual.com
12 / 32
sys schema
● Originally “ps_helper” in 5.6 (2012)
● By Mark Leith
● Senior SW Dev Mgr at Oracle
● Make it easier to use the P_S!
● A database schema (sys)
● Consisting of tables, views, functions, procedures and
triggers.
● To give human readable insight into a MySQL database.
● Based on PERFORMANCE_SCHEMA and INFORMATION_SCHEMA
● Current release v1.5 (2016-01)
●
Download: https://github.com/mysql/mysql-sys
www.fromdual.com
13 / 32
sys schema installation
● Since MySQL 5.7.7 installed by default!
● Can be skipped
● In MySQL 5.6:
● mysql_upgrade installs/upgrades sys
● Can be skipped
wget https://github.com/mysql/mysql­sys/archive/master.tar.gz
tar xf master.tar.gz
cd mysql­sys­master
Mysql –user=root ­­password < ./sys_56.sql
www.fromdual.com
14 / 32
sys view/table types
● 2 types, e.g.:
● io_by_thread_by_latency → human understandable numbers
● x$io_by_thread_by_latency → base tables in picoseconds (10-12s)
● Topics:
● host_* → Activities grouped by host
● innodb_* → InnoDB Information
● io_* → I/O consumers grouped by file, bytes, latency
● memory_* → Memory usage grouped by host, thread, user, type
● schema_* → Various information about schema
● statement_* → Statistics about statements
● user_* → Information per user
● waits_* → Wait event informations
www.fromdual.com
15 / 32
Configure P_S with sys
● Reset defaults:
● CALL sys.ps_setup_reset_to_default(TRUE);
● Change setup tables:
● CALL sys.ps_setup_enable_instrument('wait');
● CALL sys.ps_setup_enable_instrument('stage');
● CALL sys.ps_setup_enable_instrument('statement');
● CALL sys.ps_setup_enable_consumer('current');
● CALL sys.ps_setup_enable_consumer('history_long');
www.fromdual.com
16 / 32
Use cases
● The following use cases can be found at:
● http://fromdual.com/mysql-performance-schema-hints
www.fromdual.com
17 / 32
SSL encryption used or not
SELECT variable_value AS tls_version, processlist_user AS user
     , processlist_host AS host
  FROM performance_schema.status_by_thread AS sbt
  JOIN performance_schema.threads AS t
    ON t.thread_id = sbt.thread_id
 WHERE variable_name = 'Ssl_version'
 ORDER BY tls_version
;
+­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­+
| tls_version | user | host      |
+­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­+
|             | root | localhost |
| TLSv1.1     | root | localhost |
+­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­+
www.fromdual.com
18 / 32
Accounts not properly closing
connections
SELECT ess.user, ess.host
     , (a.total_connections ­ a.current_connections) ­ ess.count_star as not_closed
     , ((a.total_connections ­ a.current_connections) ­ ess.count_star) * 100 /
       (a.total_connections ­ a.current_connections) as pct_not_closed
  FROM performance_schema.events_statements_summary_by_account_by_event_name ess
  JOIN performance_schema.accounts a on (ess.user = a.user and ess.host = a.host)
 WHERE ess.event_name = 'statement/com/quit'
   AND (a.total_connections ­ a.current_connections) > ess.count_star
;
+­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+
| user | host      | not_closed | pct_not_closed |
+­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+
| root | localhost |          1 |         5.0000 |
+­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+
www.fromdual.com
19 / 32
Accounts which never connected
since last start-up
SELECT DISTINCT m_u.user, m_u.host
  FROM mysql.user m_u
  LEFT JOIN performance_schema.accounts ps_a
    ON m_u.user = ps_a.user AND m_u.host = ps_a.host
 WHERE ps_a.user IS NULL
ORDER BY m_u.user
;
+­­­­­­­­­­­+­­­­­­­­­­­+
| user      | host      |
+­­­­­­­­­­­+­­­­­­­­­­­+
| focmm     | master    |
| mysql.sys | localhost |
| oli       | localhost |
| root      | %         |
+­­­­­­­­­­­+­­­­­­­­­­­+
www.fromdual.com
20 / 32
Bad SQL queries by user
SELECT user, host, event_name
     , sum_created_tmp_disk_tables AS tmp_disk_tables
     , sum_select_full_join AS full_join
  FROM performance_schema.events_statements_summary_by_account_by_event_name
 WHERE sum_created_tmp_disk_tables > 0
    OR sum_select_full_join > 0
 ORDER BY sum_sort_merge_passes DESC
 LIMIT 10
;
+­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
| user | host      | event_name                  | tmp_disk_tables | full_join |
+­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
| root | localhost | statement/sql/select        |             134 |       204 |
| root | localhost | statement/sql/show_fields   |            3607 |         0 |
| root | localhost | statement/sql/show_triggers |            1792 |         0 |
| root | localhost | statement/com/Field List    |              28 |         0 |
+­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
www.fromdual.com
21 / 32
Top long running queries
UPDATE performance_schema.setup_consumers SET enabled = 1
 WHERE name = 'events_statements_history_long';
SELECT left(digest_text, 64)
     , ROUND(SUM(timer_end­timer_start)/1000000000, 1) AS tot_exec_ms
     , ROUND(SUM(timer_wait)/1000000000, 1) AS tot_wait_ms
     , ROUND(SUM(lock_time)/1000000000, 1) AS tot_lock_ms
     , MIN(LEFT(DATE_SUB(NOW(), INTERVAL (isgs.VARIABLE_VALUE ­ TIMER_START*10e­13) second), 19)) AS first_seen
     , MAX(LEFT(DATE_SUB(NOW(), INTERVAL (isgs.VARIABLE_VALUE ­ TIMER_START*10e­13) second), 19)) AS last_seen
     , COUNT(*) as cnt
  FROM performance_schema.events_statements_history_long
  JOIN performance_schema.global_status AS isgs
 WHERE isgs.variable_name = 'UPTIME'
 GROUP BY LEFT(digest_text,64)
 ORDER BY tot_exec_ms DESC
;
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­+
| left(digest_text, 64)                                            | tot_exec_ms | tot_wait_ms | tot_lock_ms | cnt |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­+
| INSERT INTO `history` ( `itemid` , `clock` , `ns` , VALUE ) VALU |        12.3 |        12.3 |         2.4 |   6 |
| SELECT `i` . `itemid` , `i` . `state` , `i` . `delta` , `i` . `m |        10.4 |        10.4 |         1.9 |   6 |
| SELECT LEFT ( `digest_text` , ? ) , `ROUND` ( SUM ( `timer_end`  |         7.5 |         7.5 |         0.0 |   1 |
| SELECT `i` . `itemid` , `i` . `key_` , `h` . `host` , `i` . `typ |         3.2 |         3.2 |         1.1 |   6 |
| SELECT `h` . `hostid` , `h` . `host` , `h` . `name` , `t` . `htt |         2.0 |         2.0 |         0.9 |   4 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­+
www.fromdual.com
22 / 32
Unused indexes
SELECT object_schema, object_name, index_name
  FROM performance_schema.table_io_waits_summary_by_index_usage
 WHERE index_name IS NOT NULL
   AND count_star = 0
   AND index_name != 'PRIMARY'
 ORDER BY object_schema, object_name
;
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­+
| object_schema | object_name | index_name |
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­+
| a             | audit       | data_2     |
| a             | audit       | data       |
| a             | c1          | c2_id      |
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­+
SELECT *
  FROM sys.schema_unused_indexes
;
www.fromdual.com
23 / 32
Redundant indexes
SELECT table_schema, table_name
     , redundant_index_columns, dominant_index_columns
  FROM sys.schema_redundant_indexes
;
+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­+
| table_schema | table_name        | redundant_index_columns | dominant_index_columns |
+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­+
| crm          | accounts          | id,deleted              | id                     |
| crm          | accounts_bugs     | account_id              | account_id,bug_id      |
| crm          | acl_actions       | id,deleted              | id                     |
| crm          | acl_roles         | id,deleted              | id                     |
| crm          | acl_roles_actions | role_id                 | role_id,action_id      |
+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­+
www.fromdual.com
24 / 32
Statements with errors or
warnings
SELECT db, query, exec_count, errors, warnings
  FROM sys.statements_with_errors_or_warnings
;
+­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­+­­­­­­­­­­+
| db                 | query                      | exec_count | errors | warnings |
+­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­+­­­­­­­­­­+
| mysql              | UPDATE `setup_consumers... |          1 |      1 |        0 |
| mysql              | SELECT LEFT ( `digest_t... |          2 |      1 |        0 |
| sys                | SELECT * FROM `setup_co... |          1 |      1 |        0 |
| performance_schema | SELECT * FROM `user_sum... |          1 |      1 |        0 |
| test               | SELECT * FROM `test` LI... |          6 |      1 |        0 |
+­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­+­­­­­­­­­­+
www.fromdual.com
25 / 32
Tables with full table scan
SELECT *
  FROM sys.schema_tables_with_full_table_scans
;
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
| object_schema | object_name | rows_full_scanned | latency   |
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
| zabbix        | triggers    |              1436 | 5.05 ms   |
| zabbix        | hosts       |                34 | 41.81 us  |
| zabbix        | interface   |                 6 | 4.33 ms   |
| zabbix        | expressions |                 4 | 648.98 us |
| zabbix        | config      |                 1 | 3.62 ms   |
| zabbix        | globalmacro |                 1 | 2.61 ms   |
| zabbix        | media       |                 1 | 548.01 us |
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
www.fromdual.com
26 / 32
I/O by user
SELECT *
  FROM sys.user_summary_by_file_io
;
+­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­­+
| user       | ios  | io_latency |
+­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­­+
| background | 6926 | 8.52 s     | :­(
| zabbix     |  738 | 127.52 ms  |
| root       |  101 | 6.57 ms    |
| fpmmm      |  363 | 644.00 us  |
+­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­­+
www.fromdual.com
27 / 32
Latency on file I/O
SELECT event_name, total, total_latency
     , read_latency, write_latency, misc_latency
  FROM sys.io_global_by_wait_by_latency
 LIMIT 5
;
+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­+
| event_name              | total | tot_latency | r_latency | w_latency | misc_latency |
+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­+
| innodb/innodb_log_file  |  1323 | 8.84 s      | 29.08 us  | 25.08 ms  | 8.81 s       | :(
| innodb/innodb_data_file |  6299 | 8.81 s      | 429.56 ms | 660.95 ms | 7.72 s       | :(
| sql/binlog_index        |    40 | 35.20 ms    | 4.07 us   | 0 ps      | 35.19 ms     |
| sql/binlog              |   610 | 26.09 ms    | 14.46 us  | 4.12 ms   | 21.96 ms     |
| sql/relaylog            |    13 | 18.77 ms    | 1.97 us   | 5.56 us   | 18.77 ms     |
+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­+
www.fromdual.com
28 / 32
Memory by user
UPDATE performance_schema.setup_instruments
   SET enabled = 'YES'
 WHERE name LIKE 'memory%'
;
SELECT user, current_allocated, current_avg_alloc
     , current_max_alloc, total_allocated
  FROM sys.memory_by_user_by_current_bytes
;
+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
| user       | curr_alloc | curr_avg_alloc | curr_max_alloc | tot_alloc |
+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
| root       | 348.35 KiB | 9.95 KiB       | 248.04 KiB     | 8.54 MiB  |
| zabbix     | 44.72 KiB  | 2.48 KiB       | 32.02 KiB      | 11.87 MiB |
| fpmmm      | 43.56 KiB  | 4.36 KiB       | 43.56 KiB      | 1.37 MiB  |
| background | 9.85 KiB   | 1.97 KiB       | 9.64 KiB       | 1.42 MiB  |
+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
www.fromdual.com
29 / 32
SELECT, INSERT, UPDATE and
DELETE per table
SELECT object_type, object_schema, object_name
     , count_star, count_read, count_write
     , count_insert
  FROM performance_schema.table_io_waits_summary_by_table
 WHERE count_star > 0
 ORDER BY count_write DESC
 LIMIT 5
;
+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­+
| object_type | object_schema | object_name  | count_star | count_read | count_write | count_insert |
+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­+
| TABLE       | zabbix        | history_uint |      12791 |         92 |       12699 |        12699 |
| TABLE       | zabbix        | history      |       3374 |         10 |        3364 |         3364 |
| TABLE       | zabbix        | history_str  |       2003 |         48 |        1955 |         1955 |
| TABLE       | zabbix        | trends_uint  |        930 |          0 |         930 |          930 |
| TABLE       | zabbix        | trends       |        200 |          0 |         200 |          200 |
+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­+
www.fromdual.com
30 / 32
How to proceed?
1. Define the question to answer:
   “Which transaction was locked by which other transaction?”
2. Can sys schema anwser the question?
   SELECT * FROM sys.innodb_lock_waits;
    +­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­+
    | wait_started      | wait_age | locked_table  | locked_index | locked_type |
    +­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­+
    | 16­01­29 17:53:09 | 00:00:02 | `test`.`test` | PRIMARY      | RECORD      |
    +­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­+
3. If not: Can P_S or I_S answer the question?
   SELECT * FROM information_schema.innodb_locks;
    +­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­+
    | lock_trx_id | lock_type | lock_table    | lock_index | lock_rec |
    +­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­+
    | 27514604    | RECORD    | `test`.`test` | PRIMARY    |        2 |
    +­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­+
Only recent, no history yet! :(
www.fromdual.com
31 / 32
SHOW PROFILE vs P_S
SET PROFILING = 1;
SELECT ...;
SHOW PROFILES;
+­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+
| Query_ID | Duration   | Query              |
+­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+
|        1 | 2.26217725 | select * from test |
+­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+
SHOW PROFILE FOR QUERY 1;
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
| Status               | Duration |
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
| starting             | 0.000060 |
| checking permissions | 0.000009 |
| Opening tables       | 0.000020 |
| init                 | 0.000020 |
| System lock          | 0.000012 |
| optimizing           | 0.000006 |
| statistics           | 0.000014 |
| preparing            | 0.000012 |
| executing            | 0.000003 |
| Sending data         | 2.261963 |
| end                  | 0.000010 |
| query end            | 0.000008 |
| closing tables       | 0.000013 |
| freeing items        | 0.000013 |
| cleaning up          | 0.000015 |
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
UPDATE performance_schema.setup_instruments SET ENABLED = 'YES'
, TIMED = 'YES' WHERE NAME LIKE '%statement/%';
UPDATE performance_schema.setup_instruments SET ENABLED = 'YES'
, TIMED = 'YES' WHERE NAME LIKE '%stage/%';
UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'
  WHERE NAME LIKE '%events_statements_%';
UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'
 WHERE NAME LIKE '%events_stages_%';
SELECT ...;
SELECT eshl.event_id AS Query_ID, TRUNCATE(eshl.timer_wait/1000000000000
, 6) as Duration, LEFT(eshl.sql_text, 120) AS Query
  FROM performance_schema.events_statements_history_long AS eshl
  JOIN performance_schema.threads AS t ON t.thread_id = eshl.thread_id
 WHERE t.processlist_id = CONNECTION_ID();
+­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+
| Query_ID | Duration  | Query                   |
+­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+
|       12 | 13.560737 | select * from test.test |
+­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+
SELECT SUSBTR(event_name, 11) AS Stage
     , TRUNCATE(timer_wait/1000000000000,6) AS Duration 
  FROM performance_schema.events_stages_history_long
 WHERE nesting_event_id = 12;
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
| Stage                | Duration  |
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
| starting             |  0.000043 |
| checking permissions |  0.000004 |
| Opening tables       |  0.002700 |
| init                 |  0.000025 |
| System lock          |  0.000009 |
| optimizing           |  0.000002 |
| statistics           |  0.000014 |
| preparing            |  0.000013 |
| executing            |  0.000000 |
| Sending data         | 13.557683 |
| end                  |  0.000002 |
| query end            |  0.000008 |
| closing tables       |  0.000006 |
| freeing items        |  0.000215 |
| cleaning up          |  0.000001 |
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
www.fromdual.com
32 / 32
Q & A
Questions ?
Discussion?
We have time for some face-to-face talks...
● FromDual provides neutral and independent:
● Consulting
● Remote-DBA
● Support for MySQL, Galera, Percona Server and MariaDB
● Training
www.fromdual.com/presentations

More Related Content

What's hot

FOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsFOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsValerii Kravchuk
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Valerii Kravchuk
 
Gdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalGdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalValeriy Kravchuk
 
MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介kwatch
 
What's New in MySQL 5.7
What's New in MySQL 5.7What's New in MySQL 5.7
What's New in MySQL 5.7Olivier DASINI
 
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS -  FOSDEM 2022 MariaDB DevroomMariaDB Server on macOS -  FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS - FOSDEM 2022 MariaDB DevroomValeriy Kravchuk
 
MYSQLDUMP & ZRM COMMUNITY (EN)
MYSQLDUMP & ZRM COMMUNITY (EN)MYSQLDUMP & ZRM COMMUNITY (EN)
MYSQLDUMP & ZRM COMMUNITY (EN)Cédric P
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comJean-François Gagné
 
Gluster volume snapshot
Gluster volume snapshotGluster volume snapshot
Gluster volume snapshotRajesh Joseph
 
Applying profilers to my sql (fosdem 2017)
Applying profilers to my sql (fosdem 2017)Applying profilers to my sql (fosdem 2017)
Applying profilers to my sql (fosdem 2017)Valeriy Kravchuk
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
Riding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamRiding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamJean-François Gagné
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
The New MariaDB Offering - MariaDB 10, MaxScale and more
The New MariaDB Offering - MariaDB 10, MaxScale and moreThe New MariaDB Offering - MariaDB 10, MaxScale and more
The New MariaDB Offering - MariaDB 10, MaxScale and moreMariaDB Corporation
 
Tuning Linux for Databases.
Tuning Linux for Databases.Tuning Linux for Databases.
Tuning Linux for Databases.Alexey Lesovsky
 
Optimization_of_Virtual_Machines_for_High_Performance
Optimization_of_Virtual_Machines_for_High_PerformanceOptimization_of_Virtual_Machines_for_High_Performance
Optimization_of_Virtual_Machines_for_High_PerformanceStorPool Storage
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021Valeriy Kravchuk
 

What's hot (20)

FOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsFOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
 
Gdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalGdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) final
 
MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介
 
What's New in MySQL 5.7
What's New in MySQL 5.7What's New in MySQL 5.7
What's New in MySQL 5.7
 
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS -  FOSDEM 2022 MariaDB DevroomMariaDB Server on macOS -  FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
 
MYSQLDUMP & ZRM COMMUNITY (EN)
MYSQLDUMP & ZRM COMMUNITY (EN)MYSQLDUMP & ZRM COMMUNITY (EN)
MYSQLDUMP & ZRM COMMUNITY (EN)
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.com
 
Gluster volume snapshot
Gluster volume snapshotGluster volume snapshot
Gluster volume snapshot
 
Applying profilers to my sql (fosdem 2017)
Applying profilers to my sql (fosdem 2017)Applying profilers to my sql (fosdem 2017)
Applying profilers to my sql (fosdem 2017)
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
Riding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamRiding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication Stream
 
Kvm optimizations
Kvm optimizationsKvm optimizations
Kvm optimizations
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
The New MariaDB Offering - MariaDB 10, MaxScale and more
The New MariaDB Offering - MariaDB 10, MaxScale and moreThe New MariaDB Offering - MariaDB 10, MaxScale and more
The New MariaDB Offering - MariaDB 10, MaxScale and more
 
Tuning Linux for Databases.
Tuning Linux for Databases.Tuning Linux for Databases.
Tuning Linux for Databases.
 
How to Monitor MySQL
How to Monitor MySQLHow to Monitor MySQL
How to Monitor MySQL
 
Optimization_of_Virtual_Machines_for_High_Performance
Optimization_of_Virtual_Machines_for_High_PerformanceOptimization_of_Virtual_Machines_for_High_Performance
Optimization_of_Virtual_Machines_for_High_Performance
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
 
GUC Tutorial Package (9.0)
GUC Tutorial Package (9.0)GUC Tutorial Package (9.0)
GUC Tutorial Package (9.0)
 

Viewers also liked

GoldenGate for MySQL 설치 시 필요한 사항
GoldenGate for MySQL 설치 시 필요한 사항GoldenGate for MySQL 설치 시 필요한 사항
GoldenGate for MySQL 설치 시 필요한 사항정명훈 Jerry Jeong
 
Web vulnerability seminar2
Web vulnerability seminar2Web vulnerability seminar2
Web vulnerability seminar2Sakuya Izayoi
 
Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0sprdd
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilityZendCon
 
Framework Shootout
Framework ShootoutFramework Shootout
Framework ShootoutZendCon
 
Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Zhaoyang Wang
 
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMark Swarbrick
 
MySQL Manchester TT - 5.7 Whats new
MySQL Manchester TT - 5.7 Whats newMySQL Manchester TT - 5.7 Whats new
MySQL Manchester TT - 5.7 Whats newMark Swarbrick
 
A Storage Story #ChefConf2013
A Storage Story #ChefConf2013A Storage Story #ChefConf2013
A Storage Story #ChefConf2013Kyle Bader
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZendCon
 
MySQL Manchester TT - Security
MySQL Manchester TT  - SecurityMySQL Manchester TT  - Security
MySQL Manchester TT - SecurityMark Swarbrick
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's NewZendCon
 
Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践Zhaoyang Wang
 
Application Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingApplication Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingZendCon
 
Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍Zhaoyang Wang
 
Tiery Eyed
Tiery EyedTiery Eyed
Tiery EyedZendCon
 
PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i TutorialZendCon
 
MySQL Optimizer Overview
MySQL Optimizer OverviewMySQL Optimizer Overview
MySQL Optimizer OverviewOlav Sandstå
 

Viewers also liked (20)

GoldenGate for MySQL 설치 시 필요한 사항
GoldenGate for MySQL 설치 시 필요한 사항GoldenGate for MySQL 설치 시 필요한 사항
GoldenGate for MySQL 설치 시 필요한 사항
 
Web vulnerability seminar2
Web vulnerability seminar2Web vulnerability seminar2
Web vulnerability seminar2
 
Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
 
Framework Shootout
Framework ShootoutFramework Shootout
Framework Shootout
 
Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站
 
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
 
MySQL Manchester TT - 5.7 Whats new
MySQL Manchester TT - 5.7 Whats newMySQL Manchester TT - 5.7 Whats new
MySQL Manchester TT - 5.7 Whats new
 
A Storage Story #ChefConf2013
A Storage Story #ChefConf2013A Storage Story #ChefConf2013
A Storage Story #ChefConf2013
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
MySQL Manchester TT - Security
MySQL Manchester TT  - SecurityMySQL Manchester TT  - Security
MySQL Manchester TT - Security
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's New
 
Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践
 
Application Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingApplication Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server Tracing
 
Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍
 
MySQL in your laptop
MySQL in your laptopMySQL in your laptop
MySQL in your laptop
 
Tiery Eyed
Tiery EyedTiery Eyed
Tiery Eyed
 
Script it
Script itScript it
Script it
 
PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i Tutorial
 
MySQL Optimizer Overview
MySQL Optimizer OverviewMySQL Optimizer Overview
MySQL Optimizer Overview
 

Similar to PERFORMANCE_SCHEMA and sys schema

MySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukMySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukValeriy Kravchuk
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Valeriy Kravchuk
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2PgTraining
 
Improving the performance of Odoo deployments
Improving the performance of Odoo deploymentsImproving the performance of Odoo deployments
Improving the performance of Odoo deploymentsOdoo
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015Dave Stokes
 
When the OS gets in the way
When the OS gets in the wayWhen the OS gets in the way
When the OS gets in the wayMark Price
 
Patroni - HA PostgreSQL made easy
Patroni - HA PostgreSQL made easyPatroni - HA PostgreSQL made easy
Patroni - HA PostgreSQL made easyAlexander Kukushkin
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsProper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsDave Stokes
 
What’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributorWhat’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributorMasahiko Sawada
 
Common Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemCommon Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemAcquia
 
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...Dave Stokes
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016Brendan Gregg
 
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Valeriy Kravchuk
 
MySQL HA Orchestrator Proxysql Consul.pdf
MySQL HA Orchestrator Proxysql Consul.pdfMySQL HA Orchestrator Proxysql Consul.pdf
MySQL HA Orchestrator Proxysql Consul.pdfYunusShaikh49
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseParesh Patel
 

Similar to PERFORMANCE_SCHEMA and sys schema (20)

MySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukMySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossuk
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
 
Improving the performance of Odoo deployments
Improving the performance of Odoo deploymentsImproving the performance of Odoo deployments
Improving the performance of Odoo deployments
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
 
When the OS gets in the way
When the OS gets in the wayWhen the OS gets in the way
When the OS gets in the way
 
Patroni - HA PostgreSQL made easy
Patroni - HA PostgreSQL made easyPatroni - HA PostgreSQL made easy
Patroni - HA PostgreSQL made easy
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsProper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
 
What’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributorWhat’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributor
 
Common Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemCommon Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid Them
 
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016
 
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
 
MySQL HA Orchestrator Proxysql Consul.pdf
MySQL HA Orchestrator Proxysql Consul.pdfMySQL HA Orchestrator Proxysql Consul.pdf
MySQL HA Orchestrator Proxysql Consul.pdf
 
The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
 

More from FromDual GmbH

MariaDB/MySQL pitfalls - And how to come out again...
MariaDB/MySQL pitfalls - And how to come out again...MariaDB/MySQL pitfalls - And how to come out again...
MariaDB/MySQL pitfalls - And how to come out again...FromDual GmbH
 
MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?FromDual GmbH
 
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration WorkshopPXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration WorkshopFromDual GmbH
 
IT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New FeaturesIT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New FeaturesFromDual GmbH
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New FeaturesFromDual GmbH
 
MariaDB 10.2 New Features
MariaDB 10.2 New FeaturesMariaDB 10.2 New Features
MariaDB 10.2 New FeaturesFromDual GmbH
 
MySQL für Oracle DBA's
MySQL für Oracle DBA'sMySQL für Oracle DBA's
MySQL für Oracle DBA'sFromDual GmbH
 
MySQL Backup/Recovery
MySQL Backup/RecoveryMySQL Backup/Recovery
MySQL Backup/RecoveryFromDual GmbH
 
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?FromDual GmbH
 
MySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und ClusterMySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und ClusterFromDual GmbH
 
Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?FromDual GmbH
 
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationWeltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationFromDual GmbH
 
MySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA'sMySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA'sFromDual GmbH
 
MySQL Security SLAC 2015
MySQL Security SLAC 2015MySQL Security SLAC 2015
MySQL Security SLAC 2015FromDual GmbH
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerFromDual GmbH
 
MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?FromDual GmbH
 
Reading MySQL fingerprints
Reading MySQL fingerprintsReading MySQL fingerprints
Reading MySQL fingerprintsFromDual GmbH
 
High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLFromDual GmbH
 
MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014FromDual GmbH
 
MySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQLMySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQLFromDual GmbH
 

More from FromDual GmbH (20)

MariaDB/MySQL pitfalls - And how to come out again...
MariaDB/MySQL pitfalls - And how to come out again...MariaDB/MySQL pitfalls - And how to come out again...
MariaDB/MySQL pitfalls - And how to come out again...
 
MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?
 
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration WorkshopPXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
 
IT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New FeaturesIT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New Features
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New Features
 
MariaDB 10.2 New Features
MariaDB 10.2 New FeaturesMariaDB 10.2 New Features
MariaDB 10.2 New Features
 
MySQL für Oracle DBA's
MySQL für Oracle DBA'sMySQL für Oracle DBA's
MySQL für Oracle DBA's
 
MySQL Backup/Recovery
MySQL Backup/RecoveryMySQL Backup/Recovery
MySQL Backup/Recovery
 
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
 
MySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und ClusterMySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und Cluster
 
Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?
 
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationWeltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
 
MySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA'sMySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA's
 
MySQL Security SLAC 2015
MySQL Security SLAC 2015MySQL Security SLAC 2015
MySQL Security SLAC 2015
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für Entwickler
 
MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?
 
Reading MySQL fingerprints
Reading MySQL fingerprintsReading MySQL fingerprints
Reading MySQL fingerprints
 
High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL
 
MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014
 
MySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQLMySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQL
 

Recently uploaded

Anne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxAnne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxnoorehahmad
 
Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Escort Service
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comsaastr
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...marjmae69
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Krijn Poppe
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSebastiano Panichella
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSebastiano Panichella
 
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.KathleenAnnCordero2
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRachelAnnTenibroAmaz
 
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC  - NANOTECHNOLOGYPHYSICS PROJECT BY MSC  - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC - NANOTECHNOLOGYpruthirajnayak525
 
Chizaram's Women Tech Makers Deck. .pptx
Chizaram's Women Tech Makers Deck.  .pptxChizaram's Women Tech Makers Deck.  .pptx
Chizaram's Women Tech Makers Deck. .pptxogubuikealex
 
Mathan flower ppt.pptx slide orchids ✨🌸
Mathan flower ppt.pptx slide orchids ✨🌸Mathan flower ppt.pptx slide orchids ✨🌸
Mathan flower ppt.pptx slide orchids ✨🌸mathanramanathan2005
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRRsarwankumar4524
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationNathan Young
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power
 
miladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxmiladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxCarrieButtitta
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxmavinoikein
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringSebastiano Panichella
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...漢銘 謝
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxJohnree4
 

Recently uploaded (20)

Anne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxAnne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptx
 
Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation Track
 
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
 
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC  - NANOTECHNOLOGYPHYSICS PROJECT BY MSC  - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
 
Chizaram's Women Tech Makers Deck. .pptx
Chizaram's Women Tech Makers Deck.  .pptxChizaram's Women Tech Makers Deck.  .pptx
Chizaram's Women Tech Makers Deck. .pptx
 
Mathan flower ppt.pptx slide orchids ✨🌸
Mathan flower ppt.pptx slide orchids ✨🌸Mathan flower ppt.pptx slide orchids ✨🌸
Mathan flower ppt.pptx slide orchids ✨🌸
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism Presentation
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
 
miladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxmiladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptx
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptx
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software Engineering
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptx
 

PERFORMANCE_SCHEMA and sys schema

  • 1. www.fromdual.com 1 / 32 PERFORMANCE_SCHEMA and sys schema What can we do with it? FOSDEM 2016, January 30th , Brussels Oli Sennhauser Senior MySQL Consultant at FromDual GmbH oli.sennhauser@fromdual.com
  • 2. www.fromdual.com 2 / 32 About FromDual GmbH Support remote-DBA Training Consulting
  • 3. www.fromdual.com 3 / 32 Contents PERFORMANCE_SCHEMA and sys schema ➢ Database Profiling ➢ PERFORMANCE_SCHEMA (P_S) ➢ Installation, configuration, instrumentation, etc. ➢ sys schema ➢ Installation, configuration, etc. ➢ Use cases
  • 4. www.fromdual.com 4 / 32 Database Profiling ● Where has my time gone? ● Where have my resources gone? function x() {   start = current_time();   count[x]++;   …   end = current_time();   duration[x] += (end ­ start); } function   count   time x            123     156.25     0.8% y             19     827.30     4.1% z              2   19280.00    95.1% Total        144   20263.55   100.0% time a b c d e f g h j i
  • 5. www.fromdual.com 5 / 32 MySQL Profiler ● Since MySQL 5.0 ● SET profiling = 1; SELECT …; SHOW PROFILE; ● Deprecated in 5.6 ● So what now? +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+ | Status               | Duration | +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+ | starting             | 0.000059 | | checking permissions | 0.000008 | | Opening tables       | 0.000017 | | init                 | 0.000023 | | System lock          | 0.000009 | | optimizing           | 0.000006 | | statistics           | 0.000014 | | preparing            | 0.000011 | | Creating tmp table   | 0.000023 | | Sorting result       | 0.000005 | | executing            | 0.000003 | | Sending data         | 1.253803 | | Creating sort index  | 0.000049 | | end                  | 0.000005 | | removing tmp table   | 0.000019 | | end                  | 0.000006 | | query end            | 0.000009 | | closing tables       | 0.000012 | | freeing items        | 0.000019 | | logging slow query   | 0.000004 | | cleaning up          | 0.000011 | +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
  • 6. www.fromdual.com 6 / 32 PERFORMANCE_SCHEMA (P_S) ● Discussed at least since 2006 ● Introduced in MySQL 5.5 (2010) ● Disabled by default ● Not really useful yet ● Improved in MySQL 5.6 (2011/12) ● Enabled by default ● Became useful and interesting ● More improvements in MySQL 5.7 (2013-15) ● More probes, more information: ● Memory, Transactions, Replication, Session/Status variables ● Overhead 2% - 200% ● Depends on how you do it → careful!
  • 7. www.fromdual.com 7 / 32 Goal of P_S ● Monitoring MySQL server execution at a low level ● Inspect internal execution of the server at runtime ● How: Server is instrumented to collect timing information ● Output: SQL queries on normal MySQL ring-buffer tables ● Events is anything the server does: ● Function call ● Wait for the O/S ● SQL statement, stages ● Memory
  • 8. www.fromdual.com 8 / 32 P_S installation & configuration ● Installed by default ● mysql_upgrade → do restart afterwards ● Configuration in my.cnf ● 5.5 off ● performance_schema = 1 ● 5.6 and later on ● Tuning (my.cnf) ● performance_schema_events_waits_long = 10000 ● SHOW GLOBAL VARIABLES LIKE 'PERF%';  ● SHOW GLOBAL STATUS LIKE 'PERF%';
  • 9. www.fromdual.com 9 / 32 Online enabling / disabling ● setup_* tables ● Actors ● Which user and host is profiled (default %) ● Consumers ● Which P_S tables are filled with data (e.g. events_state_current, some are off!) ● Instruments ● Which probes are activated (expensive ones are disabled) ● Objects ● Database objects (table, trigger, procedure, function, event) to profile (on for user obj.) ● Timers ● Default is in nanoseconds (10-9 s) UPDATE setup_instruments    SET ENABLED = 'YES', TIMED = 'YES'  WHERE name = 'wait/synch/mutex/innodb/autoinc_mutex';
  • 10. www.fromdual.com 10 / 32 Instrumentation depth ● Enable probes: ● events_transactions_* → unknown ● events_statements_* → moderate expensive ● events_stages_* → expensive! ● events_waits_* → very expensive! ● end ● events_memory_* → very expensive? ● end ● end ● end ● End ● Can have a performance impact!
  • 11. www.fromdual.com 11 / 32 Consumer types and hierarchies ● events_*_current → one per thread ● events_*_history → most recent n events per thread (default 10) ● events_*_history_long → most recent n events (10000) ● events_*_summary_global_by_event_name ● events_*_summary_by_account_by_event_name → (host + user) ● events_*_summary_by_host_by_event_name → e.g. 127.0.0.1 ● events_*_summary_by_user_by_event_name → e.g. root ● events_*_summary_by_thread_by_event_name → thread (connection) ● events_*_summary_by_digest → normalized query: WHERE a = ? ● events_*_summary_by_program → procedure, function, trigger, event ● events_*_summary_by_instance → file, mutex, prep stmt, rwlock, socket, condition ● Can be truncate with TRUCATE TABLE ...
  • 12. www.fromdual.com 12 / 32 sys schema ● Originally “ps_helper” in 5.6 (2012) ● By Mark Leith ● Senior SW Dev Mgr at Oracle ● Make it easier to use the P_S! ● A database schema (sys) ● Consisting of tables, views, functions, procedures and triggers. ● To give human readable insight into a MySQL database. ● Based on PERFORMANCE_SCHEMA and INFORMATION_SCHEMA ● Current release v1.5 (2016-01) ● Download: https://github.com/mysql/mysql-sys
  • 13. www.fromdual.com 13 / 32 sys schema installation ● Since MySQL 5.7.7 installed by default! ● Can be skipped ● In MySQL 5.6: ● mysql_upgrade installs/upgrades sys ● Can be skipped wget https://github.com/mysql/mysql­sys/archive/master.tar.gz tar xf master.tar.gz cd mysql­sys­master Mysql –user=root ­­password < ./sys_56.sql
  • 14. www.fromdual.com 14 / 32 sys view/table types ● 2 types, e.g.: ● io_by_thread_by_latency → human understandable numbers ● x$io_by_thread_by_latency → base tables in picoseconds (10-12s) ● Topics: ● host_* → Activities grouped by host ● innodb_* → InnoDB Information ● io_* → I/O consumers grouped by file, bytes, latency ● memory_* → Memory usage grouped by host, thread, user, type ● schema_* → Various information about schema ● statement_* → Statistics about statements ● user_* → Information per user ● waits_* → Wait event informations
  • 15. www.fromdual.com 15 / 32 Configure P_S with sys ● Reset defaults: ● CALL sys.ps_setup_reset_to_default(TRUE); ● Change setup tables: ● CALL sys.ps_setup_enable_instrument('wait'); ● CALL sys.ps_setup_enable_instrument('stage'); ● CALL sys.ps_setup_enable_instrument('statement'); ● CALL sys.ps_setup_enable_consumer('current'); ● CALL sys.ps_setup_enable_consumer('history_long');
  • 16. www.fromdual.com 16 / 32 Use cases ● The following use cases can be found at: ● http://fromdual.com/mysql-performance-schema-hints
  • 17. www.fromdual.com 17 / 32 SSL encryption used or not SELECT variable_value AS tls_version, processlist_user AS user      , processlist_host AS host   FROM performance_schema.status_by_thread AS sbt   JOIN performance_schema.threads AS t     ON t.thread_id = sbt.thread_id  WHERE variable_name = 'Ssl_version'  ORDER BY tls_version ; +­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­+ | tls_version | user | host      | +­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­+ |             | root | localhost | | TLSv1.1     | root | localhost | +­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­+
  • 18. www.fromdual.com 18 / 32 Accounts not properly closing connections SELECT ess.user, ess.host      , (a.total_connections ­ a.current_connections) ­ ess.count_star as not_closed      , ((a.total_connections ­ a.current_connections) ­ ess.count_star) * 100 /        (a.total_connections ­ a.current_connections) as pct_not_closed   FROM performance_schema.events_statements_summary_by_account_by_event_name ess   JOIN performance_schema.accounts a on (ess.user = a.user and ess.host = a.host)  WHERE ess.event_name = 'statement/com/quit'    AND (a.total_connections ­ a.current_connections) > ess.count_star ; +­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+ | user | host      | not_closed | pct_not_closed | +­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+ | root | localhost |          1 |         5.0000 | +­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+
  • 19. www.fromdual.com 19 / 32 Accounts which never connected since last start-up SELECT DISTINCT m_u.user, m_u.host   FROM mysql.user m_u   LEFT JOIN performance_schema.accounts ps_a     ON m_u.user = ps_a.user AND m_u.host = ps_a.host  WHERE ps_a.user IS NULL ORDER BY m_u.user ; +­­­­­­­­­­­+­­­­­­­­­­­+ | user      | host      | +­­­­­­­­­­­+­­­­­­­­­­­+ | focmm     | master    | | mysql.sys | localhost | | oli       | localhost | | root      | %         | +­­­­­­­­­­­+­­­­­­­­­­­+
  • 20. www.fromdual.com 20 / 32 Bad SQL queries by user SELECT user, host, event_name      , sum_created_tmp_disk_tables AS tmp_disk_tables      , sum_select_full_join AS full_join   FROM performance_schema.events_statements_summary_by_account_by_event_name  WHERE sum_created_tmp_disk_tables > 0     OR sum_select_full_join > 0  ORDER BY sum_sort_merge_passes DESC  LIMIT 10 ; +­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+ | user | host      | event_name                  | tmp_disk_tables | full_join | +­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+ | root | localhost | statement/sql/select        |             134 |       204 | | root | localhost | statement/sql/show_fields   |            3607 |         0 | | root | localhost | statement/sql/show_triggers |            1792 |         0 | | root | localhost | statement/com/Field List    |              28 |         0 | +­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
  • 21. www.fromdual.com 21 / 32 Top long running queries UPDATE performance_schema.setup_consumers SET enabled = 1  WHERE name = 'events_statements_history_long'; SELECT left(digest_text, 64)      , ROUND(SUM(timer_end­timer_start)/1000000000, 1) AS tot_exec_ms      , ROUND(SUM(timer_wait)/1000000000, 1) AS tot_wait_ms      , ROUND(SUM(lock_time)/1000000000, 1) AS tot_lock_ms      , MIN(LEFT(DATE_SUB(NOW(), INTERVAL (isgs.VARIABLE_VALUE ­ TIMER_START*10e­13) second), 19)) AS first_seen      , MAX(LEFT(DATE_SUB(NOW(), INTERVAL (isgs.VARIABLE_VALUE ­ TIMER_START*10e­13) second), 19)) AS last_seen      , COUNT(*) as cnt   FROM performance_schema.events_statements_history_long   JOIN performance_schema.global_status AS isgs  WHERE isgs.variable_name = 'UPTIME'  GROUP BY LEFT(digest_text,64)  ORDER BY tot_exec_ms DESC ; +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­+ | left(digest_text, 64)                                            | tot_exec_ms | tot_wait_ms | tot_lock_ms | cnt | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­+ | INSERT INTO `history` ( `itemid` , `clock` , `ns` , VALUE ) VALU |        12.3 |        12.3 |         2.4 |   6 | | SELECT `i` . `itemid` , `i` . `state` , `i` . `delta` , `i` . `m |        10.4 |        10.4 |         1.9 |   6 | | SELECT LEFT ( `digest_text` , ? ) , `ROUND` ( SUM ( `timer_end`  |         7.5 |         7.5 |         0.0 |   1 | | SELECT `i` . `itemid` , `i` . `key_` , `h` . `host` , `i` . `typ |         3.2 |         3.2 |         1.1 |   6 | | SELECT `h` . `hostid` , `h` . `host` , `h` . `name` , `t` . `htt |         2.0 |         2.0 |         0.9 |   4 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­+
  • 22. www.fromdual.com 22 / 32 Unused indexes SELECT object_schema, object_name, index_name   FROM performance_schema.table_io_waits_summary_by_index_usage  WHERE index_name IS NOT NULL    AND count_star = 0    AND index_name != 'PRIMARY'  ORDER BY object_schema, object_name ; +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­+ | object_schema | object_name | index_name | +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­+ | a             | audit       | data_2     | | a             | audit       | data       | | a             | c1          | c2_id      | +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­+ SELECT *   FROM sys.schema_unused_indexes ;
  • 23. www.fromdual.com 23 / 32 Redundant indexes SELECT table_schema, table_name      , redundant_index_columns, dominant_index_columns   FROM sys.schema_redundant_indexes ; +­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­+ | table_schema | table_name        | redundant_index_columns | dominant_index_columns | +­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­+ | crm          | accounts          | id,deleted              | id                     | | crm          | accounts_bugs     | account_id              | account_id,bug_id      | | crm          | acl_actions       | id,deleted              | id                     | | crm          | acl_roles         | id,deleted              | id                     | | crm          | acl_roles_actions | role_id                 | role_id,action_id      | +­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­+
  • 24. www.fromdual.com 24 / 32 Statements with errors or warnings SELECT db, query, exec_count, errors, warnings   FROM sys.statements_with_errors_or_warnings ; +­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­+­­­­­­­­­­+ | db                 | query                      | exec_count | errors | warnings | +­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­+­­­­­­­­­­+ | mysql              | UPDATE `setup_consumers... |          1 |      1 |        0 | | mysql              | SELECT LEFT ( `digest_t... |          2 |      1 |        0 | | sys                | SELECT * FROM `setup_co... |          1 |      1 |        0 | | performance_schema | SELECT * FROM `user_sum... |          1 |      1 |        0 | | test               | SELECT * FROM `test` LI... |          6 |      1 |        0 | +­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­+­­­­­­­­­­+
  • 25. www.fromdual.com 25 / 32 Tables with full table scan SELECT *   FROM sys.schema_tables_with_full_table_scans ; +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+ | object_schema | object_name | rows_full_scanned | latency   | +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+ | zabbix        | triggers    |              1436 | 5.05 ms   | | zabbix        | hosts       |                34 | 41.81 us  | | zabbix        | interface   |                 6 | 4.33 ms   | | zabbix        | expressions |                 4 | 648.98 us | | zabbix        | config      |                 1 | 3.62 ms   | | zabbix        | globalmacro |                 1 | 2.61 ms   | | zabbix        | media       |                 1 | 548.01 us | +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
  • 26. www.fromdual.com 26 / 32 I/O by user SELECT *   FROM sys.user_summary_by_file_io ; +­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­­+ | user       | ios  | io_latency | +­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­­+ | background | 6926 | 8.52 s     | :­( | zabbix     |  738 | 127.52 ms  | | root       |  101 | 6.57 ms    | | fpmmm      |  363 | 644.00 us  | +­­­­­­­­­­­­+­­­­­­+­­­­­­­­­­­­+
  • 27. www.fromdual.com 27 / 32 Latency on file I/O SELECT event_name, total, total_latency      , read_latency, write_latency, misc_latency   FROM sys.io_global_by_wait_by_latency  LIMIT 5 ; +­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­+ | event_name              | total | tot_latency | r_latency | w_latency | misc_latency | +­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­+ | innodb/innodb_log_file  |  1323 | 8.84 s      | 29.08 us  | 25.08 ms  | 8.81 s       | :( | innodb/innodb_data_file |  6299 | 8.81 s      | 429.56 ms | 660.95 ms | 7.72 s       | :( | sql/binlog_index        |    40 | 35.20 ms    | 4.07 us   | 0 ps      | 35.19 ms     | | sql/binlog              |   610 | 26.09 ms    | 14.46 us  | 4.12 ms   | 21.96 ms     | | sql/relaylog            |    13 | 18.77 ms    | 1.97 us   | 5.56 us   | 18.77 ms     | +­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­+
  • 28. www.fromdual.com 28 / 32 Memory by user UPDATE performance_schema.setup_instruments    SET enabled = 'YES'  WHERE name LIKE 'memory%' ; SELECT user, current_allocated, current_avg_alloc      , current_max_alloc, total_allocated   FROM sys.memory_by_user_by_current_bytes ; +­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+ | user       | curr_alloc | curr_avg_alloc | curr_max_alloc | tot_alloc | +­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+ | root       | 348.35 KiB | 9.95 KiB       | 248.04 KiB     | 8.54 MiB  | | zabbix     | 44.72 KiB  | 2.48 KiB       | 32.02 KiB      | 11.87 MiB | | fpmmm      | 43.56 KiB  | 4.36 KiB       | 43.56 KiB      | 1.37 MiB  | | background | 9.85 KiB   | 1.97 KiB       | 9.64 KiB       | 1.42 MiB  | +­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
  • 29. www.fromdual.com 29 / 32 SELECT, INSERT, UPDATE and DELETE per table SELECT object_type, object_schema, object_name      , count_star, count_read, count_write      , count_insert   FROM performance_schema.table_io_waits_summary_by_table  WHERE count_star > 0  ORDER BY count_write DESC  LIMIT 5 ; +­­­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­+ | object_type | object_schema | object_name  | count_star | count_read | count_write | count_insert | +­­­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­+ | TABLE       | zabbix        | history_uint |      12791 |         92 |       12699 |        12699 | | TABLE       | zabbix        | history      |       3374 |         10 |        3364 |         3364 | | TABLE       | zabbix        | history_str  |       2003 |         48 |        1955 |         1955 | | TABLE       | zabbix        | trends_uint  |        930 |          0 |         930 |          930 | | TABLE       | zabbix        | trends       |        200 |          0 |         200 |          200 | +­­­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­+
  • 30. www.fromdual.com 30 / 32 How to proceed? 1. Define the question to answer:    “Which transaction was locked by which other transaction?” 2. Can sys schema anwser the question?    SELECT * FROM sys.innodb_lock_waits;     +­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­+     | wait_started      | wait_age | locked_table  | locked_index | locked_type |     +­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­+     | 16­01­29 17:53:09 | 00:00:02 | `test`.`test` | PRIMARY      | RECORD      |     +­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­+ 3. If not: Can P_S or I_S answer the question?    SELECT * FROM information_schema.innodb_locks;     +­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­+     | lock_trx_id | lock_type | lock_table    | lock_index | lock_rec |     +­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­+     | 27514604    | RECORD    | `test`.`test` | PRIMARY    |        2 |     +­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­+ Only recent, no history yet! :(
  • 31. www.fromdual.com 31 / 32 SHOW PROFILE vs P_S SET PROFILING = 1; SELECT ...; SHOW PROFILES; +­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+ | Query_ID | Duration   | Query              | +­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+ |        1 | 2.26217725 | select * from test | +­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+ SHOW PROFILE FOR QUERY 1; +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+ | Status               | Duration | +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+ | starting             | 0.000060 | | checking permissions | 0.000009 | | Opening tables       | 0.000020 | | init                 | 0.000020 | | System lock          | 0.000012 | | optimizing           | 0.000006 | | statistics           | 0.000014 | | preparing            | 0.000012 | | executing            | 0.000003 | | Sending data         | 2.261963 | | end                  | 0.000010 | | query end            | 0.000008 | | closing tables       | 0.000013 | | freeing items        | 0.000013 | | cleaning up          | 0.000015 | +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+ UPDATE performance_schema.setup_instruments SET ENABLED = 'YES' , TIMED = 'YES' WHERE NAME LIKE '%statement/%'; UPDATE performance_schema.setup_instruments SET ENABLED = 'YES' , TIMED = 'YES' WHERE NAME LIKE '%stage/%'; UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'   WHERE NAME LIKE '%events_statements_%'; UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'  WHERE NAME LIKE '%events_stages_%'; SELECT ...; SELECT eshl.event_id AS Query_ID, TRUNCATE(eshl.timer_wait/1000000000000 , 6) as Duration, LEFT(eshl.sql_text, 120) AS Query   FROM performance_schema.events_statements_history_long AS eshl   JOIN performance_schema.threads AS t ON t.thread_id = eshl.thread_id  WHERE t.processlist_id = CONNECTION_ID(); +­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+ | Query_ID | Duration  | Query                   | +­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+ |       12 | 13.560737 | select * from test.test | +­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­­­­+ SELECT SUSBTR(event_name, 11) AS Stage      , TRUNCATE(timer_wait/1000000000000,6) AS Duration    FROM performance_schema.events_stages_history_long  WHERE nesting_event_id = 12; +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+ | Stage                | Duration  | +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+ | starting             |  0.000043 | | checking permissions |  0.000004 | | Opening tables       |  0.002700 | | init                 |  0.000025 | | System lock          |  0.000009 | | optimizing           |  0.000002 | | statistics           |  0.000014 | | preparing            |  0.000013 | | executing            |  0.000000 | | Sending data         | 13.557683 | | end                  |  0.000002 | | query end            |  0.000008 | | closing tables       |  0.000006 | | freeing items        |  0.000215 | | cleaning up          |  0.000001 | +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­+
  • 32. www.fromdual.com 32 / 32 Q & A Questions ? Discussion? We have time for some face-to-face talks... ● FromDual provides neutral and independent: ● Consulting ● Remote-DBA ● Support for MySQL, Galera, Percona Server and MariaDB ● Training www.fromdual.com/presentations