SlideShare a Scribd company logo
1 of 69
Download to read offline
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Basic MySQL Troubleshooting 
for Oracle DBAs 
Sveta Smirnova 
Senior Principal Technical Support Engineer 
MySQL Support 
September 29, 2014 
Copyright © 2014, Oracle and/or its affiliates. All rriigghhttss rreesseerrvveedd.. ||
Safe Harbor Statement 
The following is intended to outline our general product direction. It is intended for 
information purposes only, and may not be incorporated into any contract. It is not a 
commitment to deliver any material, code, or functionality, and should not be relied upon 
in making purchasing decisions. The development, release, and timing of any features or 
functionality described for Oracle’s products remains at the sole discretion of Oracle. 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Program Agenda 
Introduction 
Basic troubleshooting techniques 
High concurrency issues 
High availability solutions 
More information 
1 
2 
3 
4 
5
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Introduction
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL architecture 
Click icon to add picture 
Base 
- Installation layout 
- Log files 
Connectors 
- Clients 
- APIs 
Optimizer 
Caches & buffers 
Storage engines 
Management
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Typical installation layout 
• datadir 
– Schema directory 
– Table files: *frm, *ibd, *MYD, *MYI, *par, etc. 
– Trigger files 
– Schema 
– … 
– InnoDB shared tablespace 
– Log files 
– InnoDB log files 
– Binary, relay logs 
– Error log 
– Slow query log 
– General query log 
Configurable 
You can setup custom path for each 
component 
Including custom path for tables
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Connectors 
The way you connect to MySQL Server 
• Clients 
–MySQL CLI 
–MySQL Workbench 
–MySQL Enterprise Monitor (MEM) 
–Oracle Enterprise Manager with MEM plugin 
• APIs 
–Exist for most popular programming languages 
–C, C++, JDBC, PHP, Python, Net, ODBC
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Plugins 
MySQL Server is highly configurable via plugins 
• Storage engines 
• Full-text parsers 
• Daemon 
• INFORMATION_SCHEMA 
• Semisynchronous Replication 
• Audit 
• Authentication 
• Password-validation 
• Protocol Trace 
5.7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Storage engines 
From troubleshooting point of view 
• Own data 
• Own index format 
• Own locking model 
• Own diagnostic 
• Own log files 
• CHECK TABLE
Basic troubleshooting techniques 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
MySQL Access Privilege System 
• Privileged client cannot connect 
• Unprivileged client can connect 
• Privileged user cannot perform operation 
• Unprivileged user has undesired access 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Typical issues
MySQL Access Privilege System 
Overview 
• No roles by default, limited user limits 
• All records are in the mysql database (schema) 
• Pluggable authentication since version 5.5 
• Connections 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
● TCP/IP with login-password 
● Socket (Unix) 
● Named pipe (Windows)
MySQL Access Privilege System 
select user, host from mysql.user order by user 
desc, host desc; 
• Most descriptive host first, then wildcard 
• Socket connection by default on Unix 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Where to find out why you have connection issues?
MySQL Access Privilege System 
mysql> select user, host from mysql.user order by user desc, host desc; 
+------+------------+ 
| user | host | 
+------+------------+ 
| root | localhost | 
| root | delly | 
| root | ::1 | 
| root | 127.0.0.1 | 
| foo | % | 
| | localhost | 
+------+------------+ 
6 rows in set (0.00 sec) 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Where to find out why you have connection issues?
MySQL Access Privilege System 
Wrong access 
SHOW GRANTS [FOR user@host] 
• Grant tables 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
● mysql.db 
● mysql.tables_priv 
● mysql.columns_priv 
● mysql.procs_priv 
● mysql.proxies_priv 
SELECT USER(), CURRENT_USER()
MySQL Access Privilege System 
mysql> show grants; 
+--------------------------------------------------------------------+ 
| Grants for root@localhost | 
+--------------------------------------------------------------------+ 
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION| 
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION | 
+--------------------------------------------------------------------+ 
2 rows in set (0.02 sec) 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Wrong access
MySQL Access Privilege System 
mysql> show grants for foo@'%'; 
+-----------------------------------------------------+ 
| Grants for foo@% | 
+-----------------------------------------------------+ 
| GRANT USAGE ON *.* TO 'foo'@'%' | 
| GRANT ALL PRIVILEGES ON `test`.* TO 'foo'@'%' | 
+-----------------------------------------------------+ 
2 rows in set (0.02 sec) 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Wrong access
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Error handling 
Errors vs warnings 
mysql> select max (f1) from t1; 
ERROR 1630 (42000): FUNCTION test.max does not exist. Check the 
'Function Name Parsing and Resolution' section in the Reference Manual 
mysql> select * from t1 where "f1"=1; 
Empty set, 1 warning (0.05 sec) 
mysql> show warnings; 
+-----------+--------+----------------------------------------------------+ 
| Level | Code | Message | 
+-----------+--------+----------------------------------------------------+ 
| Warning | 1292 | Truncated incorrect DOUBLE value: 'f1' | 
+-----------+--------+----------------------------------------------------+ 
1 row in set (0.00 sec)
MySQL Access Privilege System 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Application (C API) 
• Error information 
● mysql_errno 
● mysql_error 
• Warnings 
● mysql_info 
● mysql_sqlstate 
● mysql_warning_count
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Error handling 
perror 
[sveta@delly ~]$ perror 1630 
MySQL error code 1630 (ER_FUNC_INEXISTENT_NAME_COLLISION): 
FUNCTION %s does not exist. Check the 'Function Name Parsing and 
Resolution' section in the Reference Manual 
[sveta@delly ~]$ perror 1292 
MySQL error code 1292 (ER_TRUNCATED_WRONG_VALUE): Truncated 
incorrect %.32s value: '%.128s' 
[sveta@delly ~]$ perror 2 
OS error code 2: No such file or directory 
[sveta@delly ~]$ perror 150 
MySQL error code 150: Foreign key constraint is incorrectly formed
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Error handling 
In stored routines 
● GET DIAGNOSTICS 
● GET DIAGNOSTICS rows = ROW_COUNT, conditions = NUMBER; 
● GET DIAGNOSTICS CONDITION 1 code = RETURNED_SQLSTATE, 
msg = MESSAGE_TEXT; 
● http://dev.mysql.com/doc/refman/5.6/en/diagnostics-area.html
What can affect query execution? 
You run a query, it does not return an error, but still behaves not as expected 
• Startup options or system variables 
• How optimizer creates query plan 
• Storage engine used 
• Parallel execution next section 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
System variables and startup options 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Scope 
• Global 
● Control parameters, necessary for all server processes 
– Location of server files: datadir etc. 
– Shared buffers 
– More 
• Session 
● Control connection-specific parameters 
• http://dev.mysql.com/doc/refman/5.6/en/mysqld-option-tables.html
System variables and startup options 
• SET [GLOBAL] var_name = NEW_VAL 
• Command line option 
• Configuration file 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
● In default location 
– http://dev.mysql.com/doc/refman/5.6/en/option-files.html 
● Specified by option ­-- 
defaults-file 
How to set
System variables and startup options 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Who can change 
• Global options and few session options 
● A user with privilege SUPER 
• Session options 
● Anybody 
• There is no limits!
System variables and startup options 
When allocated 
• Those which control behavior of whole server 
● Once at server startup 
● Can start with low values, then grow to specified 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
• Connection options 
● For every connection when connection opens 
• Operation-specific 
● For every operation when needed
System variables and startup options 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
How to control 
• SHOW [GLOBAL] STATUS 
• GLOBAL 
● Since server start 
• SESSION 
● For operations in current session 
● Can be reset 
– FLUSH STATUS
System variables and startup options 
How to control 
mysql> show global status like 'Handler_read_rnd_next'G 
*************************** 1. row *************************** 
Variable_name: Handler_read_rnd_next 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Value: 27 
1 row in set (0.00 sec) 
mysql> show status like 'Handler_read_rnd_next'G 
*************************** 1. row *************************** 
Variable_name: Handler_read_rnd_next 
Value: 7 
1 row in set (0.00 sec)
System variables and startup options 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Troubleshooting best practices 
• Record currently used variables 
● SHOW [GLOBAL] VARIABLES 
• Make change dynamically if possible 
● SET [GLOBAL] var_name=NEW_VAL 
• Test in one session first 
• Then change global variable 
• Change configuration file after you are happy with results
System variables and startup options 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
When affecting option is not known 
• Record currently used variables 
● SHOW [GLOBAL] VARIABLES 
• Start mysqld with option --no-defaults 
● This option must be first one! 
• Check if problem is solved 
• Change variable values one-by-one until you find one which leads to the 
problem
Diagnostic tool: INFORMATION_SCHEMA 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
When affecting option is not known 
• Contain metadata information 
● Tables 
● Indexes 
● Other 
• Allows to create plugins 
● InnoDB plugins 
– We will discuss them later 
• Oracle analog 
● Data Dictionary Views
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL Optimizer 
Overview 
• EXPLAIN is less powerful if compare with Oracle 
● It is improved in version 5.7.3 
● Graphic EXPLAIN in MySQL Workbench 6.0 
• EXPLAIN EXTENDED 
• EXPLAIN PARTITIONS 
• EXPLAIN FORMAT=JSON 
• INFORMATION_SCHEMA.TRACE 
• Status variables 'Handler_%' 
Default in 5.7
http://docs.oracle.com/cd/B10500_01/server.920/a96533/ex_plan.htm 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
EXPLAIN in Oracle 
EXPLAIN PLAN SET statement_id = 'example_plan4' FOR 
SELECT h.order_number, l.revenue_amount, l.ordered_quantity 
FROM so_headers_all h, so_lines_all l 
WHERE h.customer_id = :b1 
AND h.date_ordered > SYSDATE30 
AND l.header_id = h.header_id ; 
Plan 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­-------------------------------------------------- 
SELECT STATEMENT 
NESTED LOOPS 
TABLE ACCESS BY INDEX ROWID SO_HEADERS_ALL 
INDEX RANGE SCAN SO_HEADERS_N1 
TABLE ACCESS BY INDEX ROWID SO_LINES_ALL 
INDEX RANGE SCAN SO_LINES_N1
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
EXPLAIN in MySQL 
mysql> EXPLAIN SELECT user, host FROM mysql.userG 
*************************** 1. row *************************** 
id: 1 
select_type: SIMPLE 
table: user 
type: index 
possible_keys: NULL 
key: PRIMARY 
key_len: 228 
ref: NULL 
rows: 4 
Extra: Using index 
1 row in set (0.13 sec)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
EXPLAIN in MySQL 
Variant: EXTENDED 
mysql> EXPLAIN EXTENDED SELECT user, host FROM mysql.userG 
*************************** 1. row *************************** 
id: 1 
select_type: SIMPLE 
table: user 
type: index 
possible_keys: NULL 
key: PRIMARY 
key_len: 228 
ref: NULL 
rows: 4 
filtered: 100.00 
Extra: Using index 
1 row in set, 1 warning (0.00 sec) 
mysql> SHOW WARNINGSG 
******* 1. row ******* 
Level: Note 
Code: 1003 
Message: /* select#1 */ 
select 
`mysql`.`user`.`User` AS 
`user`,`mysql`.`user`.`H 
ost` AS `host` from 
`mysql`.`user` 
1 row in set (0.00 sec)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
EXPLAIN in MySQL 
Variant: FORMAT=JSON 
mysql> EXPLAIN FORMAT=JSON SELECT 
user, host FROM mysql.userG 
************** 1. row ************** 
EXPLAIN: { 
"query_block": { 
"select_id": 1, 
"table": { 
"table_name": "user", 
"access_type": "index", 
"key": "PRIMARY", 
... 
... 
"used_key_parts": [ 
"Host", 
"User" 
], 
"key_length": "228", 
"rows": 4, 
"filtered": 100, 
"using_index": true 
} 
} 
} 
1 row in set, 1 warning (0.03 sec)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
EXPLAIN in MySQL 
More information 
• http://www.slideshare.net/SvetaSmirnova/troubleshooting-my-sqlperformanceaddonsen 
• http://dev.mysql.com/doc/refman/5.6/en/explain-output.html 
• MySQL EXPLAIN in Practice [HOL9232] (past) 
• MySQL 5.7: What’s New in the Parser and the Optimizer? [CON2830] (past) 
• How to Analyze and Tune MySQL Queries for Better Performance 
[TUT3157] (past) 
• Using MySQL Workbench Performance Tools [HOL9237] (past)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL Optimizer 
Handler_% status variables 
mysql> flush status; 
Query OK, 0 rows affected (0.00 sec) 
mysql> SHOW STATUS LIKE 'Handler_read_%'; 
+----------------------------+-------+ 
| Variable_name | Value | 
+----------------------------+-------+ 
| Handler_read_first | 0 | 
| Handler_read_key | 0 | 
| Handler_read_last | 0 | 
| Handler_read_next | 0 | 
| Handler_read_prev | 0 | 
| Handler_read_rnd | 0 | 
| Handler_read_rnd_next | 0 | 
+----------------------------+-------+ 
7 rows in set (0.00 sec)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL Optimizer 
Handler_% status variables 
mysql> select count(*) from employees join titles using(emp_no) where title='Senior Engineer'G 
*************************** 1. row *************************** 
count(*): 97750 
1 row in set (3.24 sec) 
mysql> SHOW STATUS LIKE 'Handler_read_%'; 
+----------------------------+--------+ 
| Variable_name | Value | 
+----------------------------+--------+ 
| Handler_read_first | 1 | 
| Handler_read_key | 300027 | 
| Handler_read_last | 0 | 
| Handler_read_next | 397774 | 
...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL Optimizer 
Other tools 
• INFORMATION_SCHEMA.TRACE 
● http://dev.mysql.com/doc/internals/en/optimizer-tracing.html 
● join_preparation, join_optimization, 
join_execution 
– considered_execution_plans, refine_plan, more 
• Query Analyzer in MEM 
● http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-quan-using.html 
• Graphic EXPLAIN in MySQL Workbench 6.0
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL Storage Engines 
Specifics 
• Own way to handle 
● Corruption 
● Index statistics 
● CHECK TABLE to check for errors 
• They care about physical data, so all data information are on their level 
• Options usually start from engine name 
● myisam_*, innodb_*, custom_*
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL Storage Engines 
InnoDB 
• Transactional storage engine 
• Physical layout 
● *frm file – table definition 
● Shared tablespace 
● *ibd file – tablespace for individual table 
– Optional: --innodb_file_per_table 
– Recommended and default since 5.6 
● Redo log files 
• OPTIMIZE TABLE = ALTER + ANALYZE 
• Automatic startup check
High concurrency issues 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
High concurrency issues 
• Query or transaction waits a lock, held by another one 
• Fight for system resources 
• Resource overload 
• Resource underload 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Common problems
Transactions and their relation to locks 
• Lock types 
• Levels 
–MDL 
– Table-level 
– Row-level 
• What do they lock 
–Read locks 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
– Block writes 
–Write locks 
– Block both reads and writes 
● Transactions 
● Server-level 
– MDL locks 
● Engine level 
– Table locks 
– Row locks 
● AUTOCOMMIT 
● Supported
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Locking issues 
Diagnostic tools 
• SHOW [FULL] PROCESSLIST 
● Universal tool which lists all currently running connections 
• SHOW ENGINE INNODB STATUS 
• INFORMATION SCHEMA 
● PROCESSLIST 
● InnoDB tables 
• PERFORMANCE SCHEMA 
● MDL locks 
● Table locks 
● Server-level transactions
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Storage engine specifics 
Diagnostic tools 
• Transactions and engine-level locks are done at the engine level 
• Storage engines have own diagnostic tools 
• Use them when hit an issue with such a lock
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Storage engine specifics 
• SHOW ENGINE INNODB STATUS 
• InnoDB monitors 
● Pseudo-tables 
– Turn periodical logging into error log 
● CREATE TABLE innodb_monitor(f1 int) ENGINE=INNODB; 
– Lock monitor 
● Changes output format of InnoDB Monitor 
● CREATE TABLE innodb_lock_monitor(f1 int) ENGINE=INNODB; 
● Options 
– innodb_status_output 
– innodb_status_output_locks 
InnoDB
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Storage engine specifics 
InnoDB 
• Tables in INFORMATION_SCHEMA 
● INNODB_TRX 
● INNODB_LOCKS 
● INNODB_LOCK_WAITS 
● INNODB_METRICS 
– Options innodb_monitor_* 
● Option innodb_print_all_deadlocks
Diagnostic tool: performance_schema 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
For whole server 
• Monitors internal operations 
● Events 
● Waits 
● Mutexes 
● Statements 
● Stages 
● MDL, table-level locks, transactions 
● Memory 
● Replication 
• Similar to Oracle wait interface 
5.7+
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Diagnosting locks 
Summary 
• Table-level locks 
● PROCESSLIST: “Waiting for table lock” 
● P_S.TABLE_HANDLES 
• Row-level locks 
5.7+ 
● InnoDB monitors, SHOW ENGINE INNODB STATUS 
● Tables in INFORMATION_SCHEMA 
● Option --innodb_print_all_deadlocks 
• MDL locks 
● PROCESSLIST: “Waiting for metadata lock” 
● P_S.METADATA_LOCKS 
5.7+
High availability solutions 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL Cluster 
• Special storage engine: NDB 
• Stores data on two or more physical machines 
• Two or more copies 
• General troubleshooting techniques 
● Applicable 
• Specific NDB storage engine techniques
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
MySQL Replication 
Overview 
• Always available, but you must setup it before use 
• Asynchronous master-slave 
• Master 
● Keeps all updates in separate file: binary log 
• Slave 
● IO thread read updates from master and stores in relay log file 
● SQL thread executes updates
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Replication IO thread 
Communication issues 
• Access error 
● Check slave error log 
● SHOW SLAVE STATUS 
● P_S.replication_connection_status 
● Try to connect using normal MySQL client using slave credentials 
– SHOW GRANTS 
● Fix privileges on master 
● Restart slave
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Replication SQL thread 
Typical issues 
• Simple master-slave 
● Data is different on master and slave 
– Replication event can not be applied 
● Different errors on master and slave 
● Slave lags far behind the master 
• Circular replication or other writes in addition to slave SQL thread 
● Data is different on master and slave
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Replication SQL thread 
Data is different on master and slave 
• Was the table modified besides the SQL thread? 
● How? 
● Can it affect content of the table in the wrong way? 
• Are the table definitions same on master and slave? 
● MySQL Utilities 
– mysqlrplsync, mysqldbcompare, mysqldiff 
• Is it possible that master events was applied in wrong order? 
● Use mysqlbinlog to find queries which caused the issue 
● Check master's application to find what is wrong
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Replication SQL thread 
Events from master were applied in wrong order 
• Lock issues 
● InnoDB 
• Triggers 
● SET GLOBAL slave_skip_counter 
● Synchronize tables! 
• Different options 
● Start slave with master's options, then check
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Replication SQL thread 
Slave lags far behind the master 
• Threads 
● Master runs in multiple update threads 
● Slave uses single 
• Seconds_behind_master is growing 
• Tune slave performance 
● Buffers 
● Indexes (for statement-based replication)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
More information
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
OpenWorld sessions 
October, 01 
• Practical MySQL Optimization [CON5522] 
● Peter Zaitsev, 3:30 PM, Moscone South - 262 
• What’s New in MySQL 5.7 Security [CON1985] 
● Georgi Kodinov, 4:45 PM, Moscone South - 262 
• MySQL Cost Model [CON3163] 
● Olav Sandstå, 5:30 PM, Moscone South - 250
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
OpenWorld sessions 
October, 02 
• MySQL Troubleshooting with the Performance Schema [HOL9215] 
● Sveta Smirnova, Lig Isler-turmelle 
● 8:30 AM, Hotel Nikko - Monterey 
• MySQL Enterprise Edition Features in Practice [HOL9216] 
● Matt Lord, 10:00 AM, Hotel Nikko - Monterey 
• MySQL Performance: Demystified Tuning and Best Practices [CON5097] 
● Dimitri Kravtchuk, 10:45 AM, Moscone South - 252
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Further reading 
• MySQL Troubleshooting book 
● http://shop.oreilly.com/product/0636920021964.do 
• Marc Alff's Performance Schema blog 
● http://marcalff.blogspot.ru/ 
• Planet MySQL 
● http://planet.mysql.com/ 
● http://dev.mysql.com/support/blogs/ 
● http://mysqlserverteam.com/
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
References 
• MySQL User Reference Manual 
● http://dev.mysql.com/doc/refman/5.6/en/index.html 
• Knowledge Management Database 
• Forums 
● http://forums.mysql.com 
• Bug trackers 
● http://bugs.mysql.com 
● Oracle Internal Bugs database 
• My Oracle Support 
● https://support.oracle.com
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
You will find me at 
• https://twitter.com/svetsmirnova 
• https://blogs.oracle.com/svetasmirnova/ 
• http://www.slideshare.net/SvetaSmirnova/
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Thank you!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

More Related Content

What's hot

MySQL Monitoring Mechanisms
MySQL Monitoring MechanismsMySQL Monitoring Mechanisms
MySQL Monitoring MechanismsMark Leith
 
MySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema ImprovementsMySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema ImprovementsMark Leith
 
Mysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMark Leith
 
MySQL Administration and Monitoring
MySQL Administration and MonitoringMySQL Administration and Monitoring
MySQL Administration and MonitoringMark Leith
 
Instrumenting plugins for Performance Schema
Instrumenting plugins for Performance SchemaInstrumenting plugins for Performance Schema
Instrumenting plugins for Performance SchemaMark Leith
 
Performance schema and_ps_helper
Performance schema and_ps_helperPerformance schema and_ps_helper
Performance schema and_ps_helperMark Leith
 
Performance Schema for MySQL Troubleshooting
 Performance Schema for MySQL Troubleshooting Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningFromDual GmbH
 
Introduction to MySQL Enterprise Monitor
Introduction to MySQL Enterprise MonitorIntroduction to MySQL Enterprise Monitor
Introduction to MySQL Enterprise MonitorMark Leith
 
Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!Revelation Technologies
 
Developing Information Schema Plugins
Developing Information Schema PluginsDeveloping Information Schema Plugins
Developing Information Schema PluginsMark Leith
 
Extending MySQL Enterprise Monitor
Extending MySQL Enterprise MonitorExtending MySQL Enterprise Monitor
Extending MySQL Enterprise MonitorMark Leith
 
Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14Ajith Narayanan
 
MySQL Monitoring Mechanisms
MySQL Monitoring MechanismsMySQL Monitoring Mechanisms
MySQL Monitoring MechanismsMark Leith
 
The Query Rewrite Plugin Interface: Writing Your Own Plugin
The Query Rewrite Plugin Interface: Writing Your Own PluginThe Query Rewrite Plugin Interface: Writing Your Own Plugin
The Query Rewrite Plugin Interface: Writing Your Own PluginMartinHanssonOracle
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationBerry Clemens
 
OUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source CodeOUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source CodeGeorgi Kodinov
 
Monitoring and Tuning Oracle FMW 11g
Monitoring and Tuning Oracle FMW 11gMonitoring and Tuning Oracle FMW 11g
Monitoring and Tuning Oracle FMW 11gMatthias Furrer
 

What's hot (20)

MySQL Monitoring Mechanisms
MySQL Monitoring MechanismsMySQL Monitoring Mechanisms
MySQL Monitoring Mechanisms
 
MySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema ImprovementsMySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema Improvements
 
Mysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sys
 
MySQL Administration and Monitoring
MySQL Administration and MonitoringMySQL Administration and Monitoring
MySQL Administration and Monitoring
 
Instrumenting plugins for Performance Schema
Instrumenting plugins for Performance SchemaInstrumenting plugins for Performance Schema
Instrumenting plugins for Performance Schema
 
Performance schema and_ps_helper
Performance schema and_ps_helperPerformance schema and_ps_helper
Performance schema and_ps_helper
 
Performance Schema for MySQL Troubleshooting
 Performance Schema for MySQL Troubleshooting Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL Tuning
 
Introduction to MySQL Enterprise Monitor
Introduction to MySQL Enterprise MonitorIntroduction to MySQL Enterprise Monitor
Introduction to MySQL Enterprise Monitor
 
Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!
 
MySQL Quick Dive
MySQL Quick DiveMySQL Quick Dive
MySQL Quick Dive
 
Developing Information Schema Plugins
Developing Information Schema PluginsDeveloping Information Schema Plugins
Developing Information Schema Plugins
 
Extending MySQL Enterprise Monitor
Extending MySQL Enterprise MonitorExtending MySQL Enterprise Monitor
Extending MySQL Enterprise Monitor
 
Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14
 
MySQL Monitoring Mechanisms
MySQL Monitoring MechanismsMySQL Monitoring Mechanisms
MySQL Monitoring Mechanisms
 
The Query Rewrite Plugin Interface: Writing Your Own Plugin
The Query Rewrite Plugin Interface: Writing Your Own PluginThe Query Rewrite Plugin Interface: Writing Your Own Plugin
The Query Rewrite Plugin Interface: Writing Your Own Plugin
 
AWR and ASH Deep Dive
AWR and ASH Deep DiveAWR and ASH Deep Dive
AWR and ASH Deep Dive
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentation
 
OUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source CodeOUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source Code
 
Monitoring and Tuning Oracle FMW 11g
Monitoring and Tuning Oracle FMW 11gMonitoring and Tuning Oracle FMW 11g
Monitoring and Tuning Oracle FMW 11g
 

Similar to Basic MySQL Troubleshooting for Oracle DBAs

MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance TuningMark Swarbrick
 
MySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & TuneMySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & TuneMark Swarbrick
 
The MySQL SYS Schema
The MySQL SYS SchemaThe MySQL SYS Schema
The MySQL SYS SchemaMark Leith
 
Using MySQL Enterprise Monitor for Continuous Performance Improvement
Using MySQL Enterprise Monitor for Continuous Performance ImprovementUsing MySQL Enterprise Monitor for Continuous Performance Improvement
Using MySQL Enterprise Monitor for Continuous Performance ImprovementMark Matthews
 
MySQL Webinar Series 4/4 - Manage & tune
MySQL Webinar Series 4/4 - Manage & tuneMySQL Webinar Series 4/4 - Manage & tune
MySQL Webinar Series 4/4 - Manage & tuneMark Swarbrick
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsBen Krug
 
My sql fabric webinar v1.1
My sql fabric webinar v1.1My sql fabric webinar v1.1
My sql fabric webinar v1.1Ricky Setyawan
 
2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL Server2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL ServerGeorgi Kodinov
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschemaIvan Ma
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsMario Beck
 
MySQL Fabric Tutorial, October 2014
MySQL Fabric Tutorial, October 2014MySQL Fabric Tutorial, October 2014
MySQL Fabric Tutorial, October 2014Lars Thalmann
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksDave Stokes
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014Dave Stokes
 
2_MySQL_Cluster_Introduction.pdf
2_MySQL_Cluster_Introduction.pdf2_MySQL_Cluster_Introduction.pdf
2_MySQL_Cluster_Introduction.pdfHaiping Li
 
Mysql user-camp-march-11th-2016
Mysql user-camp-march-11th-2016Mysql user-camp-march-11th-2016
Mysql user-camp-march-11th-2016Harin Vadodaria
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMark Swarbrick
 

Similar to Basic MySQL Troubleshooting for Oracle DBAs (20)

MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
MySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & TuneMySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & Tune
 
The MySQL SYS Schema
The MySQL SYS SchemaThe MySQL SYS Schema
The MySQL SYS Schema
 
Using MySQL Enterprise Monitor for Continuous Performance Improvement
Using MySQL Enterprise Monitor for Continuous Performance ImprovementUsing MySQL Enterprise Monitor for Continuous Performance Improvement
Using MySQL Enterprise Monitor for Continuous Performance Improvement
 
MySQL Webinar Series 4/4 - Manage & tune
MySQL Webinar Series 4/4 - Manage & tuneMySQL Webinar Series 4/4 - Manage & tune
MySQL Webinar Series 4/4 - Manage & tune
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
My sql fabric webinar v1.1
My sql fabric webinar v1.1My sql fabric webinar v1.1
My sql fabric webinar v1.1
 
2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL Server2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL Server
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschema
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
MySQL Fabric Tutorial, October 2014
MySQL Fabric Tutorial, October 2014MySQL Fabric Tutorial, October 2014
MySQL Fabric Tutorial, October 2014
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disks
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014
 
2_MySQL_Cluster_Introduction.pdf
2_MySQL_Cluster_Introduction.pdf2_MySQL_Cluster_Introduction.pdf
2_MySQL_Cluster_Introduction.pdf
 
MySQL Fabric
MySQL FabricMySQL Fabric
MySQL Fabric
 
Developer day v2
Developer day v2Developer day v2
Developer day v2
 
Mysql user-camp-march-11th-2016
Mysql user-camp-march-11th-2016Mysql user-camp-march-11th-2016
Mysql user-camp-march-11th-2016
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 

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
 
Database in Kubernetes: Diagnostics and Monitoring
Database in Kubernetes: Diagnostics and MonitoringDatabase in Kubernetes: Diagnostics and Monitoring
Database in Kubernetes: Diagnostics and MonitoringSveta Smirnova
 
MySQL Database Monitoring: Must, Good and Nice to Have
MySQL Database Monitoring: Must, Good and Nice to HaveMySQL Database Monitoring: Must, Good and Nice to Have
MySQL Database Monitoring: Must, Good and Nice to HaveSveta Smirnova
 
MySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersMySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersSveta Smirnova
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOpsSveta 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
 

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.х всё устраивает?
 
Database in Kubernetes: Diagnostics and Monitoring
Database in Kubernetes: Diagnostics and MonitoringDatabase in Kubernetes: Diagnostics and Monitoring
Database in Kubernetes: Diagnostics and Monitoring
 
MySQL Database Monitoring: Must, Good and Nice to Have
MySQL Database Monitoring: Must, Good and Nice to HaveMySQL Database Monitoring: Must, Good and Nice to Have
MySQL Database Monitoring: Must, Good and Nice to Have
 
MySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersMySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for Developers
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOps
 
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 ...
 

Recently uploaded

ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
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
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
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
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 

Recently uploaded (20)

ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
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...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
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
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 

Basic MySQL Troubleshooting for Oracle DBAs

  • 1. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 2. Basic MySQL Troubleshooting for Oracle DBAs Sveta Smirnova Senior Principal Technical Support Engineer MySQL Support September 29, 2014 Copyright © 2014, Oracle and/or its affiliates. All rriigghhttss rreesseerrvveedd.. ||
  • 3. Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Program Agenda Introduction Basic troubleshooting techniques High concurrency issues High availability solutions More information 1 2 3 4 5
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Introduction
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL architecture Click icon to add picture Base - Installation layout - Log files Connectors - Clients - APIs Optimizer Caches & buffers Storage engines Management
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Typical installation layout • datadir – Schema directory – Table files: *frm, *ibd, *MYD, *MYI, *par, etc. – Trigger files – Schema – … – InnoDB shared tablespace – Log files – InnoDB log files – Binary, relay logs – Error log – Slow query log – General query log Configurable You can setup custom path for each component Including custom path for tables
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Connectors The way you connect to MySQL Server • Clients –MySQL CLI –MySQL Workbench –MySQL Enterprise Monitor (MEM) –Oracle Enterprise Manager with MEM plugin • APIs –Exist for most popular programming languages –C, C++, JDBC, PHP, Python, Net, ODBC
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Plugins MySQL Server is highly configurable via plugins • Storage engines • Full-text parsers • Daemon • INFORMATION_SCHEMA • Semisynchronous Replication • Audit • Authentication • Password-validation • Protocol Trace 5.7
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Storage engines From troubleshooting point of view • Own data • Own index format • Own locking model • Own diagnostic • Own log files • CHECK TABLE
  • 11. Basic troubleshooting techniques Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 12. MySQL Access Privilege System • Privileged client cannot connect • Unprivileged client can connect • Privileged user cannot perform operation • Unprivileged user has undesired access Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Typical issues
  • 13. MySQL Access Privilege System Overview • No roles by default, limited user limits • All records are in the mysql database (schema) • Pluggable authentication since version 5.5 • Connections Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ● TCP/IP with login-password ● Socket (Unix) ● Named pipe (Windows)
  • 14. MySQL Access Privilege System select user, host from mysql.user order by user desc, host desc; • Most descriptive host first, then wildcard • Socket connection by default on Unix Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Where to find out why you have connection issues?
  • 15. MySQL Access Privilege System mysql> select user, host from mysql.user order by user desc, host desc; +------+------------+ | user | host | +------+------------+ | root | localhost | | root | delly | | root | ::1 | | root | 127.0.0.1 | | foo | % | | | localhost | +------+------------+ 6 rows in set (0.00 sec) Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Where to find out why you have connection issues?
  • 16. MySQL Access Privilege System Wrong access SHOW GRANTS [FOR user@host] • Grant tables Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ● mysql.db ● mysql.tables_priv ● mysql.columns_priv ● mysql.procs_priv ● mysql.proxies_priv SELECT USER(), CURRENT_USER()
  • 17. MySQL Access Privilege System mysql> show grants; +--------------------------------------------------------------------+ | Grants for root@localhost | +--------------------------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION| | GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION | +--------------------------------------------------------------------+ 2 rows in set (0.02 sec) Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Wrong access
  • 18. MySQL Access Privilege System mysql> show grants for foo@'%'; +-----------------------------------------------------+ | Grants for foo@% | +-----------------------------------------------------+ | GRANT USAGE ON *.* TO 'foo'@'%' | | GRANT ALL PRIVILEGES ON `test`.* TO 'foo'@'%' | +-----------------------------------------------------+ 2 rows in set (0.02 sec) Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Wrong access
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Error handling Errors vs warnings mysql> select max (f1) from t1; ERROR 1630 (42000): FUNCTION test.max does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual mysql> select * from t1 where "f1"=1; Empty set, 1 warning (0.05 sec) mysql> show warnings; +-----------+--------+----------------------------------------------------+ | Level | Code | Message | +-----------+--------+----------------------------------------------------+ | Warning | 1292 | Truncated incorrect DOUBLE value: 'f1' | +-----------+--------+----------------------------------------------------+ 1 row in set (0.00 sec)
  • 20. MySQL Access Privilege System Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Application (C API) • Error information ● mysql_errno ● mysql_error • Warnings ● mysql_info ● mysql_sqlstate ● mysql_warning_count
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Error handling perror [sveta@delly ~]$ perror 1630 MySQL error code 1630 (ER_FUNC_INEXISTENT_NAME_COLLISION): FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual [sveta@delly ~]$ perror 1292 MySQL error code 1292 (ER_TRUNCATED_WRONG_VALUE): Truncated incorrect %.32s value: '%.128s' [sveta@delly ~]$ perror 2 OS error code 2: No such file or directory [sveta@delly ~]$ perror 150 MySQL error code 150: Foreign key constraint is incorrectly formed
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Error handling In stored routines ● GET DIAGNOSTICS ● GET DIAGNOSTICS rows = ROW_COUNT, conditions = NUMBER; ● GET DIAGNOSTICS CONDITION 1 code = RETURNED_SQLSTATE, msg = MESSAGE_TEXT; ● http://dev.mysql.com/doc/refman/5.6/en/diagnostics-area.html
  • 23. What can affect query execution? You run a query, it does not return an error, but still behaves not as expected • Startup options or system variables • How optimizer creates query plan • Storage engine used • Parallel execution next section Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 24. System variables and startup options Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Scope • Global ● Control parameters, necessary for all server processes – Location of server files: datadir etc. – Shared buffers – More • Session ● Control connection-specific parameters • http://dev.mysql.com/doc/refman/5.6/en/mysqld-option-tables.html
  • 25. System variables and startup options • SET [GLOBAL] var_name = NEW_VAL • Command line option • Configuration file Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ● In default location – http://dev.mysql.com/doc/refman/5.6/en/option-files.html ● Specified by option ­-- defaults-file How to set
  • 26. System variables and startup options Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Who can change • Global options and few session options ● A user with privilege SUPER • Session options ● Anybody • There is no limits!
  • 27. System variables and startup options When allocated • Those which control behavior of whole server ● Once at server startup ● Can start with low values, then grow to specified Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | • Connection options ● For every connection when connection opens • Operation-specific ● For every operation when needed
  • 28. System variables and startup options Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | How to control • SHOW [GLOBAL] STATUS • GLOBAL ● Since server start • SESSION ● For operations in current session ● Can be reset – FLUSH STATUS
  • 29. System variables and startup options How to control mysql> show global status like 'Handler_read_rnd_next'G *************************** 1. row *************************** Variable_name: Handler_read_rnd_next Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Value: 27 1 row in set (0.00 sec) mysql> show status like 'Handler_read_rnd_next'G *************************** 1. row *************************** Variable_name: Handler_read_rnd_next Value: 7 1 row in set (0.00 sec)
  • 30. System variables and startup options Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Troubleshooting best practices • Record currently used variables ● SHOW [GLOBAL] VARIABLES • Make change dynamically if possible ● SET [GLOBAL] var_name=NEW_VAL • Test in one session first • Then change global variable • Change configuration file after you are happy with results
  • 31. System variables and startup options Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | When affecting option is not known • Record currently used variables ● SHOW [GLOBAL] VARIABLES • Start mysqld with option --no-defaults ● This option must be first one! • Check if problem is solved • Change variable values one-by-one until you find one which leads to the problem
  • 32. Diagnostic tool: INFORMATION_SCHEMA Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | When affecting option is not known • Contain metadata information ● Tables ● Indexes ● Other • Allows to create plugins ● InnoDB plugins – We will discuss them later • Oracle analog ● Data Dictionary Views
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL Optimizer Overview • EXPLAIN is less powerful if compare with Oracle ● It is improved in version 5.7.3 ● Graphic EXPLAIN in MySQL Workbench 6.0 • EXPLAIN EXTENDED • EXPLAIN PARTITIONS • EXPLAIN FORMAT=JSON • INFORMATION_SCHEMA.TRACE • Status variables 'Handler_%' Default in 5.7
  • 34. http://docs.oracle.com/cd/B10500_01/server.920/a96533/ex_plan.htm Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | EXPLAIN in Oracle EXPLAIN PLAN SET statement_id = 'example_plan4' FOR SELECT h.order_number, l.revenue_amount, l.ordered_quantity FROM so_headers_all h, so_lines_all l WHERE h.customer_id = :b1 AND h.date_ordered > SYSDATE30 AND l.header_id = h.header_id ; Plan ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­-------------------------------------------------- SELECT STATEMENT NESTED LOOPS TABLE ACCESS BY INDEX ROWID SO_HEADERS_ALL INDEX RANGE SCAN SO_HEADERS_N1 TABLE ACCESS BY INDEX ROWID SO_LINES_ALL INDEX RANGE SCAN SO_LINES_N1
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | EXPLAIN in MySQL mysql> EXPLAIN SELECT user, host FROM mysql.userG *************************** 1. row *************************** id: 1 select_type: SIMPLE table: user type: index possible_keys: NULL key: PRIMARY key_len: 228 ref: NULL rows: 4 Extra: Using index 1 row in set (0.13 sec)
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | EXPLAIN in MySQL Variant: EXTENDED mysql> EXPLAIN EXTENDED SELECT user, host FROM mysql.userG *************************** 1. row *************************** id: 1 select_type: SIMPLE table: user type: index possible_keys: NULL key: PRIMARY key_len: 228 ref: NULL rows: 4 filtered: 100.00 Extra: Using index 1 row in set, 1 warning (0.00 sec) mysql> SHOW WARNINGSG ******* 1. row ******* Level: Note Code: 1003 Message: /* select#1 */ select `mysql`.`user`.`User` AS `user`,`mysql`.`user`.`H ost` AS `host` from `mysql`.`user` 1 row in set (0.00 sec)
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | EXPLAIN in MySQL Variant: FORMAT=JSON mysql> EXPLAIN FORMAT=JSON SELECT user, host FROM mysql.userG ************** 1. row ************** EXPLAIN: { "query_block": { "select_id": 1, "table": { "table_name": "user", "access_type": "index", "key": "PRIMARY", ... ... "used_key_parts": [ "Host", "User" ], "key_length": "228", "rows": 4, "filtered": 100, "using_index": true } } } 1 row in set, 1 warning (0.03 sec)
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | EXPLAIN in MySQL More information • http://www.slideshare.net/SvetaSmirnova/troubleshooting-my-sqlperformanceaddonsen • http://dev.mysql.com/doc/refman/5.6/en/explain-output.html • MySQL EXPLAIN in Practice [HOL9232] (past) • MySQL 5.7: What’s New in the Parser and the Optimizer? [CON2830] (past) • How to Analyze and Tune MySQL Queries for Better Performance [TUT3157] (past) • Using MySQL Workbench Performance Tools [HOL9237] (past)
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL Optimizer Handler_% status variables mysql> flush status; Query OK, 0 rows affected (0.00 sec) mysql> SHOW STATUS LIKE 'Handler_read_%'; +----------------------------+-------+ | Variable_name | Value | +----------------------------+-------+ | Handler_read_first | 0 | | Handler_read_key | 0 | | Handler_read_last | 0 | | Handler_read_next | 0 | | Handler_read_prev | 0 | | Handler_read_rnd | 0 | | Handler_read_rnd_next | 0 | +----------------------------+-------+ 7 rows in set (0.00 sec)
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL Optimizer Handler_% status variables mysql> select count(*) from employees join titles using(emp_no) where title='Senior Engineer'G *************************** 1. row *************************** count(*): 97750 1 row in set (3.24 sec) mysql> SHOW STATUS LIKE 'Handler_read_%'; +----------------------------+--------+ | Variable_name | Value | +----------------------------+--------+ | Handler_read_first | 1 | | Handler_read_key | 300027 | | Handler_read_last | 0 | | Handler_read_next | 397774 | ...
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL Optimizer Other tools • INFORMATION_SCHEMA.TRACE ● http://dev.mysql.com/doc/internals/en/optimizer-tracing.html ● join_preparation, join_optimization, join_execution – considered_execution_plans, refine_plan, more • Query Analyzer in MEM ● http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-quan-using.html • Graphic EXPLAIN in MySQL Workbench 6.0
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL Storage Engines Specifics • Own way to handle ● Corruption ● Index statistics ● CHECK TABLE to check for errors • They care about physical data, so all data information are on their level • Options usually start from engine name ● myisam_*, innodb_*, custom_*
  • 43. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL Storage Engines InnoDB • Transactional storage engine • Physical layout ● *frm file – table definition ● Shared tablespace ● *ibd file – tablespace for individual table – Optional: --innodb_file_per_table – Recommended and default since 5.6 ● Redo log files • OPTIMIZE TABLE = ALTER + ANALYZE • Automatic startup check
  • 44. High concurrency issues Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 45. High concurrency issues • Query or transaction waits a lock, held by another one • Fight for system resources • Resource overload • Resource underload Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Common problems
  • 46. Transactions and their relation to locks • Lock types • Levels –MDL – Table-level – Row-level • What do they lock –Read locks Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | – Block writes –Write locks – Block both reads and writes ● Transactions ● Server-level – MDL locks ● Engine level – Table locks – Row locks ● AUTOCOMMIT ● Supported
  • 47. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Locking issues Diagnostic tools • SHOW [FULL] PROCESSLIST ● Universal tool which lists all currently running connections • SHOW ENGINE INNODB STATUS • INFORMATION SCHEMA ● PROCESSLIST ● InnoDB tables • PERFORMANCE SCHEMA ● MDL locks ● Table locks ● Server-level transactions
  • 48. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Storage engine specifics Diagnostic tools • Transactions and engine-level locks are done at the engine level • Storage engines have own diagnostic tools • Use them when hit an issue with such a lock
  • 49. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Storage engine specifics • SHOW ENGINE INNODB STATUS • InnoDB monitors ● Pseudo-tables – Turn periodical logging into error log ● CREATE TABLE innodb_monitor(f1 int) ENGINE=INNODB; – Lock monitor ● Changes output format of InnoDB Monitor ● CREATE TABLE innodb_lock_monitor(f1 int) ENGINE=INNODB; ● Options – innodb_status_output – innodb_status_output_locks InnoDB
  • 50. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Storage engine specifics InnoDB • Tables in INFORMATION_SCHEMA ● INNODB_TRX ● INNODB_LOCKS ● INNODB_LOCK_WAITS ● INNODB_METRICS – Options innodb_monitor_* ● Option innodb_print_all_deadlocks
  • 51. Diagnostic tool: performance_schema Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | For whole server • Monitors internal operations ● Events ● Waits ● Mutexes ● Statements ● Stages ● MDL, table-level locks, transactions ● Memory ● Replication • Similar to Oracle wait interface 5.7+
  • 52. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Diagnosting locks Summary • Table-level locks ● PROCESSLIST: “Waiting for table lock” ● P_S.TABLE_HANDLES • Row-level locks 5.7+ ● InnoDB monitors, SHOW ENGINE INNODB STATUS ● Tables in INFORMATION_SCHEMA ● Option --innodb_print_all_deadlocks • MDL locks ● PROCESSLIST: “Waiting for metadata lock” ● P_S.METADATA_LOCKS 5.7+
  • 53. High availability solutions Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 54. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL Cluster • Special storage engine: NDB • Stores data on two or more physical machines • Two or more copies • General troubleshooting techniques ● Applicable • Specific NDB storage engine techniques
  • 55. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | MySQL Replication Overview • Always available, but you must setup it before use • Asynchronous master-slave • Master ● Keeps all updates in separate file: binary log • Slave ● IO thread read updates from master and stores in relay log file ● SQL thread executes updates
  • 56. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication IO thread Communication issues • Access error ● Check slave error log ● SHOW SLAVE STATUS ● P_S.replication_connection_status ● Try to connect using normal MySQL client using slave credentials – SHOW GRANTS ● Fix privileges on master ● Restart slave
  • 57. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication SQL thread Typical issues • Simple master-slave ● Data is different on master and slave – Replication event can not be applied ● Different errors on master and slave ● Slave lags far behind the master • Circular replication or other writes in addition to slave SQL thread ● Data is different on master and slave
  • 58. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication SQL thread Data is different on master and slave • Was the table modified besides the SQL thread? ● How? ● Can it affect content of the table in the wrong way? • Are the table definitions same on master and slave? ● MySQL Utilities – mysqlrplsync, mysqldbcompare, mysqldiff • Is it possible that master events was applied in wrong order? ● Use mysqlbinlog to find queries which caused the issue ● Check master's application to find what is wrong
  • 59. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication SQL thread Events from master were applied in wrong order • Lock issues ● InnoDB • Triggers ● SET GLOBAL slave_skip_counter ● Synchronize tables! • Different options ● Start slave with master's options, then check
  • 60. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication SQL thread Slave lags far behind the master • Threads ● Master runs in multiple update threads ● Slave uses single • Seconds_behind_master is growing • Tune slave performance ● Buffers ● Indexes (for statement-based replication)
  • 61. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | More information
  • 62. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | OpenWorld sessions October, 01 • Practical MySQL Optimization [CON5522] ● Peter Zaitsev, 3:30 PM, Moscone South - 262 • What’s New in MySQL 5.7 Security [CON1985] ● Georgi Kodinov, 4:45 PM, Moscone South - 262 • MySQL Cost Model [CON3163] ● Olav Sandstå, 5:30 PM, Moscone South - 250
  • 63. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | OpenWorld sessions October, 02 • MySQL Troubleshooting with the Performance Schema [HOL9215] ● Sveta Smirnova, Lig Isler-turmelle ● 8:30 AM, Hotel Nikko - Monterey • MySQL Enterprise Edition Features in Practice [HOL9216] ● Matt Lord, 10:00 AM, Hotel Nikko - Monterey • MySQL Performance: Demystified Tuning and Best Practices [CON5097] ● Dimitri Kravtchuk, 10:45 AM, Moscone South - 252
  • 64. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Further reading • MySQL Troubleshooting book ● http://shop.oreilly.com/product/0636920021964.do • Marc Alff's Performance Schema blog ● http://marcalff.blogspot.ru/ • Planet MySQL ● http://planet.mysql.com/ ● http://dev.mysql.com/support/blogs/ ● http://mysqlserverteam.com/
  • 65. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | References • MySQL User Reference Manual ● http://dev.mysql.com/doc/refman/5.6/en/index.html • Knowledge Management Database • Forums ● http://forums.mysql.com • Bug trackers ● http://bugs.mysql.com ● Oracle Internal Bugs database • My Oracle Support ● https://support.oracle.com
  • 66. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | You will find me at • https://twitter.com/svetsmirnova • https://blogs.oracle.com/svetasmirnova/ • http://www.slideshare.net/SvetaSmirnova/
  • 67. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ?
  • 68. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Thank you!
  • 69. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |