SlideShare a Scribd company logo
1 of 126
Download to read offline
MySQL Database Monitoring:
Must, Good and Nice to Have
Sveta Smirnova
Principal Support Engineering Coordinator
• MySQL Support Engineer
• Author
MySQL Troubleshooting
MySQL Cookbook, 4th Edition
• JSON UDF functions
• FILTER clause for MySQL
• Speaker
• Percona Live, OOW, Fosdem,
DevConf, HighLoad...
Sveta Smirnova
• Solving Support cases
• Sometimes we cannot resolve the issue
because necessary information was not
collected in time
• Reasons are
• Lack of knowledge
• Fear of performance impact
• Let’s discuss what can help and for
which price!
Motivation
3
© Copyright 2023 Percona ® LLC. All rights reserved
must Should be always ON
Must-Good-Nice
4
© Copyright 2023 Percona ® LLC. All rights reserved
must Should be always ON
good Useful data, little effect on overall
performance
Must-Good-Nice
5
© Copyright 2023 Percona ® LLC. All rights reserved
must Should be always ON
good Useful data, little effect on overall
performance
nice May slow down database but very
useful in certain situations
Must-Good-Nice
6
© Copyright 2023 Percona ® LLC. All rights reserved
2023-05-16T12:44:14.776227Z 0 [System] [MY-011323] [Server]
X Plugin ready for connections.
Bind-address: ’::’ port: 13020, socket: /tmp/mysqlx.1.sock
2023-05-16T12:44:14.776295Z 0 [System] [MY-010931] [Server]
/home/sveta/Percona-Server-8.0.32-24/bin/mysqld: ready for connections.
Version: ’8.0.32-24’ socket: ’/tmp/mysqld.1.sock’ port: 13000
Percona Server (GPL), Release 24, Revision e5c6e9d2.
Error Log: Normal Operation
7
© Copyright 2023 Percona ® LLC. All rights reserved
2023-05-16T21:01:34.090936Z 0 [System] [MY-010116] [Server]
/Percona-Server-8.0.32-24/bin/mysqld (mysqld 8.0.32-24) starting as process 2006397
2023-05-16T21:01:34.103406Z 0 [Warning] [MY-010091] [Server] Can’t create test file
/Percona-Server-8.0.32-24/data/mysqld_tmp_file_case_insensitive_test.lower-test
2023-05-16T21:01:34.152150Z 0 [ERROR] [MY-010187] [Server] Could not open file
’/Percona-Server-8.0.32-24/data/Delly-7390.err’ for error logging: Permission denied
2023-05-16T21:01:34.152288Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-05-16T21:01:34.152856Z 0 [System] [MY-010910] [Server]
/Percona-Server-8.0.32-24/bin/mysqld: Shutdown complete (mysqld 8.0.32-24)
Percona Server (GPL), Release 24, Revision e5c6e9d2-debug.
Error Log: Immediate Answer
8
© Copyright 2023 Percona ® LLC. All rights reserved
2023-05-17T00:06:38.658777Z 11 [ERROR] [MY-012639] [InnoDB] Write to file
./test/joinit7.ibd failed at offset 80740352, 1048576 bytes should have been written,
only 929792 were written. Operating system error number 28. Check that your OS and
file system support files of this size. Check also that the disk is not full or
a disk quota exceeded.
2023-05-17T00:06:38.658801Z 11 [ERROR] [MY-012640] [InnoDB] Error number 28 means
’No space left on device’
2023-05-17T00:06:38.658820Z 11 [Warning] [MY-012145] [InnoDB] Error while writing
4194304 zeroes to ./test/joinit7.ibd starting at offset 79691776
2023-05-17T00:06:38.669221Z 11 [ERROR] [MY-013132] [Server] The table ’joinit7’ is full
Error Log: Invisible Issue
9
© Copyright 2023 Percona ® LLC. All rights reserved
2023-05-17T06:50:19.749143Z 0 [ERROR] InnoDB: Operating system error number 2 in a
file operation.
May 17 13:50:22 Delly mysqld[24814]: 2023-05-17T06:50:19.429496Z 0 [Note]
InnoDB: Apply batch completed
May 17 13:50:22 Delly mysqld[24814]: InnoDB: Progress in percent: 12 13 14 15 16 17
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
May 17 13:50:22 Delly mysqld[24814]: 2023-05-17T06:50:19.304439Z 0 [Note]
InnoDB: Starting an apply batch of log records to the database...
Error Log: "Unexpected" Corruption
10
© Copyright 2023 Percona ® LLC. All rights reserved
• Always ON
• Keep outside of data directory
• Do not rotate too often
• MUST HAVE
Error Log: Best Practices
11
© Copyright 2023 Percona ® LLC. All rights reserved
Database Performance Influencers
12
© Copyright 2023 Percona ® LLC. All rights reserved
Database Performance Influencers
13
© Copyright 2023 Percona ® LLC. All rights reserved
Query
• Collects slow queries
Slow Query Log
15
© Copyright 2023 Percona ® LLC. All rights reserved
• Collects slow queries
• Tunable parameters
• long_query_time
• log_slow_admin_statements
• log_queries_not_using_indexes
• min_examined_row_limit
• log_slow_replica_statements
Slow Query Log
16
© Copyright 2023 Percona ® LLC. All rights reserved
• Collects slow queries
• Tunable parameters
• Tunable verbosity
log_slow_extra
log_slow_verbosity
Slow Query Log
17
© Copyright 2023 Percona ® LLC. All rights reserved
# Time: 2023-05-17T11:08:23.065564Z
# User@Host: root[root] @ localhost [] Id: 29
# Schema: employees Last_errno: 0 Killed: 0
# Query_time: 0.003821 Lock_time: 0.000018 Rows_sent: 1 Rows_examined: 1
Rows_affected: 0 Bytess_sent: 187
SET timestamp=1684321703;
SELECT * FROM ‘departments‘ WHERE dept_no=’d003’;
Slow Query Log: minimal Verbosity
18
© Copyright 2023 Percona ® LLC. All rights reserved
# Time: 2023-05-17T11:08:30.038499Z
# User@Host: root[root] @ localhost [] Id: 29
# Schema: employees Last_errno: 0 Killed: 0
# Query_time: 0.001777 Lock_time: 0.000024 Rows_sent: 1 Rows_examined: 1
Rows_affected: 0 Bytes
_sent: 187
# Tmp_tables: 0 Tmp_disk_tables: 0 Tmp_table_sizes: 0
# Full_scan: No Full_join: No Tmp_table: No Tmp_table_on_disk: No
# Filesort: No Filesort_on_disk: No Merge_passes: 0
SET timestamp=1684321710;
SELECT * FROM ‘departments‘ WHERE dept_no=’d003’;
Slow Query Log: standard Verbosity
19
© Copyright 2023 Percona ® LLC. All rights reserved
# Time: 2023-05-17T11:08:36.662992Z
# User@Host: root[root] @ localhost [] Id: 29
# Schema: employees Last_errno: 0 Killed: 0
# Query_time: 0.002478 Lock_time: 0.000033 Rows_sent: 1 Rows_examined: 1
Rows_affected: 0 Bytes_sent: 187
# Tmp_tables: 0 Tmp_disk_tables: 0 Tmp_table_sizes: 0
# InnoDB_trx_id: 0
# Full_scan: No Full_join: No Tmp_table: No Tmp_table_on_disk: No
# Filesort: No Filesort_on_disk: No Merge_passes: 0
# InnoDB_IO_r_ops: 0 InnoDB_IO_r_bytes: 0 InnoDB_IO_r_wait: 0.000000
# InnoDB_rec_lock_wait: 0.000000 InnoDB_queue_wait: 0.000000
# InnoDB_pages_distinct: 1
SET timestamp=1684321716;
SELECT * FROM ‘departments‘ WHERE dept_no=’d003’;
Slow Query Log: full Verbosity
20
© Copyright 2023 Percona ® LLC. All rights reserved
# Time: 2023-05-17T11:08:43.170370Z
# User@Host: root[root] @ localhost [] Id: 29
# Schema: employees Last_errno: 0 Killed: 0
# Query_time: 0.001809 Lock_time: 0.000020 Rows_sent: 1 Rows_examined: 1
Rows_affected: 0 Bytes_sent: 187
# Profile_starting: 0.000675 Profile_starting_cpu: 0.000405
Profile_Executing_hook_on_transaction_begin.: 0.000025
Profile_Executing_hook_on_transaction_begin._cpu: 0.000023
Profile_starting: 0.000046 Profile_starting_cpu: 0.000046
...
Profile_closing_tables_cpu: 0.000075 Profile_freeing_items: 0.000075
Profile_freeing_items_cpu: 0.000075 Profile_logging_slow_query: 0.000006
Profile_logging_slow_query_cpu: 0.000006
# Profile_total: 0.001829 Profile_total_cpu: 0.001556
SET timestamp=1684321723;
SELECT * FROM ‘departments‘ WHERE dept_no=’d003’;
Slow Query Log: profiling verbosity
21
© Copyright 2023 Percona ® LLC. All rights reserved
# Profile
# Rank Query ID Response time Calls R/Call V/M Item
# ==== ================== ============= ===== ======= ===== ==============
# 1 0x61C2A843B38413D1 63.1758 99.9% 4 15.7939 1.81 SELECT titles
# 2 0x6B17FAAA0C13F2B4 0.0307 0.0% 11 0.0028 0.00 SELECT departments
# 3 0x90C659E5DE65EC22 0.0174 0.0% 1 0.0174 0.00 SELECT information_...
# 4 0xE3A3649C5FAC418D 0.0151 0.0% 21 0.0007 0.00 SELECT
# 5 0x02BBA8FDF2596F42 0.0121 0.0% 2 0.0060 0.01 SELECT departments
# MISC 0xMISC 0.0077 0.0% 13 0.0006 0.0 <4 ITEMS>
...
Slow Query Log by pt_query_digest
22
© Copyright 2023 Percona ® LLC. All rights reserved
# Query 2: 0.00 QPS, 0.00x concurrency, ID 0x6B17FAAA0C13F2B4 at byte 20896111
# Scores: V/M = 0.00
# Time range: 2023-05-17T10:27:00 to 2023-05-17T11:08:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 21 11
# Exec time 0 31ms 1ms 10ms 3ms 4ms 2ms 2ms
# Lock time 52 324us 17us 64us 29us 40us 12us 23us
# Rows sent 12 10 0 1 0.91 0.99 0.29 0.99
...
# SHOW TABLE STATUS FROM ‘test‘ LIKE ’departments’G
# SHOW CREATE TABLE ‘test‘.‘departments‘G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT * FROM ‘departments‘ WHERE dept_no=’d003’G
Slow Query Log by pt_query_digest
23
© Copyright 2023 Percona ® LLC. All rights reserved
• Can grow fast with long_query_time=0
• Does not depend on the database size
• Depends on the query activity
• Higher query rate - faster log growth
• Safe to use with comparatively low load
• For high load: plan log rotation
• NICE TO HAVE
Slow Query Log: Disk IO
24
© Copyright 2023 Percona ® LLC. All rights reserved
• Statements events
• Prepared statements
• Statements digests
• Stages events
Performance Schema
25
© Copyright 2023 Percona ® LLC. All rights reserved
• Examine more rows than return/change
• Use disk instead of memory
• Full table scan instead of index
• This is not full list!
Why statements are slow?
26
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> SELECT THREAD_ID TID, SUBSTR(SQL_TEXT, 1, 50) SQL_TEXT, ROWS_SENT RS,
-> ROWS_EXAMINED RE,CREATED_TMP_TABLES,NO_INDEX_USED,NO_GOOD_INDEX_USED
-> FROM performance_schema.events_statements_history
-> WHERE NO_INDEX_USED=1 OR NO_GOOD_INDEX_USED=1G
********************** 1. row **********************
TID: 10124
SQL_TEXT: select emp_no, first_name, last_name from employee
RS: 97750
RE: 397774
CREATED_TMP_TABLES: 0
NO_INDEX_USED: 1
NO_GOOD_INDEX_USED: 0
...
Which Queries Do Not Use Indexes?
27
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> select name from setup_instruments where name like ’statement%’;
+-----------------------------------------------+
| name |
+-----------------------------------------------+
| statement/sql/select |
| statement/sql/create_table |
| statement/sql/create_index |
| statement/sql/alter_table |
| statement/sql/update |
| statement/sql/insert |
| statement/sql/insert_select |
...
Statements Configuration
28
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> select name from setup_consumers where name like ’%statement%’;
+--------------------------------+
| name |
+--------------------------------+
| events_statements_current | -- Current statements
| events_statements_history | -- Last 10 statements
| events_statements_history_long | -- Last 1K statements
| statements_digest | -- Digests
+--------------------------------+
4 rows in set (0.00 sec)
Statements Events Configuration
29
© Copyright 2023 Percona ® LLC. All rights reserved
• CREATED_TMP_DISK_TABLES
• CREATED_TMP_TABLES
• SELECT_FULL_JOIN
• SELECT_RANGE_CHECK
• SELECT_SCAN
• SORT_MERGE_PASSES
• SORT_SCAN
Important Field Names
30
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> select DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_CREATED_TMP_DISK_TABLES,
-> SUM_SELECT_FULL_JOIN, SUM_SELECT_RANGE , SUM_SELECT_SCAN , SUM_NO_INDEX_USED,
-> SUM_ROWS_SENT, SUM_ROWS_EXAMINED
-> from events_statements_summary_by_digest where SUM_NO_INDEX_USED > 0G
*************************** 1. row ***************************
DIGEST: 3884185b07312b354c4918f2368d8fe2c431aeb8e39bf8ff5c3dcc6837
DIGEST_TEXT: SELECT ‘c‘ FROM ‘sbtest1‘ WHERE ‘id‘ BETWEEN ? AND ?
COUNT_STAR: 1501791
SUM_CREATED_TMP_DISK_TABLES: 0
SUM_SELECT_FULL_JOIN: 0
SUM_SELECT_RANGE: 1501840
SUM_SELECT_SCAN: 4
SUM_NO_INDEX_USED: 4
SUM_ROWS_SENT: 150872400
SUM_ROWS_EXAMINED: 152872000
...
Digests: Which Do Not Use Indexes?
31
© Copyright 2023 Percona ® LLC. All rights reserved
• Combined statistics
• events_statements_summary_by_account_by_event_name
• events_statements_summary_by_host_by_event_name
• events_statements_summary_by_thread_by_event_name
• events_statements_summary_by_user_by_event_name
• events_statements_summary_global_by_event_name
5.7+: events_statements_summary_by_program
Digest Tables
32
© Copyright 2023 Percona ® LLC. All rights reserved
• Combined statistics
• Histogram Summary
• events_statements_histogram_by_digest
• events_statements_histogram_global
• Do NOT mix with Optimizer histograms!
Digest Tables
33
© Copyright 2023 Percona ® LLC. All rights reserved
• Combined statistics
• Histogram Summary
• events_statements_summary_by_digest
• SCHEMA_NAME
• DIGEST
• DIGEST_TEXT
8.0+: QUERY_SAMPLE_TEXT
Digest Tables
34
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> select name from setup_consumers where name like ’%statement%’;
+--------------------------------+
| name |
+--------------------------------+
| events_statements_current | -- Current statements
| events_statements_history | -- Last 10 statements
| events_statements_history_long | -- Last 1K statements
| statements_digest | -- Digests
+--------------------------------+
4 rows in set (0.00 sec)
Statements Digests Configuration
35
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> SELECT query, total_latency, no_index_used_count, rows_sent,
-> rows_examined
-> FROM sys.statements_with_full_table_scans
-> WHERE db=’employees’ AND query NOT LIKE ’%performance_schema%’G
********************** 1. row **********************
query: SELECT COUNT ( ‘emp_no‘ ) FROM ... ‘emp_no‘ ) WHERE ‘title‘ = ?
total_latency: 805.37 ms
no_index_used_count: 1
rows_sent: 1
rows_examined: 397774
...
sys: Which Do Not Use Indexes?
36
© Copyright 2023 Percona ® LLC. All rights reserved
• statement_analysis
• statements_with_full_table_scans
• statements_with_runtimes_in_95th_percentile
• statements_with_sorting
• statements_with_temp_tables
• statements_with_errors_or_warnings
Important Views in sys Schema
37
© Copyright 2023 Percona ® LLC. All rights reserved
• Contains current prepared statements
Table prepared_statements_instances
38
© Copyright 2023 Percona ® LLC. All rights reserved
• Contains current prepared statements
• Statistics by
• Which thread owns the statement
• How many times executed
• Optimizer statistics, similar to
events_statements_*
Table prepared_statements_instances
39
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
statement/sql/prepare_sql
statement/sql/execute_sql
statement/com/Prepare
statement/com/Execute
Prepared Statements: configuration
40
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
• Consumers
• prepared_statements_instances
Prepared Statements: configuration
41
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
• Consumers
• Size
mysql> select @@performance_schema_max_prepared_statements_instancesG
*************************** 1. row ***************************
@@performance_schema_max_prepared_statements_instances: -1
1 row in set (0.00 sec)
Prepared Statements: configuration
42
© Copyright 2023 Percona ® LLC. All rights reserved
mysql1> prepare stmt from ’select count(*) from employees where hire_date > ?’;
Query OK, 0 rows affected (0.00 sec)
Statement prepared
mysql1> set @hd=’1995-01-01’;
Query OK, 0 rows affected (0.00 sec)
mysql1> execute stmt using @hd;
+----------+
| count(*) |
+----------+
| 34004 |
+----------+
1 row in set (1.44 sec)
Example: Prepared Statement
43
© Copyright 2023 Percona ® LLC. All rights reserved
mysql1> prepare stmt from ’select count(*) from employees where hire_date > ?’;
Query OK, 0 rows affected (0.00 sec)
Statement prepared
mysql1> set @hd=’1995-01-01’;
Query OK, 0 rows affected (0.00 sec)
mysql1> execute stmt using @hd;
+----------+
| count(*) |
+----------+
| 34004 |
+----------+
1 row in set (1.44 sec)
• Try EXECUTE with different values
Example: Prepared Statement
44
© Copyright 2023 Percona ® LLC. All rights reserved
mysql2> select statement_name, sql_text, owner_thread_id, count_reprepare,
-> count_execute, sum_timer_execute from prepared_statements_instancesG
*************************** 1. row ***************************
statement_name: stmt
sql_text: select count(*) from employees where hire_date > ?
owner_thread_id: 22
count_reprepare: 0
count_execute: 3
sum_timer_execute: 4156561368000
1 row in set (0.00 sec)
mysql1> drop prepare stmt;
Query OK, 0 rows affected (0.00 sec)
mysql2> select * from prepared_statements_instancesG
Empty set (0.00 sec)
Example: diagnosis
45
© Copyright 2023 Percona ® LLC. All rights reserved
• Instrumented instruction called
• Corresponding field updated
• Counter incremented
• Time recorded
• Query recorded
• ...
• More often you call instruction - higher
overhead!
How Performance Schema Works?
46
© Copyright 2023 Percona ® LLC. All rights reserved
Performance Schema Impact
47
© Copyright 2023 Percona ® LLC. All rights reserved
• Performance Schema triggers data
collection when hits event
• For statement instrumentation this
usually means once per statement
• Low impact
• GOOD TO HAVE
Statements Instrumentation: Impact
48
© Copyright 2023 Percona ® LLC. All rights reserved
• events_stages_* tables
Statements Deep Dive
49
© Copyright 2023 Percona ® LLC. All rights reserved
• events_stages_* tables
• Same information as in table
INFORMATION_SCHEMA.PROCESSLIST or SHOW
PROCESSLIST output
• init
• executing
• Opening tables
Statements Deep Dive
50
© Copyright 2023 Percona ® LLC. All rights reserved
• events_stages_* tables
• Same information as in table
INFORMATION_SCHEMA.PROCESSLIST or SHOW
PROCESSLIST output
• init
• executing
• Opening tables
• Replacement for SHOW PROFILE
Statements Deep Dive
51
© Copyright 2023 Percona ® LLC. All rights reserved
• events_stages_* tables
• Same information as in table
INFORMATION_SCHEMA.PROCESSLIST or SHOW
PROCESSLIST output
• init
• executing
• Opening tables
• Replacement for SHOW PROFILE
• Only server-level
• No storage engine information!
Statements Deep Dive
52
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
mysql> select name from setup_instruments where name like ’stage%’;
+----------------------------------------------------+
| name |
+----------------------------------------------------+
| stage/sql/After create |
| stage/sql/allocating local table |
| stage/sql/preparing for alter table |
| stage/sql/altering table |
| stage/sql/committing alter table to storage engine |
| stage/sql/Changing master |
| stage/sql/Checking master version |
...
• Enable those you want to examine
Stages: configuration
53
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
• Consumers
mysql> select name from setup_consumers where name like ’%stage%’;
+----------------------------+
| name |
+----------------------------+
| events_stages_current | -- Current stages
| events_stages_history | -- Last 10 stages
| events_stages_history_long | -- Last 1K stages
+----------------------------+
3 rows in set (0.00 sec)
Stages: configuration
54
© Copyright 2023 Percona ® LLC. All rights reserved
• Everything, related to temporary tables
• EVENT_NAME LIKE ’stage/sql/%tmp%’
• Everything, related to locks
• EVENT_NAME LIKE ’stage/sql/%lock%’
• Everything in state "Waiting for"
• EVENT_NAME LIKE ’stage/%/Waiting for%’
• Frequently met issues
Stages Shortcuts
55
© Copyright 2023 Percona ® LLC. All rights reserved
• Everything, related to temporary tables
• Everything, related to locks
• Everything in state "Waiting for"
• Frequently met issues
• EVENT_NAME=’stage/sql/freeing items’
• EVENT_NAME=’stage/sql/Sending data’
• EVENT_NAME=’stage/sql/cleaning up’
• EVENT_NAME=’stage/sql/closing tables’
• EVENT_NAME=’stage/sql/end’
Stages Shortcuts
56
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> SELECT eshl.event_name, sql_text, eshl.timer_wait/1000000000000 w_s
-> FROM performance_schema.events_stages_history_long eshl
-> JOIN performance_schema.events_statements_history_long esthl
-> ON (eshl.nesting_event_id = esthl.event_id)
-> WHERE eshl.timer_wait > 1*10000000000G
*************************** 1. row ***************************
event_name: stage/sql/Sending data
sql_text: SELECT COUNT(emp_no) FROM employees JOIN salaries USING(emp_no)
WHERE hire_date=from_date
w_s: 0.8170
1 row in set (0.00 sec)
Stages: Which Run Critically Long?
57
© Copyright 2023 Percona ® LLC. All rights reserved
• Calculated several times per query
• NICE TO HAVE
Stages Performance
58
© Copyright 2023 Percona ® LLC. All rights reserved
• Graphical interface
• Query statistics
• EXPLAIN
• Everything you need to tune your
queries!
Query Analytics (QAN) in PMM
59
© Copyright 2023 Percona ® LLC. All rights reserved
Example 1: QAN in PMM
60
© Copyright 2023 Percona ® LLC. All rights reserved
Example 2: QAN in PMM
61
© Copyright 2023 Percona ® LLC. All rights reserved
Example 3: QAN in PMM
62
© Copyright 2023 Percona ® LLC. All rights reserved
Example 4: QAN in PMM
63
© Copyright 2023 Percona ® LLC. All rights reserved
Example 5: QAN in PMM
64
© Copyright 2023 Percona ® LLC. All rights reserved
Example 6: QAN in PMM
65
© Copyright 2023 Percona ® LLC. All rights reserved
• Uses either slow query log of
Performance Schema statement
digests
• Same performance impact as for the
slow query log or Performance Schema
statement digests
• Nice GUI
• GOOD TO HAVE
Query Analytics (QAN) in PMM
66
© Copyright 2023 Percona ® LLC. All rights reserved
Concurrency
Transaction 1 Table Rows Transaction 2
Read 1 Read
2
Read 3
Read 4 Read
5 Read
6
Read 7 Read
Parallel Reads
68
© Copyright 2023 Percona ® LLC. All rights reserved
Transaction 1 Table Rows Transaction 2
Write 1 Read
2
Read 3
Write 4 Write
5 Read
6
Read 7 Write
Parallel Writes
69
© Copyright 2023 Percona ® LLC. All rights reserved
Transaction 1 Table Rows Transaction 2 MDL
Write 1 Read Conflict
2 Allowed
Read 3 Conflict
Write 4 Write Conflict
5 Read Conflict
6
Read 7 Write Conflict
Parallel DDL
70
© Copyright 2023 Percona ® LLC. All rights reserved
• Table METADATA_LOCKS in Performance
Schema
MDL Diagnostics
71
© Copyright 2023 Percona ® LLC. All rights reserved
• Table METADATA_LOCKS in Performance
Schema
• Which thread is waiting for a lock
MDL Diagnostics
72
© Copyright 2023 Percona ® LLC. All rights reserved
• Table METADATA_LOCKS in Performance
Schema
• Which thread is waiting for a lock
• Which thread holds the lock
MDL Diagnostics
73
© Copyright 2023 Percona ® LLC. All rights reserved
• Table METADATA_LOCKS in Performance
Schema
• Which thread is waiting for a lock
• Which thread holds the lock
• Not only for tables:
GLOBAL, SCHEMA, TABLE, FUNCTION, PROCEDURE, EVENT, COMMIT, USER LEVEL
LOCK, TABLESPACE
MDL Diagnostics
74
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
• wait/lock/metadata/sql/mdl
METADATA_LOCKS: configuration
75
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
• wait/lock/metadata/sql/mdl
• Consumers
• METADATA_LOCKS
METADATA_LOCKS: configuration
76
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> select processlist_id, object_type, lock_type, lock_status, source
-> from metadata_locks join threads on (owner_thread_id=thread_id)
-> where object_schema=’employees’ and object_name=’titles’G
*************************** 1. row ***************************
processlist_id: 4
object_type: TABLE
lock_type: EXCLUSIVE
lock_status: PENDING -- waits
source: mdl.cc:3263
*************************** 2. row ***************************
processlist_id: 5
object_type: TABLE
lock_type: SHARED_READ
lock_status: GRANTED -- holds
source: sql_parse.cc:5707
METADATA_LOCKS: example
77
© Copyright 2023 Percona ® LLC. All rights reserved
• Approximately once per statement
• Almost no impact
• MUST HAVE
METADATA_LOCKS: impact
78
© Copyright 2023 Percona ® LLC. All rights reserved
• Information about locks, held by engine
Table DATA_LOCKS
79
© Copyright 2023 Percona ® LLC. All rights reserved
• Information about locks, held by engine
• Only for engines with own locking
models
Table DATA_LOCKS
80
© Copyright 2023 Percona ® LLC. All rights reserved
• Information about locks, held by engine
• Only for engines with own locking
models
• Currently only InnoDB
Table DATA_LOCKS
81
© Copyright 2023 Percona ® LLC. All rights reserved
• Information about locks, held by engine
• Only for engines with own locking
models
• Currently only InnoDB
• Replacement for I_S tables
• INNODB_LOCKS
• INNODB_LOCK_WAITS
Table DATA_LOCKS
82
© Copyright 2023 Percona ® LLC. All rights reserved
• Which lock is held
*************************** 4. row ***************************
ENGINE: INNODB
ENGINE_LOCK_ID: 2408:0:393:2
ENGINE_TRANSACTION_ID: 2408
THREAD_ID: 34
OBJECT_SCHEMA: test
OBJECT_NAME: t
INDEX_NAME: PRIMARY
LOCK_TYPE: RECORD
LOCK_MODE: X
LOCK_STATUS: GRANTED
LOCK_DATA: 12345
Table DATA_LOCKS
83
© Copyright 2023 Percona ® LLC. All rights reserved
• Which lock is held
• Which lock is requested
*************************** 2. row ***************************
ENGINE: INNODB
ENGINE_LOCK_ID: 2409:0:393:2
ENGINE_TRANSACTION_ID: 2409
THREAD_ID: 36
OBJECT_SCHEMA: test
OBJECT_NAME: t
INDEX_NAME: PRIMARY
LOCK_TYPE: RECORD
LOCK_MODE: X
LOCK_STATUS: WAITING
LOCK_DATA: 12345
Table DATA_LOCKS
84
© Copyright 2023 Percona ® LLC. All rights reserved
• Which lock is held
• Which lock is requested
• Both record-level and table level
p_s> select * from data_locksG
*************************** 1. row ***************************
...
LOCK_TYPE: TABLE
LOCK_MODE: IX
LOCK_STATUS: GRANTED
LOCK_DATA: NULL
*************************** 2. row ***************************
...
LOCK_TYPE: RECORD
Table DATA_LOCKS
85
© Copyright 2023 Percona ® LLC. All rights reserved
• Maps lock waits with granted locks
Table DATA_LOCK_WAITS
86
© Copyright 2023 Percona ® LLC. All rights reserved
• Maps lock waits with granted locks
• Only granted blocking other
transactions
p_s> select ENGINE, ... from data_lock_waitsG
*************************** 1. row ***************************
ENGINE: INNODB
REQUESTING_ENGINE_LOCK_ID: 2409:0:393:2
REQUESTING_ENGINE_TRANSACTION_ID: 2409
REQUESTING_THREAD_ID: 36
BLOCKING_ENGINE_LOCK_ID: 2408:0:393:2
BLOCKING_ENGINE_TRANSACTION_ID: 2408
BLOCKING_THREAD_ID: 34
1 row in set (0,01 sec)
Table DATA_LOCK_WAITS
87
© Copyright 2023 Percona ® LLC. All rights reserved
• Partition
• Subpartition
• Lock data
• Requesting and blocking thread id
New in DATA_LOCKS, missed in I_S
88
© Copyright 2023 Percona ® LLC. All rights reserved
• View innodb_lock_waits
In sys Schema
89
© Copyright 2023 Percona ® LLC. All rights reserved
• View innodb_lock_waits
• Takes additional information from
INFORMATION_SCHEMA.INNODB_TRX
In sys Schema
90
© Copyright 2023 Percona ® LLC. All rights reserved
• View innodb_lock_waits
sys> select locked_table, ...
-> from innodb_lock_waitsG
*************************** 1. row ***************************
locked_table: ‘test‘.‘t‘ blocking_pid: 4
locked_index: PRIMARY blocking_query: NULL
locked_type: RECORD blocking_trx_rows_locked: 1
waiting_trx_rows_locked: 1 blocking_trx_rows_modified: 1
waiting_trx_rows_modified: 0 sql_kill_blocking_query: KILL QUERY 4
waiting_pid: 6 sql_kill_blocking_connection: KILL 4
waiting_query: UPDATE t SET f=’bar’ WHERE id=12345
In sys Schema
91
© Copyright 2023 Percona ® LLC. All rights reserved
Unlike most Performance Schema data collection,
there are no instruments for controlling whether data lock
information is collected or system variables for controlling
data lock table sizes. The Performance Schema collects
information that is already available in the server, so there
is no memory or CPU overhead to generate this informa-
tion or need for parameters that control its collection.
MySQL User Reference Manual
• MUST HAVE
Data Locks: Impact
92
© Copyright 2023 Percona ® LLC. All rights reserved
• All information about what is running
inside InnoDB
• Writes to file every 15 seconds
• Same information is available if run
SHOW ENGINE INNODB STATUS interactively
• Can generate a lot of data
• NICE TO HAVE
InnoDB Status File
93
© Copyright 2023 Percona ® LLC. All rights reserved
• Table INNODB_METRICS in Information
Schema
• All information about what is running
inside InnoDB
• Same information can be found in
SHOW ENGINE INNODB STATUS
• Easier to process
• NICE TO HAVE
INNODB_METRICS: InnoDB Monitor
94
© Copyright 2023 Percona ® LLC. All rights reserved
• Logs all deadlocks into the file
• Latest deadlock is visible in the
SHOW ENGINE INNODB STATUS
• Useful when debugging frequent
deadlocks
• NICE TO HAVE
InnoDB Deadlock Logger
95
© Copyright 2023 Percona ® LLC. All rights reserved
Hardware
• Memory, used by internal mysqld
structures
Memory Diagnostic in P_S
97
© Copyright 2023 Percona ® LLC. All rights reserved
• Memory, used by internal mysqld
structures
• Aggregated by
• Global
• Thread
• Account
• Host
• User
Memory Diagnostic in P_S
98
© Copyright 2023 Percona ® LLC. All rights reserved
• Memory, used by internal mysqld
structures
• Aggregated by
• Global
• Thread
• Account
• Host
• User
• Nice views in sys schema
Memory Diagnostic in P_S
99
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
mysql> select name from setup_instruments where name like ’memory%’;
+-----------------------------------------------------+
| name |
+-----------------------------------------------------+
...
| memory/sql/Gtid_state::group_commit_sidno_locks |
| memory/sql/Mutex_cond_array::Mutex_cond |
| memory/sql/TABLE_RULE_ENT |
| memory/sql/Rpl_info_table |
| memory/sql/Rpl_info_file::buffer |
| memory/sql/db_worker_hash_entry |
| memory/sql/rpl_slave::check_temp_dir |
| memory/sql/rpl_slave::command_buffer |
| memory/sql/binlog_ver_1_event |
| memory/sql/SLAVE_INFO |
...
Memory: configuration
100
© Copyright 2023 Percona ® LLC. All rights reserved
• Instruments
• Consumers
• Digest tables in Performance Schema
• Views in sys schema
Memory: configuration
101
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> select thread_id tid, user, current_allocated ca, total_allocated
-> from sys.memory_by_thread_by_current_bytes;
+-----+-------------------------+-------------+-----------------+
| tid | user | ca | total_allocated |
+-----+-------------------------+-------------+-----------------+
| 1 | sql/main | 2.53 GiB | 2.69 GiB |
| 150 | root@127.0.0.1 | 4.06 MiB | 32.17 MiB |
| 146 | sql/slave_sql | 1.31 MiB | 1.44 MiB |
| 145 | sql/slave_io | 1.08 MiB | 2.79 MiB |
...
| 60 | innodb/io_read_thread | 0 bytes | 384 bytes |
| 139 | innodb/srv_purge_thread | -328 bytes | 754.21 KiB |
| 69 | innodb/io_write_thread | -1008 bytes | 34.28 KiB |
| 68 | innodb/io_write_thread | -1440 bytes | 298.05 KiB |
| 74 | innodb/io_write_thread | -1656 bytes | 103.55 KiB |
| 4 | innodb/io_log_thread | -2880 bytes | 132.38 KiB |
| 72 | innodb/io_write_thread | -7632 bytes | 1.10 MiB |
+-----+-------------------------+-------------+-----------------+
145 rows in set (2.65 sec)
Memory Usage by Thread
102
© Copyright 2023 Percona ® LLC. All rights reserved
mysql> select * from sys.memory_by_thread_by_current_bytes
-> order by current_allocated descG
*************************** 1. row ***************************
thread_id: 152
user: lj@127.0.0.1
current_count_used: 325
current_allocated: 36.00 GiB
current_avg_alloc: 113.43 MiB
current_max_alloc: 36.00 GiB
total_allocated: 37.95 GiB
...
• Find threads, eating memory, in a
second!
Threads Statistics
103
© Copyright 2023 Percona ® LLC. All rights reserved
• 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
RAW Performance Schema tables
104
© Copyright 2023 Percona ® LLC. All rights reserved
• 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
• You must enable memory
instrumentation!
RAW Performance Schema tables
105
© Copyright 2023 Percona ® LLC. All rights reserved
• 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
• You must enable memory
instrumentation!
• sys schema includes user name
RAW Performance Schema tables
106
© Copyright 2023 Percona ® LLC. All rights reserved
• NAME@HOST - regular user
Users in sys.memory_* tables
107
© Copyright 2023 Percona ® LLC. All rights reserved
• NAME@HOST - regular user
• System users
• sql/main
• innodb/*
• ...
Users in sys.memory_* tables
108
© Copyright 2023 Percona ® LLC. All rights reserved
• NAME@HOST - regular user
• System users
• sql/main
• innodb/*
• ...
• Data comes from table THREADS
Users in sys.memory_* tables
109
© Copyright 2023 Percona ® LLC. All rights reserved
• When memory allocation happens
• Must be enabled before use
• If memory allocation is not
instrumented, it won’t be visible
• Not 100% reliable!
• Table itself holds little amount of
memory: low impact
• Finds source of memory leak
immediately!
• MUST HAVE
Memory Diagnostics: Impact
110
© Copyright 2023 Percona ® LLC. All rights reserved
• Operating system instruments
• Global status variables
• Engine status
• SHOW ENGINE INNODB STATUS
• Always available
IO Diagnostics
111
© Copyright 2023 Percona ® LLC. All rights reserved
• Dashboard Disk Details
IO Diagnostics in PMM
112
© Copyright 2023 Percona ® LLC. All rights reserved
• Dashboard MySQL InnoDB Details/InnoDB Disk IO
IO Diagnostics in PMM
113
© Copyright 2023 Percona ® LLC. All rights reserved
• Dashboard MySQL InnoDB Details/InnoDB Logging
IO Diagnostics in PMM
114
© Copyright 2023 Percona ® LLC. All rights reserved
• Operating system instruments
• top, atop, htop
• ps, pidstat
• mpstat
• iostat
CPU Diagnostics
115
© Copyright 2023 Percona ® LLC. All rights reserved
• Table THREADS in Performance Schema
mysql> select thread_id, processlist_id, thread_os_id, type, name from threads;
+-----------+----------------+--------------+------------+----------------------------------------+
| thread_id | processlist_id | thread_os_id | type | name |
+-----------+----------------+--------------+------------+----------------------------------------+
| 1 | NULL | 17983 | BACKGROUND | thread/sql/main |
| 2 | NULL | 17984 | BACKGROUND | thread/sql/thread_timer_notifier |
| 3 | NULL | 17985 | BACKGROUND | thread/innodb/io_ibuf_thread |
...
| 23 | 2 | 18009 | FOREGROUND | thread/sql/one_connection |
| 24 | 3 | 18011 | FOREGROUND | thread/sql/one_connection |
+-----------+----------------+--------------+------------+----------------------------------------+
CPU Diagnostics
116
© Copyright 2023 Percona ® LLC. All rights reserved
• Dashboard CPU Utilization Details
CPU Diagnostics in PMM
117
© Copyright 2023 Percona ® LLC. All rights reserved
• Dashboard MySQL Instance Summary
CPU Diagnostics in PMM
118
© Copyright 2023 Percona ® LLC. All rights reserved
• Dashboard MySQL InnoDB Details/InnoDB Contention/Misc
CPU Diagnostics in PMM
119
© Copyright 2023 Percona ® LLC. All rights reserved
• Dashboard MySQL InnoDB Details/MySQL Summary
CPU Diagnostics in PMM
120
© Copyright 2023 Percona ® LLC. All rights reserved
• Same as built-in and operating-system
instruments
• Provides nice GUI
• Helps to answer on questions where the
problem goes
• GOOD TO HAVE
IO and CPU in PMM: Impact
121
© Copyright 2023 Percona ® LLC. All rights reserved
• Error log file: do not rotate too often!
• Performance Schema
• METADATA_LOCKS
• DATA_LOCKS
• DATA_LOCK_WAITS
• Memory diagnostics
Must Have
122
© Copyright 2023 Percona ® LLC. All rights reserved
• Performance Schema
• Statements digests
• Prepared statements
• PMM
• QAN in PMM
Good to Have
123
© Copyright 2023 Percona ® LLC. All rights reserved
• Slow query log
• Performance Schema
• Statements
• Stages
• InnoDB
• Status file
• INNODB_METRICS
• Deadlock logger
Nice to Have
124
© Copyright 2023 Percona ® LLC. All rights reserved
PMM Demo
Performance Schema Benchmarks
References
125
© Copyright 2023 Percona ® LLC. All rights reserved
Thank you!
/svetsmirnova /svetasmirnova
/svetsmirnova /SvetaSmirnova

More Related Content

What's hot

ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevAltinity Ltd
 
Redo log improvements MYSQL 8.0
Redo log improvements MYSQL 8.0Redo log improvements MYSQL 8.0
Redo log improvements MYSQL 8.0Mydbops
 
Replication Troubleshooting in Classic VS GTID
Replication Troubleshooting in Classic VS GTIDReplication Troubleshooting in Classic VS GTID
Replication Troubleshooting in Classic VS GTIDMydbops
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바NeoClova
 
A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides Altinity Ltd
 
High Performance, High Reliability Data Loading on ClickHouse
High Performance, High Reliability Data Loading on ClickHouseHigh Performance, High Reliability Data Loading on ClickHouse
High Performance, High Reliability Data Loading on ClickHouseAltinity Ltd
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQLI Goo Lee
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB plc
 
Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceMariaDB plc
 
Altinity Quickstart for ClickHouse
Altinity Quickstart for ClickHouseAltinity Quickstart for ClickHouse
Altinity Quickstart for ClickHouseAltinity Ltd
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8Frederic Descamps
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performanceoysteing
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsJohn Beresniewicz
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep InternalEXEM
 
ProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewRené Cannaò
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBMydbops
 
Altinity Quickstart for ClickHouse-2202-09-15.pdf
Altinity Quickstart for ClickHouse-2202-09-15.pdfAltinity Quickstart for ClickHouse-2202-09-15.pdf
Altinity Quickstart for ClickHouse-2202-09-15.pdfAltinity Ltd
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxVinicius M Grippa
 

What's hot (20)

ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
 
Redo log improvements MYSQL 8.0
Redo log improvements MYSQL 8.0Redo log improvements MYSQL 8.0
Redo log improvements MYSQL 8.0
 
MySQL 5.5 Guide to InnoDB Status
MySQL 5.5 Guide to InnoDB StatusMySQL 5.5 Guide to InnoDB Status
MySQL 5.5 Guide to InnoDB Status
 
Replication Troubleshooting in Classic VS GTID
Replication Troubleshooting in Classic VS GTIDReplication Troubleshooting in Classic VS GTID
Replication Troubleshooting in Classic VS GTID
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바
 
A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides
 
High Performance, High Reliability Data Loading on ClickHouse
High Performance, High Reliability Data Loading on ClickHouseHigh Performance, High Reliability Data Loading on ClickHouse
High Performance, High Reliability Data Loading on ClickHouse
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & Optimization
 
Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performance
 
Altinity Quickstart for ClickHouse
Altinity Quickstart for ClickHouseAltinity Quickstart for ClickHouse
Altinity Quickstart for ClickHouse
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performance
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
 
How to Use JSON in MySQL Wrong
How to Use JSON in MySQL WrongHow to Use JSON in MySQL Wrong
How to Use JSON in MySQL Wrong
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep Internal
 
ProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management Overview
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
 
Altinity Quickstart for ClickHouse-2202-09-15.pdf
Altinity Quickstart for ClickHouse-2202-09-15.pdfAltinity Quickstart for ClickHouse-2202-09-15.pdf
Altinity Quickstart for ClickHouse-2202-09-15.pdf
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptx
 

Similar to MySQL Database Monitoring: Must, Good and Nice to Have

Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsZohar Elkayam
 
Scaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersScaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersJonathan Levin
 
Using PEM to understand and improve performance in Postgres: Postgres Tuning ...
Using PEM to understand and improve performance in Postgres: Postgres Tuning ...Using PEM to understand and improve performance in Postgres: Postgres Tuning ...
Using PEM to understand and improve performance in Postgres: Postgres Tuning ...EDB
 
GLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesGLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesBiju Thomas
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performanceEngine Yard
 
Performance & Scalability Improvements in Perforce
Performance & Scalability Improvements in PerforcePerformance & Scalability Improvements in Perforce
Performance & Scalability Improvements in PerforcePerforce
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Cloudera, Inc.
 
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!MongoDB
 
Real World Performance - Data Warehouses
Real World Performance - Data WarehousesReal World Performance - Data Warehouses
Real World Performance - Data WarehousesConnor McDonald
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...rschuppe
 
Presto At Treasure Data
Presto At Treasure DataPresto At Treasure Data
Presto At Treasure DataTaro L. Saito
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance TuningMark Swarbrick
 
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Transparent Data Encryption in PostgreSQL and Integration with Key Management...Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Transparent Data Encryption in PostgreSQL and Integration with Key Management...Masahiko Sawada
 
Fosdem managing my sql with percona toolkit
Fosdem managing my sql with percona toolkitFosdem managing my sql with percona toolkit
Fosdem managing my sql with percona toolkitFrederic Descamps
 
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 20161049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016panagenda
 
MySQL performance webinar
MySQL performance webinarMySQL performance webinar
MySQL performance webinarAbel Flórez
 

Similar to MySQL Database Monitoring: Must, Good and Nice to Have (20)

Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
 
Scaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersScaling MySQL Strategies for Developers
Scaling MySQL Strategies for Developers
 
Using PEM to understand and improve performance in Postgres: Postgres Tuning ...
Using PEM to understand and improve performance in Postgres: Postgres Tuning ...Using PEM to understand and improve performance in Postgres: Postgres Tuning ...
Using PEM to understand and improve performance in Postgres: Postgres Tuning ...
 
GLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesGLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New Features
 
My sql 5.6&MySQL Cluster 7.3
My sql 5.6&MySQL Cluster 7.3My sql 5.6&MySQL Cluster 7.3
My sql 5.6&MySQL Cluster 7.3
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
Performance & Scalability Improvements in Perforce
Performance & Scalability Improvements in PerforcePerformance & Scalability Improvements in Perforce
Performance & Scalability Improvements in Perforce
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive


 
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
 
Real World Performance - Data Warehouses
Real World Performance - Data WarehousesReal World Performance - Data Warehouses
Real World Performance - Data Warehouses
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
 
Presto At Treasure Data
Presto At Treasure DataPresto At Treasure Data
Presto At Treasure Data
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Transparent Data Encryption in PostgreSQL and Integration with Key Management...Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
 
Fosdem managing my sql with percona toolkit
Fosdem managing my sql with percona toolkitFosdem managing my sql with percona toolkit
Fosdem managing my sql with percona toolkit
 
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 20161049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
 
MySQL performance webinar
MySQL performance webinarMySQL performance webinar
MySQL performance webinar
 

More from Sveta Smirnova

MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?Sveta Smirnova
 
MySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersMySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersSveta Smirnova
 
MySQL Test Framework для поддержки клиентов и верификации багов
MySQL Test Framework для поддержки клиентов и верификации баговMySQL Test Framework для поддержки клиентов и верификации багов
MySQL Test Framework для поддержки клиентов и верификации баговSveta Smirnova
 
MySQL Cookbook: Recipes for Your Business
MySQL Cookbook: Recipes for Your BusinessMySQL Cookbook: Recipes for Your Business
MySQL Cookbook: Recipes for Your BusinessSveta Smirnova
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sSveta Smirnova
 
Производительность MySQL для DevOps
 Производительность MySQL для DevOps Производительность MySQL для DevOps
Производительность MySQL для DevOpsSveta Smirnova
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOpsSveta Smirnova
 
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB ClusterHow to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB ClusterSveta Smirnova
 
How to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsHow to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsSveta Smirnova
 
Modern solutions for modern database load: improvements in the latest MariaDB...
Modern solutions for modern database load: improvements in the latest MariaDB...Modern solutions for modern database load: improvements in the latest MariaDB...
Modern solutions for modern database load: improvements in the latest MariaDB...Sveta Smirnova
 
How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?Sveta Smirnova
 
Современному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
Современному хайлоду - современные решения: MySQL 8.0 и улучшения PerconaСовременному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
Современному хайлоду - современные решения: MySQL 8.0 и улучшения PerconaSveta Smirnova
 
How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraSveta Smirnova
 
How Safe is Asynchronous Master-Master Setup?
 How Safe is Asynchronous Master-Master Setup? How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?Sveta Smirnova
 
Introduction to MySQL Query Tuning for Dev[Op]s
Introduction to MySQL Query Tuning for Dev[Op]sIntroduction to MySQL Query Tuning for Dev[Op]s
Introduction to MySQL Query Tuning for Dev[Op]sSveta Smirnova
 
Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Sveta Smirnova
 
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...Sveta Smirnova
 
Что нужно знать о трёх топовых фичах MySQL
Что нужно знать  о трёх топовых фичах  MySQLЧто нужно знать  о трёх топовых фичах  MySQL
Что нужно знать о трёх топовых фичах MySQLSveta Smirnova
 
Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Sveta Smirnova
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 MinutesSveta Smirnova
 

More from Sveta Smirnova (20)

MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
MySQL 2024: Зачем переходить на MySQL 8, если в 5.х всё устраивает?
 
MySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersMySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for Developers
 
MySQL Test Framework для поддержки клиентов и верификации багов
MySQL Test Framework для поддержки клиентов и верификации баговMySQL Test Framework для поддержки клиентов и верификации багов
MySQL Test Framework для поддержки клиентов и верификации багов
 
MySQL Cookbook: Recipes for Your Business
MySQL Cookbook: Recipes for Your BusinessMySQL Cookbook: Recipes for Your Business
MySQL Cookbook: Recipes for Your Business
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]s
 
Производительность MySQL для DevOps
 Производительность MySQL для DevOps Производительность MySQL для DevOps
Производительность MySQL для DevOps
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOps
 
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB ClusterHow to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
 
How to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsHow to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tears
 
Modern solutions for modern database load: improvements in the latest MariaDB...
Modern solutions for modern database load: improvements in the latest MariaDB...Modern solutions for modern database load: improvements in the latest MariaDB...
Modern solutions for modern database load: improvements in the latest MariaDB...
 
How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?
 
Современному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
Современному хайлоду - современные решения: MySQL 8.0 и улучшения PerconaСовременному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
Современному хайлоду - современные решения: MySQL 8.0 и улучшения Percona
 
How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with Galera
 
How Safe is Asynchronous Master-Master Setup?
 How Safe is Asynchronous Master-Master Setup? How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?
 
Introduction to MySQL Query Tuning for Dev[Op]s
Introduction to MySQL Query Tuning for Dev[Op]sIntroduction to MySQL Query Tuning for Dev[Op]s
Introduction to MySQL Query Tuning for Dev[Op]s
 
Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?
 
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
A Billion Goods in a Few Categories: When Optimizer Histograms Help and When ...
 
Что нужно знать о трёх топовых фичах MySQL
Что нужно знать  о трёх топовых фичах  MySQLЧто нужно знать  о трёх топовых фичах  MySQL
Что нужно знать о трёх топовых фичах MySQL
 
Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?Billion Goods in Few Categories: How Histograms Save a Life?
Billion Goods in Few Categories: How Histograms Save a Life?
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
 

Recently uploaded

CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 

Recently uploaded (20)

CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 

MySQL Database Monitoring: Must, Good and Nice to Have

  • 1. MySQL Database Monitoring: Must, Good and Nice to Have Sveta Smirnova Principal Support Engineering Coordinator
  • 2. • MySQL Support Engineer • Author MySQL Troubleshooting MySQL Cookbook, 4th Edition • JSON UDF functions • FILTER clause for MySQL • Speaker • Percona Live, OOW, Fosdem, DevConf, HighLoad... Sveta Smirnova
  • 3. • Solving Support cases • Sometimes we cannot resolve the issue because necessary information was not collected in time • Reasons are • Lack of knowledge • Fear of performance impact • Let’s discuss what can help and for which price! Motivation 3 © Copyright 2023 Percona ® LLC. All rights reserved
  • 4. must Should be always ON Must-Good-Nice 4 © Copyright 2023 Percona ® LLC. All rights reserved
  • 5. must Should be always ON good Useful data, little effect on overall performance Must-Good-Nice 5 © Copyright 2023 Percona ® LLC. All rights reserved
  • 6. must Should be always ON good Useful data, little effect on overall performance nice May slow down database but very useful in certain situations Must-Good-Nice 6 © Copyright 2023 Percona ® LLC. All rights reserved
  • 7. 2023-05-16T12:44:14.776227Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: ’::’ port: 13020, socket: /tmp/mysqlx.1.sock 2023-05-16T12:44:14.776295Z 0 [System] [MY-010931] [Server] /home/sveta/Percona-Server-8.0.32-24/bin/mysqld: ready for connections. Version: ’8.0.32-24’ socket: ’/tmp/mysqld.1.sock’ port: 13000 Percona Server (GPL), Release 24, Revision e5c6e9d2. Error Log: Normal Operation 7 © Copyright 2023 Percona ® LLC. All rights reserved
  • 8. 2023-05-16T21:01:34.090936Z 0 [System] [MY-010116] [Server] /Percona-Server-8.0.32-24/bin/mysqld (mysqld 8.0.32-24) starting as process 2006397 2023-05-16T21:01:34.103406Z 0 [Warning] [MY-010091] [Server] Can’t create test file /Percona-Server-8.0.32-24/data/mysqld_tmp_file_case_insensitive_test.lower-test 2023-05-16T21:01:34.152150Z 0 [ERROR] [MY-010187] [Server] Could not open file ’/Percona-Server-8.0.32-24/data/Delly-7390.err’ for error logging: Permission denied 2023-05-16T21:01:34.152288Z 0 [ERROR] [MY-010119] [Server] Aborting 2023-05-16T21:01:34.152856Z 0 [System] [MY-010910] [Server] /Percona-Server-8.0.32-24/bin/mysqld: Shutdown complete (mysqld 8.0.32-24) Percona Server (GPL), Release 24, Revision e5c6e9d2-debug. Error Log: Immediate Answer 8 © Copyright 2023 Percona ® LLC. All rights reserved
  • 9. 2023-05-17T00:06:38.658777Z 11 [ERROR] [MY-012639] [InnoDB] Write to file ./test/joinit7.ibd failed at offset 80740352, 1048576 bytes should have been written, only 929792 were written. Operating system error number 28. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded. 2023-05-17T00:06:38.658801Z 11 [ERROR] [MY-012640] [InnoDB] Error number 28 means ’No space left on device’ 2023-05-17T00:06:38.658820Z 11 [Warning] [MY-012145] [InnoDB] Error while writing 4194304 zeroes to ./test/joinit7.ibd starting at offset 79691776 2023-05-17T00:06:38.669221Z 11 [ERROR] [MY-013132] [Server] The table ’joinit7’ is full Error Log: Invisible Issue 9 © Copyright 2023 Percona ® LLC. All rights reserved
  • 10. 2023-05-17T06:50:19.749143Z 0 [ERROR] InnoDB: Operating system error number 2 in a file operation. May 17 13:50:22 Delly mysqld[24814]: 2023-05-17T06:50:19.429496Z 0 [Note] InnoDB: Apply batch completed May 17 13:50:22 Delly mysqld[24814]: InnoDB: Progress in percent: 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 May 17 13:50:22 Delly mysqld[24814]: 2023-05-17T06:50:19.304439Z 0 [Note] InnoDB: Starting an apply batch of log records to the database... Error Log: "Unexpected" Corruption 10 © Copyright 2023 Percona ® LLC. All rights reserved
  • 11. • Always ON • Keep outside of data directory • Do not rotate too often • MUST HAVE Error Log: Best Practices 11 © Copyright 2023 Percona ® LLC. All rights reserved
  • 12. Database Performance Influencers 12 © Copyright 2023 Percona ® LLC. All rights reserved
  • 13. Database Performance Influencers 13 © Copyright 2023 Percona ® LLC. All rights reserved
  • 14. Query
  • 15. • Collects slow queries Slow Query Log 15 © Copyright 2023 Percona ® LLC. All rights reserved
  • 16. • Collects slow queries • Tunable parameters • long_query_time • log_slow_admin_statements • log_queries_not_using_indexes • min_examined_row_limit • log_slow_replica_statements Slow Query Log 16 © Copyright 2023 Percona ® LLC. All rights reserved
  • 17. • Collects slow queries • Tunable parameters • Tunable verbosity log_slow_extra log_slow_verbosity Slow Query Log 17 © Copyright 2023 Percona ® LLC. All rights reserved
  • 18. # Time: 2023-05-17T11:08:23.065564Z # User@Host: root[root] @ localhost [] Id: 29 # Schema: employees Last_errno: 0 Killed: 0 # Query_time: 0.003821 Lock_time: 0.000018 Rows_sent: 1 Rows_examined: 1 Rows_affected: 0 Bytess_sent: 187 SET timestamp=1684321703; SELECT * FROM ‘departments‘ WHERE dept_no=’d003’; Slow Query Log: minimal Verbosity 18 © Copyright 2023 Percona ® LLC. All rights reserved
  • 19. # Time: 2023-05-17T11:08:30.038499Z # User@Host: root[root] @ localhost [] Id: 29 # Schema: employees Last_errno: 0 Killed: 0 # Query_time: 0.001777 Lock_time: 0.000024 Rows_sent: 1 Rows_examined: 1 Rows_affected: 0 Bytes _sent: 187 # Tmp_tables: 0 Tmp_disk_tables: 0 Tmp_table_sizes: 0 # Full_scan: No Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 SET timestamp=1684321710; SELECT * FROM ‘departments‘ WHERE dept_no=’d003’; Slow Query Log: standard Verbosity 19 © Copyright 2023 Percona ® LLC. All rights reserved
  • 20. # Time: 2023-05-17T11:08:36.662992Z # User@Host: root[root] @ localhost [] Id: 29 # Schema: employees Last_errno: 0 Killed: 0 # Query_time: 0.002478 Lock_time: 0.000033 Rows_sent: 1 Rows_examined: 1 Rows_affected: 0 Bytes_sent: 187 # Tmp_tables: 0 Tmp_disk_tables: 0 Tmp_table_sizes: 0 # InnoDB_trx_id: 0 # Full_scan: No Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 # InnoDB_IO_r_ops: 0 InnoDB_IO_r_bytes: 0 InnoDB_IO_r_wait: 0.000000 # InnoDB_rec_lock_wait: 0.000000 InnoDB_queue_wait: 0.000000 # InnoDB_pages_distinct: 1 SET timestamp=1684321716; SELECT * FROM ‘departments‘ WHERE dept_no=’d003’; Slow Query Log: full Verbosity 20 © Copyright 2023 Percona ® LLC. All rights reserved
  • 21. # Time: 2023-05-17T11:08:43.170370Z # User@Host: root[root] @ localhost [] Id: 29 # Schema: employees Last_errno: 0 Killed: 0 # Query_time: 0.001809 Lock_time: 0.000020 Rows_sent: 1 Rows_examined: 1 Rows_affected: 0 Bytes_sent: 187 # Profile_starting: 0.000675 Profile_starting_cpu: 0.000405 Profile_Executing_hook_on_transaction_begin.: 0.000025 Profile_Executing_hook_on_transaction_begin._cpu: 0.000023 Profile_starting: 0.000046 Profile_starting_cpu: 0.000046 ... Profile_closing_tables_cpu: 0.000075 Profile_freeing_items: 0.000075 Profile_freeing_items_cpu: 0.000075 Profile_logging_slow_query: 0.000006 Profile_logging_slow_query_cpu: 0.000006 # Profile_total: 0.001829 Profile_total_cpu: 0.001556 SET timestamp=1684321723; SELECT * FROM ‘departments‘ WHERE dept_no=’d003’; Slow Query Log: profiling verbosity 21 © Copyright 2023 Percona ® LLC. All rights reserved
  • 22. # Profile # Rank Query ID Response time Calls R/Call V/M Item # ==== ================== ============= ===== ======= ===== ============== # 1 0x61C2A843B38413D1 63.1758 99.9% 4 15.7939 1.81 SELECT titles # 2 0x6B17FAAA0C13F2B4 0.0307 0.0% 11 0.0028 0.00 SELECT departments # 3 0x90C659E5DE65EC22 0.0174 0.0% 1 0.0174 0.00 SELECT information_... # 4 0xE3A3649C5FAC418D 0.0151 0.0% 21 0.0007 0.00 SELECT # 5 0x02BBA8FDF2596F42 0.0121 0.0% 2 0.0060 0.01 SELECT departments # MISC 0xMISC 0.0077 0.0% 13 0.0006 0.0 <4 ITEMS> ... Slow Query Log by pt_query_digest 22 © Copyright 2023 Percona ® LLC. All rights reserved
  • 23. # Query 2: 0.00 QPS, 0.00x concurrency, ID 0x6B17FAAA0C13F2B4 at byte 20896111 # Scores: V/M = 0.00 # Time range: 2023-05-17T10:27:00 to 2023-05-17T11:08:43 # Attribute pct total min max avg 95% stddev median # ============ === ======= ======= ======= ======= ======= ======= ======= # Count 21 11 # Exec time 0 31ms 1ms 10ms 3ms 4ms 2ms 2ms # Lock time 52 324us 17us 64us 29us 40us 12us 23us # Rows sent 12 10 0 1 0.91 0.99 0.29 0.99 ... # SHOW TABLE STATUS FROM ‘test‘ LIKE ’departments’G # SHOW CREATE TABLE ‘test‘.‘departments‘G # EXPLAIN /*!50100 PARTITIONS*/ SELECT * FROM ‘departments‘ WHERE dept_no=’d003’G Slow Query Log by pt_query_digest 23 © Copyright 2023 Percona ® LLC. All rights reserved
  • 24. • Can grow fast with long_query_time=0 • Does not depend on the database size • Depends on the query activity • Higher query rate - faster log growth • Safe to use with comparatively low load • For high load: plan log rotation • NICE TO HAVE Slow Query Log: Disk IO 24 © Copyright 2023 Percona ® LLC. All rights reserved
  • 25. • Statements events • Prepared statements • Statements digests • Stages events Performance Schema 25 © Copyright 2023 Percona ® LLC. All rights reserved
  • 26. • Examine more rows than return/change • Use disk instead of memory • Full table scan instead of index • This is not full list! Why statements are slow? 26 © Copyright 2023 Percona ® LLC. All rights reserved
  • 27. mysql> SELECT THREAD_ID TID, SUBSTR(SQL_TEXT, 1, 50) SQL_TEXT, ROWS_SENT RS, -> ROWS_EXAMINED RE,CREATED_TMP_TABLES,NO_INDEX_USED,NO_GOOD_INDEX_USED -> FROM performance_schema.events_statements_history -> WHERE NO_INDEX_USED=1 OR NO_GOOD_INDEX_USED=1G ********************** 1. row ********************** TID: 10124 SQL_TEXT: select emp_no, first_name, last_name from employee RS: 97750 RE: 397774 CREATED_TMP_TABLES: 0 NO_INDEX_USED: 1 NO_GOOD_INDEX_USED: 0 ... Which Queries Do Not Use Indexes? 27 © Copyright 2023 Percona ® LLC. All rights reserved
  • 28. mysql> select name from setup_instruments where name like ’statement%’; +-----------------------------------------------+ | name | +-----------------------------------------------+ | statement/sql/select | | statement/sql/create_table | | statement/sql/create_index | | statement/sql/alter_table | | statement/sql/update | | statement/sql/insert | | statement/sql/insert_select | ... Statements Configuration 28 © Copyright 2023 Percona ® LLC. All rights reserved
  • 29. mysql> select name from setup_consumers where name like ’%statement%’; +--------------------------------+ | name | +--------------------------------+ | events_statements_current | -- Current statements | events_statements_history | -- Last 10 statements | events_statements_history_long | -- Last 1K statements | statements_digest | -- Digests +--------------------------------+ 4 rows in set (0.00 sec) Statements Events Configuration 29 © Copyright 2023 Percona ® LLC. All rights reserved
  • 30. • CREATED_TMP_DISK_TABLES • CREATED_TMP_TABLES • SELECT_FULL_JOIN • SELECT_RANGE_CHECK • SELECT_SCAN • SORT_MERGE_PASSES • SORT_SCAN Important Field Names 30 © Copyright 2023 Percona ® LLC. All rights reserved
  • 31. mysql> select DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_CREATED_TMP_DISK_TABLES, -> SUM_SELECT_FULL_JOIN, SUM_SELECT_RANGE , SUM_SELECT_SCAN , SUM_NO_INDEX_USED, -> SUM_ROWS_SENT, SUM_ROWS_EXAMINED -> from events_statements_summary_by_digest where SUM_NO_INDEX_USED > 0G *************************** 1. row *************************** DIGEST: 3884185b07312b354c4918f2368d8fe2c431aeb8e39bf8ff5c3dcc6837 DIGEST_TEXT: SELECT ‘c‘ FROM ‘sbtest1‘ WHERE ‘id‘ BETWEEN ? AND ? COUNT_STAR: 1501791 SUM_CREATED_TMP_DISK_TABLES: 0 SUM_SELECT_FULL_JOIN: 0 SUM_SELECT_RANGE: 1501840 SUM_SELECT_SCAN: 4 SUM_NO_INDEX_USED: 4 SUM_ROWS_SENT: 150872400 SUM_ROWS_EXAMINED: 152872000 ... Digests: Which Do Not Use Indexes? 31 © Copyright 2023 Percona ® LLC. All rights reserved
  • 32. • Combined statistics • events_statements_summary_by_account_by_event_name • events_statements_summary_by_host_by_event_name • events_statements_summary_by_thread_by_event_name • events_statements_summary_by_user_by_event_name • events_statements_summary_global_by_event_name 5.7+: events_statements_summary_by_program Digest Tables 32 © Copyright 2023 Percona ® LLC. All rights reserved
  • 33. • Combined statistics • Histogram Summary • events_statements_histogram_by_digest • events_statements_histogram_global • Do NOT mix with Optimizer histograms! Digest Tables 33 © Copyright 2023 Percona ® LLC. All rights reserved
  • 34. • Combined statistics • Histogram Summary • events_statements_summary_by_digest • SCHEMA_NAME • DIGEST • DIGEST_TEXT 8.0+: QUERY_SAMPLE_TEXT Digest Tables 34 © Copyright 2023 Percona ® LLC. All rights reserved
  • 35. mysql> select name from setup_consumers where name like ’%statement%’; +--------------------------------+ | name | +--------------------------------+ | events_statements_current | -- Current statements | events_statements_history | -- Last 10 statements | events_statements_history_long | -- Last 1K statements | statements_digest | -- Digests +--------------------------------+ 4 rows in set (0.00 sec) Statements Digests Configuration 35 © Copyright 2023 Percona ® LLC. All rights reserved
  • 36. mysql> SELECT query, total_latency, no_index_used_count, rows_sent, -> rows_examined -> FROM sys.statements_with_full_table_scans -> WHERE db=’employees’ AND query NOT LIKE ’%performance_schema%’G ********************** 1. row ********************** query: SELECT COUNT ( ‘emp_no‘ ) FROM ... ‘emp_no‘ ) WHERE ‘title‘ = ? total_latency: 805.37 ms no_index_used_count: 1 rows_sent: 1 rows_examined: 397774 ... sys: Which Do Not Use Indexes? 36 © Copyright 2023 Percona ® LLC. All rights reserved
  • 37. • statement_analysis • statements_with_full_table_scans • statements_with_runtimes_in_95th_percentile • statements_with_sorting • statements_with_temp_tables • statements_with_errors_or_warnings Important Views in sys Schema 37 © Copyright 2023 Percona ® LLC. All rights reserved
  • 38. • Contains current prepared statements Table prepared_statements_instances 38 © Copyright 2023 Percona ® LLC. All rights reserved
  • 39. • Contains current prepared statements • Statistics by • Which thread owns the statement • How many times executed • Optimizer statistics, similar to events_statements_* Table prepared_statements_instances 39 © Copyright 2023 Percona ® LLC. All rights reserved
  • 41. • Instruments • Consumers • prepared_statements_instances Prepared Statements: configuration 41 © Copyright 2023 Percona ® LLC. All rights reserved
  • 42. • Instruments • Consumers • Size mysql> select @@performance_schema_max_prepared_statements_instancesG *************************** 1. row *************************** @@performance_schema_max_prepared_statements_instances: -1 1 row in set (0.00 sec) Prepared Statements: configuration 42 © Copyright 2023 Percona ® LLC. All rights reserved
  • 43. mysql1> prepare stmt from ’select count(*) from employees where hire_date > ?’; Query OK, 0 rows affected (0.00 sec) Statement prepared mysql1> set @hd=’1995-01-01’; Query OK, 0 rows affected (0.00 sec) mysql1> execute stmt using @hd; +----------+ | count(*) | +----------+ | 34004 | +----------+ 1 row in set (1.44 sec) Example: Prepared Statement 43 © Copyright 2023 Percona ® LLC. All rights reserved
  • 44. mysql1> prepare stmt from ’select count(*) from employees where hire_date > ?’; Query OK, 0 rows affected (0.00 sec) Statement prepared mysql1> set @hd=’1995-01-01’; Query OK, 0 rows affected (0.00 sec) mysql1> execute stmt using @hd; +----------+ | count(*) | +----------+ | 34004 | +----------+ 1 row in set (1.44 sec) • Try EXECUTE with different values Example: Prepared Statement 44 © Copyright 2023 Percona ® LLC. All rights reserved
  • 45. mysql2> select statement_name, sql_text, owner_thread_id, count_reprepare, -> count_execute, sum_timer_execute from prepared_statements_instancesG *************************** 1. row *************************** statement_name: stmt sql_text: select count(*) from employees where hire_date > ? owner_thread_id: 22 count_reprepare: 0 count_execute: 3 sum_timer_execute: 4156561368000 1 row in set (0.00 sec) mysql1> drop prepare stmt; Query OK, 0 rows affected (0.00 sec) mysql2> select * from prepared_statements_instancesG Empty set (0.00 sec) Example: diagnosis 45 © Copyright 2023 Percona ® LLC. All rights reserved
  • 46. • Instrumented instruction called • Corresponding field updated • Counter incremented • Time recorded • Query recorded • ... • More often you call instruction - higher overhead! How Performance Schema Works? 46 © Copyright 2023 Percona ® LLC. All rights reserved
  • 47. Performance Schema Impact 47 © Copyright 2023 Percona ® LLC. All rights reserved
  • 48. • Performance Schema triggers data collection when hits event • For statement instrumentation this usually means once per statement • Low impact • GOOD TO HAVE Statements Instrumentation: Impact 48 © Copyright 2023 Percona ® LLC. All rights reserved
  • 49. • events_stages_* tables Statements Deep Dive 49 © Copyright 2023 Percona ® LLC. All rights reserved
  • 50. • events_stages_* tables • Same information as in table INFORMATION_SCHEMA.PROCESSLIST or SHOW PROCESSLIST output • init • executing • Opening tables Statements Deep Dive 50 © Copyright 2023 Percona ® LLC. All rights reserved
  • 51. • events_stages_* tables • Same information as in table INFORMATION_SCHEMA.PROCESSLIST or SHOW PROCESSLIST output • init • executing • Opening tables • Replacement for SHOW PROFILE Statements Deep Dive 51 © Copyright 2023 Percona ® LLC. All rights reserved
  • 52. • events_stages_* tables • Same information as in table INFORMATION_SCHEMA.PROCESSLIST or SHOW PROCESSLIST output • init • executing • Opening tables • Replacement for SHOW PROFILE • Only server-level • No storage engine information! Statements Deep Dive 52 © Copyright 2023 Percona ® LLC. All rights reserved
  • 53. • Instruments mysql> select name from setup_instruments where name like ’stage%’; +----------------------------------------------------+ | name | +----------------------------------------------------+ | stage/sql/After create | | stage/sql/allocating local table | | stage/sql/preparing for alter table | | stage/sql/altering table | | stage/sql/committing alter table to storage engine | | stage/sql/Changing master | | stage/sql/Checking master version | ... • Enable those you want to examine Stages: configuration 53 © Copyright 2023 Percona ® LLC. All rights reserved
  • 54. • Instruments • Consumers mysql> select name from setup_consumers where name like ’%stage%’; +----------------------------+ | name | +----------------------------+ | events_stages_current | -- Current stages | events_stages_history | -- Last 10 stages | events_stages_history_long | -- Last 1K stages +----------------------------+ 3 rows in set (0.00 sec) Stages: configuration 54 © Copyright 2023 Percona ® LLC. All rights reserved
  • 55. • Everything, related to temporary tables • EVENT_NAME LIKE ’stage/sql/%tmp%’ • Everything, related to locks • EVENT_NAME LIKE ’stage/sql/%lock%’ • Everything in state "Waiting for" • EVENT_NAME LIKE ’stage/%/Waiting for%’ • Frequently met issues Stages Shortcuts 55 © Copyright 2023 Percona ® LLC. All rights reserved
  • 56. • Everything, related to temporary tables • Everything, related to locks • Everything in state "Waiting for" • Frequently met issues • EVENT_NAME=’stage/sql/freeing items’ • EVENT_NAME=’stage/sql/Sending data’ • EVENT_NAME=’stage/sql/cleaning up’ • EVENT_NAME=’stage/sql/closing tables’ • EVENT_NAME=’stage/sql/end’ Stages Shortcuts 56 © Copyright 2023 Percona ® LLC. All rights reserved
  • 57. mysql> SELECT eshl.event_name, sql_text, eshl.timer_wait/1000000000000 w_s -> FROM performance_schema.events_stages_history_long eshl -> JOIN performance_schema.events_statements_history_long esthl -> ON (eshl.nesting_event_id = esthl.event_id) -> WHERE eshl.timer_wait > 1*10000000000G *************************** 1. row *************************** event_name: stage/sql/Sending data sql_text: SELECT COUNT(emp_no) FROM employees JOIN salaries USING(emp_no) WHERE hire_date=from_date w_s: 0.8170 1 row in set (0.00 sec) Stages: Which Run Critically Long? 57 © Copyright 2023 Percona ® LLC. All rights reserved
  • 58. • Calculated several times per query • NICE TO HAVE Stages Performance 58 © Copyright 2023 Percona ® LLC. All rights reserved
  • 59. • Graphical interface • Query statistics • EXPLAIN • Everything you need to tune your queries! Query Analytics (QAN) in PMM 59 © Copyright 2023 Percona ® LLC. All rights reserved
  • 60. Example 1: QAN in PMM 60 © Copyright 2023 Percona ® LLC. All rights reserved
  • 61. Example 2: QAN in PMM 61 © Copyright 2023 Percona ® LLC. All rights reserved
  • 62. Example 3: QAN in PMM 62 © Copyright 2023 Percona ® LLC. All rights reserved
  • 63. Example 4: QAN in PMM 63 © Copyright 2023 Percona ® LLC. All rights reserved
  • 64. Example 5: QAN in PMM 64 © Copyright 2023 Percona ® LLC. All rights reserved
  • 65. Example 6: QAN in PMM 65 © Copyright 2023 Percona ® LLC. All rights reserved
  • 66. • Uses either slow query log of Performance Schema statement digests • Same performance impact as for the slow query log or Performance Schema statement digests • Nice GUI • GOOD TO HAVE Query Analytics (QAN) in PMM 66 © Copyright 2023 Percona ® LLC. All rights reserved
  • 68. Transaction 1 Table Rows Transaction 2 Read 1 Read 2 Read 3 Read 4 Read 5 Read 6 Read 7 Read Parallel Reads 68 © Copyright 2023 Percona ® LLC. All rights reserved
  • 69. Transaction 1 Table Rows Transaction 2 Write 1 Read 2 Read 3 Write 4 Write 5 Read 6 Read 7 Write Parallel Writes 69 © Copyright 2023 Percona ® LLC. All rights reserved
  • 70. Transaction 1 Table Rows Transaction 2 MDL Write 1 Read Conflict 2 Allowed Read 3 Conflict Write 4 Write Conflict 5 Read Conflict 6 Read 7 Write Conflict Parallel DDL 70 © Copyright 2023 Percona ® LLC. All rights reserved
  • 71. • Table METADATA_LOCKS in Performance Schema MDL Diagnostics 71 © Copyright 2023 Percona ® LLC. All rights reserved
  • 72. • Table METADATA_LOCKS in Performance Schema • Which thread is waiting for a lock MDL Diagnostics 72 © Copyright 2023 Percona ® LLC. All rights reserved
  • 73. • Table METADATA_LOCKS in Performance Schema • Which thread is waiting for a lock • Which thread holds the lock MDL Diagnostics 73 © Copyright 2023 Percona ® LLC. All rights reserved
  • 74. • Table METADATA_LOCKS in Performance Schema • Which thread is waiting for a lock • Which thread holds the lock • Not only for tables: GLOBAL, SCHEMA, TABLE, FUNCTION, PROCEDURE, EVENT, COMMIT, USER LEVEL LOCK, TABLESPACE MDL Diagnostics 74 © Copyright 2023 Percona ® LLC. All rights reserved
  • 75. • Instruments • wait/lock/metadata/sql/mdl METADATA_LOCKS: configuration 75 © Copyright 2023 Percona ® LLC. All rights reserved
  • 76. • Instruments • wait/lock/metadata/sql/mdl • Consumers • METADATA_LOCKS METADATA_LOCKS: configuration 76 © Copyright 2023 Percona ® LLC. All rights reserved
  • 77. mysql> select processlist_id, object_type, lock_type, lock_status, source -> from metadata_locks join threads on (owner_thread_id=thread_id) -> where object_schema=’employees’ and object_name=’titles’G *************************** 1. row *************************** processlist_id: 4 object_type: TABLE lock_type: EXCLUSIVE lock_status: PENDING -- waits source: mdl.cc:3263 *************************** 2. row *************************** processlist_id: 5 object_type: TABLE lock_type: SHARED_READ lock_status: GRANTED -- holds source: sql_parse.cc:5707 METADATA_LOCKS: example 77 © Copyright 2023 Percona ® LLC. All rights reserved
  • 78. • Approximately once per statement • Almost no impact • MUST HAVE METADATA_LOCKS: impact 78 © Copyright 2023 Percona ® LLC. All rights reserved
  • 79. • Information about locks, held by engine Table DATA_LOCKS 79 © Copyright 2023 Percona ® LLC. All rights reserved
  • 80. • Information about locks, held by engine • Only for engines with own locking models Table DATA_LOCKS 80 © Copyright 2023 Percona ® LLC. All rights reserved
  • 81. • Information about locks, held by engine • Only for engines with own locking models • Currently only InnoDB Table DATA_LOCKS 81 © Copyright 2023 Percona ® LLC. All rights reserved
  • 82. • Information about locks, held by engine • Only for engines with own locking models • Currently only InnoDB • Replacement for I_S tables • INNODB_LOCKS • INNODB_LOCK_WAITS Table DATA_LOCKS 82 © Copyright 2023 Percona ® LLC. All rights reserved
  • 83. • Which lock is held *************************** 4. row *************************** ENGINE: INNODB ENGINE_LOCK_ID: 2408:0:393:2 ENGINE_TRANSACTION_ID: 2408 THREAD_ID: 34 OBJECT_SCHEMA: test OBJECT_NAME: t INDEX_NAME: PRIMARY LOCK_TYPE: RECORD LOCK_MODE: X LOCK_STATUS: GRANTED LOCK_DATA: 12345 Table DATA_LOCKS 83 © Copyright 2023 Percona ® LLC. All rights reserved
  • 84. • Which lock is held • Which lock is requested *************************** 2. row *************************** ENGINE: INNODB ENGINE_LOCK_ID: 2409:0:393:2 ENGINE_TRANSACTION_ID: 2409 THREAD_ID: 36 OBJECT_SCHEMA: test OBJECT_NAME: t INDEX_NAME: PRIMARY LOCK_TYPE: RECORD LOCK_MODE: X LOCK_STATUS: WAITING LOCK_DATA: 12345 Table DATA_LOCKS 84 © Copyright 2023 Percona ® LLC. All rights reserved
  • 85. • Which lock is held • Which lock is requested • Both record-level and table level p_s> select * from data_locksG *************************** 1. row *************************** ... LOCK_TYPE: TABLE LOCK_MODE: IX LOCK_STATUS: GRANTED LOCK_DATA: NULL *************************** 2. row *************************** ... LOCK_TYPE: RECORD Table DATA_LOCKS 85 © Copyright 2023 Percona ® LLC. All rights reserved
  • 86. • Maps lock waits with granted locks Table DATA_LOCK_WAITS 86 © Copyright 2023 Percona ® LLC. All rights reserved
  • 87. • Maps lock waits with granted locks • Only granted blocking other transactions p_s> select ENGINE, ... from data_lock_waitsG *************************** 1. row *************************** ENGINE: INNODB REQUESTING_ENGINE_LOCK_ID: 2409:0:393:2 REQUESTING_ENGINE_TRANSACTION_ID: 2409 REQUESTING_THREAD_ID: 36 BLOCKING_ENGINE_LOCK_ID: 2408:0:393:2 BLOCKING_ENGINE_TRANSACTION_ID: 2408 BLOCKING_THREAD_ID: 34 1 row in set (0,01 sec) Table DATA_LOCK_WAITS 87 © Copyright 2023 Percona ® LLC. All rights reserved
  • 88. • Partition • Subpartition • Lock data • Requesting and blocking thread id New in DATA_LOCKS, missed in I_S 88 © Copyright 2023 Percona ® LLC. All rights reserved
  • 89. • View innodb_lock_waits In sys Schema 89 © Copyright 2023 Percona ® LLC. All rights reserved
  • 90. • View innodb_lock_waits • Takes additional information from INFORMATION_SCHEMA.INNODB_TRX In sys Schema 90 © Copyright 2023 Percona ® LLC. All rights reserved
  • 91. • View innodb_lock_waits sys> select locked_table, ... -> from innodb_lock_waitsG *************************** 1. row *************************** locked_table: ‘test‘.‘t‘ blocking_pid: 4 locked_index: PRIMARY blocking_query: NULL locked_type: RECORD blocking_trx_rows_locked: 1 waiting_trx_rows_locked: 1 blocking_trx_rows_modified: 1 waiting_trx_rows_modified: 0 sql_kill_blocking_query: KILL QUERY 4 waiting_pid: 6 sql_kill_blocking_connection: KILL 4 waiting_query: UPDATE t SET f=’bar’ WHERE id=12345 In sys Schema 91 © Copyright 2023 Percona ® LLC. All rights reserved
  • 92. Unlike most Performance Schema data collection, there are no instruments for controlling whether data lock information is collected or system variables for controlling data lock table sizes. The Performance Schema collects information that is already available in the server, so there is no memory or CPU overhead to generate this informa- tion or need for parameters that control its collection. MySQL User Reference Manual • MUST HAVE Data Locks: Impact 92 © Copyright 2023 Percona ® LLC. All rights reserved
  • 93. • All information about what is running inside InnoDB • Writes to file every 15 seconds • Same information is available if run SHOW ENGINE INNODB STATUS interactively • Can generate a lot of data • NICE TO HAVE InnoDB Status File 93 © Copyright 2023 Percona ® LLC. All rights reserved
  • 94. • Table INNODB_METRICS in Information Schema • All information about what is running inside InnoDB • Same information can be found in SHOW ENGINE INNODB STATUS • Easier to process • NICE TO HAVE INNODB_METRICS: InnoDB Monitor 94 © Copyright 2023 Percona ® LLC. All rights reserved
  • 95. • Logs all deadlocks into the file • Latest deadlock is visible in the SHOW ENGINE INNODB STATUS • Useful when debugging frequent deadlocks • NICE TO HAVE InnoDB Deadlock Logger 95 © Copyright 2023 Percona ® LLC. All rights reserved
  • 97. • Memory, used by internal mysqld structures Memory Diagnostic in P_S 97 © Copyright 2023 Percona ® LLC. All rights reserved
  • 98. • Memory, used by internal mysqld structures • Aggregated by • Global • Thread • Account • Host • User Memory Diagnostic in P_S 98 © Copyright 2023 Percona ® LLC. All rights reserved
  • 99. • Memory, used by internal mysqld structures • Aggregated by • Global • Thread • Account • Host • User • Nice views in sys schema Memory Diagnostic in P_S 99 © Copyright 2023 Percona ® LLC. All rights reserved
  • 100. • Instruments mysql> select name from setup_instruments where name like ’memory%’; +-----------------------------------------------------+ | name | +-----------------------------------------------------+ ... | memory/sql/Gtid_state::group_commit_sidno_locks | | memory/sql/Mutex_cond_array::Mutex_cond | | memory/sql/TABLE_RULE_ENT | | memory/sql/Rpl_info_table | | memory/sql/Rpl_info_file::buffer | | memory/sql/db_worker_hash_entry | | memory/sql/rpl_slave::check_temp_dir | | memory/sql/rpl_slave::command_buffer | | memory/sql/binlog_ver_1_event | | memory/sql/SLAVE_INFO | ... Memory: configuration 100 © Copyright 2023 Percona ® LLC. All rights reserved
  • 101. • Instruments • Consumers • Digest tables in Performance Schema • Views in sys schema Memory: configuration 101 © Copyright 2023 Percona ® LLC. All rights reserved
  • 102. mysql> select thread_id tid, user, current_allocated ca, total_allocated -> from sys.memory_by_thread_by_current_bytes; +-----+-------------------------+-------------+-----------------+ | tid | user | ca | total_allocated | +-----+-------------------------+-------------+-----------------+ | 1 | sql/main | 2.53 GiB | 2.69 GiB | | 150 | root@127.0.0.1 | 4.06 MiB | 32.17 MiB | | 146 | sql/slave_sql | 1.31 MiB | 1.44 MiB | | 145 | sql/slave_io | 1.08 MiB | 2.79 MiB | ... | 60 | innodb/io_read_thread | 0 bytes | 384 bytes | | 139 | innodb/srv_purge_thread | -328 bytes | 754.21 KiB | | 69 | innodb/io_write_thread | -1008 bytes | 34.28 KiB | | 68 | innodb/io_write_thread | -1440 bytes | 298.05 KiB | | 74 | innodb/io_write_thread | -1656 bytes | 103.55 KiB | | 4 | innodb/io_log_thread | -2880 bytes | 132.38 KiB | | 72 | innodb/io_write_thread | -7632 bytes | 1.10 MiB | +-----+-------------------------+-------------+-----------------+ 145 rows in set (2.65 sec) Memory Usage by Thread 102 © Copyright 2023 Percona ® LLC. All rights reserved
  • 103. mysql> select * from sys.memory_by_thread_by_current_bytes -> order by current_allocated descG *************************** 1. row *************************** thread_id: 152 user: lj@127.0.0.1 current_count_used: 325 current_allocated: 36.00 GiB current_avg_alloc: 113.43 MiB current_max_alloc: 36.00 GiB total_allocated: 37.95 GiB ... • Find threads, eating memory, in a second! Threads Statistics 103 © Copyright 2023 Percona ® LLC. All rights reserved
  • 104. • 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 RAW Performance Schema tables 104 © Copyright 2023 Percona ® LLC. All rights reserved
  • 105. • 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 • You must enable memory instrumentation! RAW Performance Schema tables 105 © Copyright 2023 Percona ® LLC. All rights reserved
  • 106. • 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 • You must enable memory instrumentation! • sys schema includes user name RAW Performance Schema tables 106 © Copyright 2023 Percona ® LLC. All rights reserved
  • 107. • NAME@HOST - regular user Users in sys.memory_* tables 107 © Copyright 2023 Percona ® LLC. All rights reserved
  • 108. • NAME@HOST - regular user • System users • sql/main • innodb/* • ... Users in sys.memory_* tables 108 © Copyright 2023 Percona ® LLC. All rights reserved
  • 109. • NAME@HOST - regular user • System users • sql/main • innodb/* • ... • Data comes from table THREADS Users in sys.memory_* tables 109 © Copyright 2023 Percona ® LLC. All rights reserved
  • 110. • When memory allocation happens • Must be enabled before use • If memory allocation is not instrumented, it won’t be visible • Not 100% reliable! • Table itself holds little amount of memory: low impact • Finds source of memory leak immediately! • MUST HAVE Memory Diagnostics: Impact 110 © Copyright 2023 Percona ® LLC. All rights reserved
  • 111. • Operating system instruments • Global status variables • Engine status • SHOW ENGINE INNODB STATUS • Always available IO Diagnostics 111 © Copyright 2023 Percona ® LLC. All rights reserved
  • 112. • Dashboard Disk Details IO Diagnostics in PMM 112 © Copyright 2023 Percona ® LLC. All rights reserved
  • 113. • Dashboard MySQL InnoDB Details/InnoDB Disk IO IO Diagnostics in PMM 113 © Copyright 2023 Percona ® LLC. All rights reserved
  • 114. • Dashboard MySQL InnoDB Details/InnoDB Logging IO Diagnostics in PMM 114 © Copyright 2023 Percona ® LLC. All rights reserved
  • 115. • Operating system instruments • top, atop, htop • ps, pidstat • mpstat • iostat CPU Diagnostics 115 © Copyright 2023 Percona ® LLC. All rights reserved
  • 116. • Table THREADS in Performance Schema mysql> select thread_id, processlist_id, thread_os_id, type, name from threads; +-----------+----------------+--------------+------------+----------------------------------------+ | thread_id | processlist_id | thread_os_id | type | name | +-----------+----------------+--------------+------------+----------------------------------------+ | 1 | NULL | 17983 | BACKGROUND | thread/sql/main | | 2 | NULL | 17984 | BACKGROUND | thread/sql/thread_timer_notifier | | 3 | NULL | 17985 | BACKGROUND | thread/innodb/io_ibuf_thread | ... | 23 | 2 | 18009 | FOREGROUND | thread/sql/one_connection | | 24 | 3 | 18011 | FOREGROUND | thread/sql/one_connection | +-----------+----------------+--------------+------------+----------------------------------------+ CPU Diagnostics 116 © Copyright 2023 Percona ® LLC. All rights reserved
  • 117. • Dashboard CPU Utilization Details CPU Diagnostics in PMM 117 © Copyright 2023 Percona ® LLC. All rights reserved
  • 118. • Dashboard MySQL Instance Summary CPU Diagnostics in PMM 118 © Copyright 2023 Percona ® LLC. All rights reserved
  • 119. • Dashboard MySQL InnoDB Details/InnoDB Contention/Misc CPU Diagnostics in PMM 119 © Copyright 2023 Percona ® LLC. All rights reserved
  • 120. • Dashboard MySQL InnoDB Details/MySQL Summary CPU Diagnostics in PMM 120 © Copyright 2023 Percona ® LLC. All rights reserved
  • 121. • Same as built-in and operating-system instruments • Provides nice GUI • Helps to answer on questions where the problem goes • GOOD TO HAVE IO and CPU in PMM: Impact 121 © Copyright 2023 Percona ® LLC. All rights reserved
  • 122. • Error log file: do not rotate too often! • Performance Schema • METADATA_LOCKS • DATA_LOCKS • DATA_LOCK_WAITS • Memory diagnostics Must Have 122 © Copyright 2023 Percona ® LLC. All rights reserved
  • 123. • Performance Schema • Statements digests • Prepared statements • PMM • QAN in PMM Good to Have 123 © Copyright 2023 Percona ® LLC. All rights reserved
  • 124. • Slow query log • Performance Schema • Statements • Stages • InnoDB • Status file • INNODB_METRICS • Deadlock logger Nice to Have 124 © Copyright 2023 Percona ® LLC. All rights reserved
  • 125. PMM Demo Performance Schema Benchmarks References 125 © Copyright 2023 Percona ® LLC. All rights reserved