SlideShare a Scribd company logo
Basic MySQL Troubleshooting
for Oracle Database Administrators
Sveta Smirnova
Principal Support Engineer
October, 29, 2015
Table of Contents
•MySQL Server overview
•Basic troubleshooting techniques
•High concurrency issues
•Replication
2 www.percona.com
MySQL Server overview
3 www.percona.com
MySQL architecture
Connectors: C, JDBC, ODBC, Python, ...
Connection Pool: Authentication, Caches
SQL interface
Parser
Optimizer
Caches and Buffers:
Global
Engine-specific
Storage engines: InnoDB, TokuDB, ...
File system: Data, Index, logs, other files
• Base
• Installation layout
• Log files
• Connectors
• Clients, APIs
• Optimizer
• Cache and buffers
• Storage engines
• Management
4 www.percona.com
Typical installation layout
• datadir
• Schema directory
• Table and trigger files: *.frm, *.ibd, *.MYD,
*.par, etc.
• Schema
• ...
• InnoDB shared tablespace
• Log files
• InnoDB redo log files
• Binary, relay log files
• Error log
• Slow query log
• General query log
• Configurable
• You can setup
custom path for
each component
• Including custom
paths for tables
5 www.percona.com
Connectors for MySQL server
• Clients
• MySQL CLI
• MySQL Workbench
• Many other graphical and web-based
• APIs
• Exist for most popular programming languages
• C, C++, JDBC, PHP, Python, Net, ODBC, more
6 www.percona.com
Monitoring solutions
• Command-line
• Percona Toolkit
• MySQL Utilities
• With GUI
• MySQL Enterprise Monitor (MEM)
• MEM plugin for Oracle Enterprise Manager
• VividCortex
• Many others
7 www.percona.com
Plugins
• Storage engines
• Authentication
• Audit
• Query rewrite
• More
8 www.percona.com
Storage engines
• Own data
• Own index format
• Own locking model
• Own diagnostic
• Own log files
• CHECK TABLE
9 www.percona.com
Basic troubleshooting
techniques
10 www.percona.com
Error processing
• Warnings, errors, and notes
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)
11 www.percona.com
Error handling in applications
• Error information
• mysql error
• mysql errno
• Warnings and notes
• mysql info
• mysql sqlstate
• mysql warning count
12 www.percona.com
Error handling in stored routines
• GET DIAGNOSTICS
• GET DIAGNOSTICS rows = ROW COUNT,
conditions = NUMBER;
• GET DIAGNOSTICS CONDITION 1 code =
RETURNED SQLSTATE, msg = MESSAGE TEXT;
• SIGNAL/RESIGNAL
• Can be used for custom errors
13 www.percona.com
More information about errors
[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
14 www.percona.com
MySQL Access Privilege System
• No roles by default, limited user limits
• All records are in the mysql database (schema)
• Pluggable authentication since version 5.5
• Connections
• TCP/IP with login-password
• Socket (Unix)
• Named pipe (Windows)
15 www.percona.com
Common user access issues
• Privileged client cannot connect
• Unprivileged client can connect
• Privileged user cannot perform operation
• Unprivileged user has undesired access
16 www.percona.com
Common queries for access issues
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)
• Most descriptive host first, then wildcard
• Socket connection by default on Unix
17 www.percona.com
Wrong access checklist
• SHOW GRANTS [FOR user@host]
• Grant tables
• mysql.db
• mysql.tables priv
• mysql.columns priv
• mysql.procs priv
• mysql.proxies priv
• SELECT USER(), CURRENT USER()
18 www.percona.com
Wrong access example
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)
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)
19 www.percona.com
Connection statistics in P S
• Tables accounts, users, hosts
mysql> select user, host, current_connections as cur,
-> total_connections as total from performance_schema.accounts;
+------+-----------+-----+-------+
| user | host | cur | total |
+------+-----------+-----+-------+
| foo | localhost | 0 | 3 |
| root | localhost | 1 | 3 |
| NULL | NULL | 14 | 17 |
+------+-----------+-----+-------+
3 rows in set (0.01 sec)
• HOST CACHE
20 www.percona.com
Connection statistics in P S
• Tables accounts, users, hosts
• HOST CACHE
• Content of DNS cache
• Errors from:
• Name Server
• Connection
• Authentication
• max connect errors, max user errors, etc.
• Your first assistant in case of connection issue
20 www.percona.com
Performance Schema
• Monitors interval operations
• Statements
• Stages
• Locks
• Memory
• Variables
• Replication
• IO
• Mutexes and waits
• Similar to Oracle wait interface
21 www.percona.com
What can affect query execution?
• You run a query, it does not return an error, but still
behaves not as expected
• It can be:
• Startup options or system variables
• How optimizer creates query plan
• Storage engine used
• Parallel execution - next big section
22 www.percona.com
System variables and options: scope
• Global
• Control parameters, necessary for all server
processes
• Location of server files: datadir etc.
• Shared buffers
• More
• Session
• Control connection-specific parameters
• MySQL option tables
23 www.percona.com
System Variables: how to set
• SET [GLOBAL] var name = NEW VAL
• Command-line option
• Configuration file
• In default location
• Specified by option –defaults-file
24 www.percona.com
System Variables: who can change
• Global options and few session options
• A user with privilege SUPER
• Session options
• Anybody
• There are no limits!
25 www.percona.com
Buffers: when allocated
• Those which control behavior of whole server
• Once at server startup
• Can start with low values, then grow to specified
• Connection options
• For every connection when connection opens
• Operation-specific
• For every operation when needed
• Can be allocated more than once per query
26 www.percona.com
System variables: control before 5.7
• SHOW [GLOBAL] STATUS
• Tables in Information Schema
• GLOBAL ,SESSION VARIABLES
• GLOBAL ,SESSION STATUS
• GLOBAL
• Since server start
• SESSION
• For operations in current session
• Can be reset
• FLUSH STATUS
27 www.percona.com
System status variables: example
mysql> show global status like ’Handler_read_rnd_next’G
*************************** 1. row ***************************
Variable_name: Handler_read_rnd_next
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)
28 www.percona.com
Information Schema
• Contains metadata information
• Tables
• Indexes
• Other
• Allows to create plugins
• InnoDB plugins
• Similar to Data Dictionary Views in Oracle
29 www.percona.com
System variables: control in 5.7
• Performance Schema tables
• variabes by*
• user variables by*
• status by*
• Statistics grouped by
• Global
• Session
• Thread
• Account/Host/User
30 www.percona.com
System variables: 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 www.percona.com
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 www.percona.com
MySQL Optimizer
• EXPLAIN is less powerful if compare with Oracle
• Visual EXPLAIN in MySQL Workbench
• EXPLAIN EXTENDED
• Should be followed by SHOW WARNINGS
• EXPLAIN PARTITIONS
• EXPLAIN FORMAT=JSON
• INFORMATION SCHEMA.TRACE
• Status variables ’Handler %’
33 www.percona.com
EXPLAIN in Oracle
• http://docs.oracle.com/cd/B10500_01/server.
920/a96533/ex_plan.htm
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
34 www.percona.com
EXPLAIN in MySQL
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‘.‘Host‘ AS ‘host‘ from ‘mys
35 www.percona.com
EXPLAIN: overview
mysql> explain extended select * from t1 join t2 where t1.int_key=1;
+----+-------------+-------+-------+---------------+---------+---------+-------+------+------+-----------
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | f... | Extra
+----+-------------+-------+-------+---------------+---------+---------+-------+------+------+-----------
| 1 | SIMPLE | t1 | ref | int_key,ik | int_key | 5 | const | 4 | 100. | NULL
| 1 | SIMPLE | t2 | index | NULL | pk | 9 | NULL | 6 | 100. | Using inde
Using join
(Block Nes
+----+-------------+-------+-------+---------------+---------+---------+-------+------+------+-----------
2 rows in set, 1 warning (0.00 sec)
Note (Code 1003): /* select#1 */ select ‘test‘.‘t1‘.‘pk‘ AS ‘pk‘,‘test‘.‘t1‘.‘int_key‘ AS ‘int_key‘,‘test
AS ‘pk‘,‘test‘.‘t2‘.‘int_key‘ AS ‘int_key‘ from ‘test‘.‘t1‘ join ‘test‘.‘t2‘ where (‘test‘.‘t1‘.‘int_key‘
Number of select
Select type
Tables, for which information is printed
How data is accessed
Possible keys
Key, which was actually used
Length of the key
Which columns were compared with the index
Number of examined rows
% of filtered rows
rows x filtered / 100 — number of rows,
which will be joined with another table
Additional information
Table, for which information is printed
Product of rows here: how many rows in all tables will be accessed
For this example estimated value is 4*6 = 24
Actual (optimized) query as executed by MySQL Server
36 www.percona.com
EXPLAIN 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": 8,
"filtered": 100,
"using_index": true
}
}
}
37 www.percona.com
When EXPLAIN lies: Handler % variables
mysql> flush status;
Query OK, 0 rows affected (0.00 sec)
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 |
...
38 www.percona.com
MySQL Optimizer: other tools
• INFORMATION SCHEMA.OPTIMIZER TRACE
• join preparation, join optimization, join execution
• considered execution plans, refine plan, more
• Query Analyzer in MEM
• Visual EXPLAIN in MySQL Workbench
39 www.percona.com
MySQL Storage Engines
• Own way to handle
• Corruption
• Index statistics
• CHECK TABLE to check for errors
• They care about physical data, so all data information is
on their level
• Options usually start from engine name
• myisam *, innodb *, custom *
40 www.percona.com
Storage Engines explained
• InnoDB
• TokuDB
• Popular non-transactional engines
• MyISAM - Previous default engine
• Memory
• Federated
• CSV
• Blackhole
41 www.percona.com
Storage Engines explained
• InnoDB
• Most used storage engine
• Physical layout
• *frm file – table definition
• Shared tablespace
• *ibd file – tablespace for individual table - –innodb file per table = 1
• Redo log files
• Automatic startup check
41 www.percona.com
Storage Engines explained
• InnoDB
• Own locking model: row-based
• Troubleshooting tools
• InnoDB Monitors (SHOW ENGINE InnoDB STATUS)
• Tables in Information Schema
• Instrumentation in Performance Schema
41 www.percona.com
Storage Engines explained
• TokuDB
• Fractal tree
• Optimized for compression and writes
• Troubleshooting tools
• SHOW ENGINE tokudb STATUS
• Information schema tables
• Status variables
41 www.percona.com
Storage Engines explained
• Popular non-transactional engines
• Server provides locking model
• Table-level locks
• Can have own instrumentation
• MyISAM
• Status variables
• Performance Schema
• Set of utilities, names start from myisam *
41 www.percona.com
High concurrency issues
42 www.percona.com
Common concurrency issues
• Query or transaction waits a lock, held by another one
• Fight for system resources
• Resource overload
• Resource underload
43 www.percona.com
Lock types and transactions
• Lock types
• Levels
• MDL
• Table-level
• Row-level
• What do they lock
• Read locks
• Block writes
• Write locks
• Block reads and writes
• Transactions
• Server-level
• MDL locks
• Table locks
• Engine-level
• Table locks
• Row locks
• AUTOCOMMIT
• supported
44 www.percona.com
Locks diagnostic
• SHOW [FULL] PROCESSLIST
• SHOW ENGINE INNODB STATUS
• INFORMATION SCHEMA
• PROCESSLIST
• InnoDB table
• Performance Schema
• METADATA LOCKS
• TABLE HANDLES
• EVENTS TRANSACTIONS *
• Both server-level and engine-level
• Contain GTID information
45 www.percona.com
Locks diagnostic
• SHOW [FULL] PROCESSLIST
mysql> select id, state, info from information_schema.processlistG
******************** 1. row ********************
id: 5
state:
info: NULL
******************** 2. row ********************
id: 4
state: Waiting for table metadata lock
info: alter table titles add column f1 int
******************** 3. row ********************
id: 2
state: executing
info: select id, state, info from information_schema.processlist
45 www.percona.com
Locks diagnostic
• Performance Schema
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
45 www.percona.com
Locks diagnostic
• SHOW ENGINE INNODB STATUS
-------------
TRANSACTIONS
-------------
Trx id counter 0 26243837
Purge done for trx’s n:o < 0 26243834 undo n:o < 0 0
History list length 2
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 26243836, ACTIVE 4 sec, OS thread id 101514240 starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 320, 1 row lock(s)
MySQL thread id 4485, query id 25022137 localhost root Updating
update t set a=36 where a=6
45 www.percona.com
InnoDB Monitors
• SHOW ENGINE INNODB STATUS
• Permanent output
• innodb status output
• innodb status output locks
• innodb-status-file - Deleted on normal shutdown!
46 www.percona.com
Other InnoDB diagnostic
• INFORMATION SCHEMA
• INNODB TRX
• INNODB LOCKS
• INNODB LOCK WAITS
• INNODB METRICS
• Options innodb monitor *
• Option innodb print all deadlocks
47 www.percona.com
Locks diagnostic summary
• Table-level
• PROCESSLIST: ”Waiting for table lock”
• P S.TABLE HANDLES
• Row-level
• InnoDB monitors
• SHOW ENGINE INNODB STATUS
• Tables in INFORMATION SCHEMA
• Option –innodb print all deadlocks
• MDL
• PROCESSLIST
• ”Waiting for metadata lock”
• P S.METADATA LOCKS
48 www.percona.com
Replication
49 www.percona.com
MySQL Replication Overview
• Always available, needs to be setup
• Asynchronous master-slave
• Master
• Keeps all updates in binary log file
• Two formats: ROW and STATEMENT
• Slave
• IO thread read updates from master and stores in
relay log file
• SQL thread executes updates
• Multiple SQL threads since 5.6
• Multiple masters since 5.7
• GTIDs since 5.6
50 www.percona.com
Main troubleshooting tools
• SHOW SLAVE STATUS
• Tables in Performance Schema and system database
• Multi-threaded slave (MTS) has additional output for
each worker
• Error log file
51 www.percona.com
Main troubleshooting tools
• SHOW SLAVE STATUS
mysql> show slave status G
************************ 1. row ************************
Slave_IO_State: Queueing master event to the relay log
...
Master_Log_File: master-bin.000003
Read_Master_Log_Pos: 191
Relay_Log_File: slave-relay-bin.000006
Relay_Log_Pos: 4
Relay_Master_Log_File: master-bin.000002
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
...
Last_Errno: 0
Last_Error:
...
Exec_Master_Log_Pos: 319
...
51 www.percona.com
Main troubleshooting tools
• Tables in Performance Schema and system database
• replication connection configuration
• replication applier configuration
• replication connection status
• replication applier status
• replication applier status by coordinator
• replication applier status by worker - MTS only
• mysql.slave master info
• mysql.slave relay log info
• mysql.slave worker info
51 www.percona.com
Main troubleshooting tools
• Multi-threaded slave (MTS)
mysql> select * from replication_applier_status_by_workerG
*************************** 1. row ***************************
CHANNEL_NAME:
WORKER_ID: 1
THREAD_ID: 25
SERVICE_STATE: ON
LAST_SEEN_TRANSACTION:
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
*************************** 2. row ***************************
CHANNEL_NAME:
WORKER_ID: 2
THREAD_ID: 26
SERVICE_STATE: ON
LAST_SEEN_TRANSACTION: d0753e78-14ec-11e5-b3fb-28b2bd7442fd:770
...
51 www.percona.com
IO thread: communication issues
• Check slave error log
• SHOW SLAVE STATUS
• P S.replication connection status
• Access error
• Try to connect using normal MySQL client using
slave credentials
• SHOW GRANTS
• Fix privileges on master
• Restart slave
52 www.percona.com
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
53 www.percona.com
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
• Maybe master events were applied in wrong order?
• Use mysqlbinlog to find queries caused the issue
• Check application, running on master
54 www.percona.com
Events applied in different order
• Happens only with STATEMENT format
• Row lock issues
• Triggers
• SET GLOBAL slave skip counter - No GTIDs!
• Skip transaction - GTIDs
• Synchronize tables!
• Different options
• Start slave with master’s options, then check
• Happens in older versions
55 www.percona.com
Slave lags behind master
• Threads
• Master runs in multiple update threads
• Slave uses single
• Seconds behind master is growing - Not 100 % reliable!
• Tune slave performance
• Multi-threaded slave
• One thread per database in 5.6
• Affected by concurrency issues
• Indexes on slave only
• For statement-based replication
56 www.percona.com
More information
57 www.percona.com
Further reading
• MySQL Troubleshooting book
• Planet MySQL
• MySQL User Reference Manual
• Bug trackers
• http://bugs.mysql.com
• https://bugs.launchpad.net/percona-server/
58 www.percona.com
Place for your questions
???
59 www.percona.com
Thank you!
http://www.slideshare.net/SvetaSmirnova
https://twitter.com/svetsmirnova
60 www.percona.com

More Related Content

What's hot

Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015
mushupl
 
Troubleshooting MySQL Performance
Troubleshooting MySQL PerformanceTroubleshooting MySQL Performance
Troubleshooting MySQL Performance
Sveta Smirnova
 
Performance Schema for MySQL Troubleshooting
 Performance Schema for MySQL Troubleshooting Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
Sveta Smirnova
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
Sveta Smirnova
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite Plugins
Sveta Smirnova
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAs
Sveta Smirnova
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL Tuning
FromDual GmbH
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
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]s
Sveta Smirnova
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
Sveta 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]s
Sveta Smirnova
 
Performance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshootingPerformance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshooting
Sveta Smirnova
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
HighLoad2009
 
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
Sergey Petrunya
 
Introduction into MySQL Query Tuning
Introduction into MySQL Query TuningIntroduction into MySQL Query Tuning
Introduction into MySQL Query Tuning
Sveta Smirnova
 
Fosdem2012 mariadb-5.3-query-optimizer-r2
Fosdem2012 mariadb-5.3-query-optimizer-r2Fosdem2012 mariadb-5.3-query-optimizer-r2
Fosdem2012 mariadb-5.3-query-optimizer-r2
Sergey Petrunya
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tango
Mauro Pagano
 
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
Sergey Petrunya
 
Need for Speed: Mysql indexing
Need for Speed: Mysql indexingNeed for Speed: Mysql indexing
Need for Speed: Mysql indexing
FromDual GmbH
 
Full Table Scan: friend or foe
Full Table Scan: friend or foeFull Table Scan: friend or foe
Full Table Scan: friend or foe
Mauro Pagano
 

What's hot (20)

Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015
 
Troubleshooting MySQL Performance
Troubleshooting MySQL PerformanceTroubleshooting MySQL Performance
Troubleshooting MySQL Performance
 
Performance Schema for MySQL Troubleshooting
 Performance Schema for MySQL Troubleshooting Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite Plugins
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAs
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL Tuning
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
 
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
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
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
 
Performance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshootingPerformance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshooting
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
 
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
 
Introduction into MySQL Query Tuning
Introduction into MySQL Query TuningIntroduction into MySQL Query Tuning
Introduction into MySQL Query Tuning
 
Fosdem2012 mariadb-5.3-query-optimizer-r2
Fosdem2012 mariadb-5.3-query-optimizer-r2Fosdem2012 mariadb-5.3-query-optimizer-r2
Fosdem2012 mariadb-5.3-query-optimizer-r2
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tango
 
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
 
Need for Speed: Mysql indexing
Need for Speed: Mysql indexingNeed for Speed: Mysql indexing
Need for Speed: Mysql indexing
 
Full Table Scan: friend or foe
Full Table Scan: friend or foeFull Table Scan: friend or foe
Full Table Scan: friend or foe
 

Viewers also liked

Sql Objects And PL/SQL
Sql Objects And PL/SQLSql Objects And PL/SQL
Sql Objects And PL/SQL
Gary Myers
 
Oracle basic queries
Oracle basic queriesOracle basic queries
Oracle basic queries
PRAKHAR JHA
 
Basic Oracle Usage v1
Basic Oracle Usage v1Basic Oracle Usage v1
Basic Oracle Usage v1
Mohamed Mohaideen Abbas
 
Basic of Oracle Application
Basic of Oracle ApplicationBasic of Oracle Application
Basic of Oracle Application
Girishchandra Darvesh
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1
Chien Chung Shen
 
Oracle architecture with details-yogiji creations
Oracle architecture with details-yogiji creationsOracle architecture with details-yogiji creations
Oracle architecture with details-yogiji creations
Yogiji Creations
 
Introduction to Oracle Database
Introduction to Oracle DatabaseIntroduction to Oracle Database
Introduction to Oracle Database
puja_dhar
 
Oracle Upgrade11gr1 Workshop1
Oracle Upgrade11gr1 Workshop1Oracle Upgrade11gr1 Workshop1
Oracle Upgrade11gr1 Workshop1
Hector Martinez
 
Oracle Essentials Oracle Database 11g
Oracle Essentials   Oracle Database 11gOracle Essentials   Oracle Database 11g
Oracle Essentials Oracle Database 11g
Paola Andrea Gonzalez Montoya
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and Architecture
Sidney Chen
 
Sql queries interview questions
Sql queries interview questionsSql queries interview questions
Sql queries interview questions
Pyadav010186
 
Oracle: Basic SQL
Oracle: Basic SQLOracle: Basic SQL
Oracle: Basic SQL
DataminingTools Inc
 
Best Practices - PHP and the Oracle Database
Best Practices - PHP and the Oracle DatabaseBest Practices - PHP and the Oracle Database
Best Practices - PHP and the Oracle Database
Christopher Jones
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
honglee71
 
Basic oracle for developer&beginner
Basic oracle for developer&beginnerBasic oracle for developer&beginner
Basic oracle for developer&beginnermaclean liu
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture ppt
Deepak Shetty
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
Jargalsaikhan Alyeksandr
 

Viewers also liked (17)

Sql Objects And PL/SQL
Sql Objects And PL/SQLSql Objects And PL/SQL
Sql Objects And PL/SQL
 
Oracle basic queries
Oracle basic queriesOracle basic queries
Oracle basic queries
 
Basic Oracle Usage v1
Basic Oracle Usage v1Basic Oracle Usage v1
Basic Oracle Usage v1
 
Basic of Oracle Application
Basic of Oracle ApplicationBasic of Oracle Application
Basic of Oracle Application
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1
 
Oracle architecture with details-yogiji creations
Oracle architecture with details-yogiji creationsOracle architecture with details-yogiji creations
Oracle architecture with details-yogiji creations
 
Introduction to Oracle Database
Introduction to Oracle DatabaseIntroduction to Oracle Database
Introduction to Oracle Database
 
Oracle Upgrade11gr1 Workshop1
Oracle Upgrade11gr1 Workshop1Oracle Upgrade11gr1 Workshop1
Oracle Upgrade11gr1 Workshop1
 
Oracle Essentials Oracle Database 11g
Oracle Essentials   Oracle Database 11gOracle Essentials   Oracle Database 11g
Oracle Essentials Oracle Database 11g
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and Architecture
 
Sql queries interview questions
Sql queries interview questionsSql queries interview questions
Sql queries interview questions
 
Oracle: Basic SQL
Oracle: Basic SQLOracle: Basic SQL
Oracle: Basic SQL
 
Best Practices - PHP and the Oracle Database
Best Practices - PHP and the Oracle DatabaseBest Practices - PHP and the Oracle Database
Best Practices - PHP and the Oracle Database
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
 
Basic oracle for developer&beginner
Basic oracle for developer&beginnerBasic oracle for developer&beginner
Basic oracle for developer&beginner
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture ppt
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 

Similar to Basic MySQL Troubleshooting for Oracle Database Administrators

MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527
Saewoong Lee
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
Sveta Smirnova
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
Anis Berejeb
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
Anis Berejeb
 
Percona Live 2019 - MySQL Security
Percona Live 2019 - MySQL SecurityPercona Live 2019 - MySQL Security
Percona Live 2019 - MySQL Security
Vinicius M Grippa
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAs
Sveta Smirnova
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
Roland Bouman
 
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
Zohar Elkayam
 
Advanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisAdvanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and Analysis
MYXPLAIN
 
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)
YoungHeon (Roy) Kim
 
Percona Live UK 2014 Part III
Percona Live UK 2014  Part IIIPercona Live UK 2014  Part III
Percona Live UK 2014 Part III
Alkin Tezuysal
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a Nutshell
Emily Ikuta
 
DB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQLDB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQL
Marcelo Altmann
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOps
Sveta Smirnova
 
Streaming ETL - from RDBMS to Dashboard with KSQL
Streaming ETL - from RDBMS to Dashboard with KSQLStreaming ETL - from RDBMS to Dashboard with KSQL
Streaming ETL - from RDBMS to Dashboard with KSQL
Bjoern Rost
 
Tek tutorial
Tek tutorialTek tutorial
Tek tutorial
Ligaya Turmelle
 
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
Sveta Smirnova
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
Dave Stokes
 
OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert VanderkelenOSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
NETWAYS
 

Similar to Basic MySQL Troubleshooting for Oracle Database Administrators (20)

MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
 
Mysql tracing
Mysql tracingMysql tracing
Mysql tracing
 
Percona Live 2019 - MySQL Security
Percona Live 2019 - MySQL SecurityPercona Live 2019 - MySQL Security
Percona Live 2019 - MySQL Security
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAs
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
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
 
Advanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisAdvanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and Analysis
 
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)
 
Percona Live UK 2014 Part III
Percona Live UK 2014  Part IIIPercona Live UK 2014  Part III
Percona Live UK 2014 Part III
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a Nutshell
 
DB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQLDB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQL
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOps
 
Streaming ETL - from RDBMS to Dashboard with KSQL
Streaming ETL - from RDBMS to Dashboard with KSQLStreaming ETL - from RDBMS to Dashboard with KSQL
Streaming ETL - from RDBMS to Dashboard with KSQL
 
Tek tutorial
Tek tutorialTek tutorial
Tek tutorial
 
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
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert VanderkelenOSMC 2008 | Monitoring MySQL by Geert Vanderkelen
OSMC 2008 | Monitoring MySQL by Geert Vanderkelen
 

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 Monitoring
Sveta 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 Have
Sveta Smirnova
 
MySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersMySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for Developers
Sveta Smirnova
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOps
Sveta 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 Business
Sveta Smirnova
 
Производительность MySQL для DevOps
 Производительность MySQL для DevOps Производительность MySQL для DevOps
Производительность MySQL для DevOps
Sveta 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 Cluster
Sveta 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 tears
Sveta 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 и улучшения Percona
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
 
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
Что нужно знать о трёх топовых фичах MySQL
Sveta 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 Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
Sveta Smirnova
 
Optimizer Histograms: When they Help and When Do Not?
Optimizer Histograms: When they Help and When Do Not?Optimizer Histograms: When they Help and When Do Not?
Optimizer Histograms: When they Help and When Do Not?
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
 
Производительность MySQL для DevOps
 Производительность MySQL для DevOps Производительность MySQL для DevOps
Производительность MySQL для 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 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?
 
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 Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
 
Optimizer Histograms: When they Help and When Do Not?
Optimizer Histograms: When they Help and When Do Not?Optimizer Histograms: When they Help and When Do Not?
Optimizer Histograms: When they Help and When Do Not?
 

Recently uploaded

“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 

Recently uploaded (20)

“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 

Basic MySQL Troubleshooting for Oracle Database Administrators

  • 1. Basic MySQL Troubleshooting for Oracle Database Administrators Sveta Smirnova Principal Support Engineer October, 29, 2015
  • 2. Table of Contents •MySQL Server overview •Basic troubleshooting techniques •High concurrency issues •Replication 2 www.percona.com
  • 3. MySQL Server overview 3 www.percona.com
  • 4. MySQL architecture Connectors: C, JDBC, ODBC, Python, ... Connection Pool: Authentication, Caches SQL interface Parser Optimizer Caches and Buffers: Global Engine-specific Storage engines: InnoDB, TokuDB, ... File system: Data, Index, logs, other files • Base • Installation layout • Log files • Connectors • Clients, APIs • Optimizer • Cache and buffers • Storage engines • Management 4 www.percona.com
  • 5. Typical installation layout • datadir • Schema directory • Table and trigger files: *.frm, *.ibd, *.MYD, *.par, etc. • Schema • ... • InnoDB shared tablespace • Log files • InnoDB redo log files • Binary, relay log files • Error log • Slow query log • General query log • Configurable • You can setup custom path for each component • Including custom paths for tables 5 www.percona.com
  • 6. Connectors for MySQL server • Clients • MySQL CLI • MySQL Workbench • Many other graphical and web-based • APIs • Exist for most popular programming languages • C, C++, JDBC, PHP, Python, Net, ODBC, more 6 www.percona.com
  • 7. Monitoring solutions • Command-line • Percona Toolkit • MySQL Utilities • With GUI • MySQL Enterprise Monitor (MEM) • MEM plugin for Oracle Enterprise Manager • VividCortex • Many others 7 www.percona.com
  • 8. Plugins • Storage engines • Authentication • Audit • Query rewrite • More 8 www.percona.com
  • 9. Storage engines • Own data • Own index format • Own locking model • Own diagnostic • Own log files • CHECK TABLE 9 www.percona.com
  • 11. Error processing • Warnings, errors, and notes 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) 11 www.percona.com
  • 12. Error handling in applications • Error information • mysql error • mysql errno • Warnings and notes • mysql info • mysql sqlstate • mysql warning count 12 www.percona.com
  • 13. Error handling in stored routines • GET DIAGNOSTICS • GET DIAGNOSTICS rows = ROW COUNT, conditions = NUMBER; • GET DIAGNOSTICS CONDITION 1 code = RETURNED SQLSTATE, msg = MESSAGE TEXT; • SIGNAL/RESIGNAL • Can be used for custom errors 13 www.percona.com
  • 14. More information about errors [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 14 www.percona.com
  • 15. MySQL Access Privilege System • No roles by default, limited user limits • All records are in the mysql database (schema) • Pluggable authentication since version 5.5 • Connections • TCP/IP with login-password • Socket (Unix) • Named pipe (Windows) 15 www.percona.com
  • 16. Common user access issues • Privileged client cannot connect • Unprivileged client can connect • Privileged user cannot perform operation • Unprivileged user has undesired access 16 www.percona.com
  • 17. Common queries for access issues 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) • Most descriptive host first, then wildcard • Socket connection by default on Unix 17 www.percona.com
  • 18. Wrong access checklist • SHOW GRANTS [FOR user@host] • Grant tables • mysql.db • mysql.tables priv • mysql.columns priv • mysql.procs priv • mysql.proxies priv • SELECT USER(), CURRENT USER() 18 www.percona.com
  • 19. Wrong access example 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) 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) 19 www.percona.com
  • 20. Connection statistics in P S • Tables accounts, users, hosts mysql> select user, host, current_connections as cur, -> total_connections as total from performance_schema.accounts; +------+-----------+-----+-------+ | user | host | cur | total | +------+-----------+-----+-------+ | foo | localhost | 0 | 3 | | root | localhost | 1 | 3 | | NULL | NULL | 14 | 17 | +------+-----------+-----+-------+ 3 rows in set (0.01 sec) • HOST CACHE 20 www.percona.com
  • 21. Connection statistics in P S • Tables accounts, users, hosts • HOST CACHE • Content of DNS cache • Errors from: • Name Server • Connection • Authentication • max connect errors, max user errors, etc. • Your first assistant in case of connection issue 20 www.percona.com
  • 22. Performance Schema • Monitors interval operations • Statements • Stages • Locks • Memory • Variables • Replication • IO • Mutexes and waits • Similar to Oracle wait interface 21 www.percona.com
  • 23. What can affect query execution? • You run a query, it does not return an error, but still behaves not as expected • It can be: • Startup options or system variables • How optimizer creates query plan • Storage engine used • Parallel execution - next big section 22 www.percona.com
  • 24. System variables and options: scope • Global • Control parameters, necessary for all server processes • Location of server files: datadir etc. • Shared buffers • More • Session • Control connection-specific parameters • MySQL option tables 23 www.percona.com
  • 25. System Variables: how to set • SET [GLOBAL] var name = NEW VAL • Command-line option • Configuration file • In default location • Specified by option –defaults-file 24 www.percona.com
  • 26. System Variables: who can change • Global options and few session options • A user with privilege SUPER • Session options • Anybody • There are no limits! 25 www.percona.com
  • 27. Buffers: when allocated • Those which control behavior of whole server • Once at server startup • Can start with low values, then grow to specified • Connection options • For every connection when connection opens • Operation-specific • For every operation when needed • Can be allocated more than once per query 26 www.percona.com
  • 28. System variables: control before 5.7 • SHOW [GLOBAL] STATUS • Tables in Information Schema • GLOBAL ,SESSION VARIABLES • GLOBAL ,SESSION STATUS • GLOBAL • Since server start • SESSION • For operations in current session • Can be reset • FLUSH STATUS 27 www.percona.com
  • 29. System status variables: example mysql> show global status like ’Handler_read_rnd_next’G *************************** 1. row *************************** Variable_name: Handler_read_rnd_next 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) 28 www.percona.com
  • 30. Information Schema • Contains metadata information • Tables • Indexes • Other • Allows to create plugins • InnoDB plugins • Similar to Data Dictionary Views in Oracle 29 www.percona.com
  • 31. System variables: control in 5.7 • Performance Schema tables • variabes by* • user variables by* • status by* • Statistics grouped by • Global • Session • Thread • Account/Host/User 30 www.percona.com
  • 32. System variables: 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 www.percona.com
  • 33. 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 www.percona.com
  • 34. MySQL Optimizer • EXPLAIN is less powerful if compare with Oracle • Visual EXPLAIN in MySQL Workbench • EXPLAIN EXTENDED • Should be followed by SHOW WARNINGS • EXPLAIN PARTITIONS • EXPLAIN FORMAT=JSON • INFORMATION SCHEMA.TRACE • Status variables ’Handler %’ 33 www.percona.com
  • 35. EXPLAIN in Oracle • http://docs.oracle.com/cd/B10500_01/server. 920/a96533/ex_plan.htm 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 34 www.percona.com
  • 36. EXPLAIN in MySQL 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‘.‘Host‘ AS ‘host‘ from ‘mys 35 www.percona.com
  • 37. EXPLAIN: overview mysql> explain extended select * from t1 join t2 where t1.int_key=1; +----+-------------+-------+-------+---------------+---------+---------+-------+------+------+----------- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | f... | Extra +----+-------------+-------+-------+---------------+---------+---------+-------+------+------+----------- | 1 | SIMPLE | t1 | ref | int_key,ik | int_key | 5 | const | 4 | 100. | NULL | 1 | SIMPLE | t2 | index | NULL | pk | 9 | NULL | 6 | 100. | Using inde Using join (Block Nes +----+-------------+-------+-------+---------------+---------+---------+-------+------+------+----------- 2 rows in set, 1 warning (0.00 sec) Note (Code 1003): /* select#1 */ select ‘test‘.‘t1‘.‘pk‘ AS ‘pk‘,‘test‘.‘t1‘.‘int_key‘ AS ‘int_key‘,‘test AS ‘pk‘,‘test‘.‘t2‘.‘int_key‘ AS ‘int_key‘ from ‘test‘.‘t1‘ join ‘test‘.‘t2‘ where (‘test‘.‘t1‘.‘int_key‘ Number of select Select type Tables, for which information is printed How data is accessed Possible keys Key, which was actually used Length of the key Which columns were compared with the index Number of examined rows % of filtered rows rows x filtered / 100 — number of rows, which will be joined with another table Additional information Table, for which information is printed Product of rows here: how many rows in all tables will be accessed For this example estimated value is 4*6 = 24 Actual (optimized) query as executed by MySQL Server 36 www.percona.com
  • 38. EXPLAIN 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": 8, "filtered": 100, "using_index": true } } } 37 www.percona.com
  • 39. When EXPLAIN lies: Handler % variables mysql> flush status; Query OK, 0 rows affected (0.00 sec) 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 | ... 38 www.percona.com
  • 40. MySQL Optimizer: other tools • INFORMATION SCHEMA.OPTIMIZER TRACE • join preparation, join optimization, join execution • considered execution plans, refine plan, more • Query Analyzer in MEM • Visual EXPLAIN in MySQL Workbench 39 www.percona.com
  • 41. MySQL Storage Engines • Own way to handle • Corruption • Index statistics • CHECK TABLE to check for errors • They care about physical data, so all data information is on their level • Options usually start from engine name • myisam *, innodb *, custom * 40 www.percona.com
  • 42. Storage Engines explained • InnoDB • TokuDB • Popular non-transactional engines • MyISAM - Previous default engine • Memory • Federated • CSV • Blackhole 41 www.percona.com
  • 43. Storage Engines explained • InnoDB • Most used storage engine • Physical layout • *frm file – table definition • Shared tablespace • *ibd file – tablespace for individual table - –innodb file per table = 1 • Redo log files • Automatic startup check 41 www.percona.com
  • 44. Storage Engines explained • InnoDB • Own locking model: row-based • Troubleshooting tools • InnoDB Monitors (SHOW ENGINE InnoDB STATUS) • Tables in Information Schema • Instrumentation in Performance Schema 41 www.percona.com
  • 45. Storage Engines explained • TokuDB • Fractal tree • Optimized for compression and writes • Troubleshooting tools • SHOW ENGINE tokudb STATUS • Information schema tables • Status variables 41 www.percona.com
  • 46. Storage Engines explained • Popular non-transactional engines • Server provides locking model • Table-level locks • Can have own instrumentation • MyISAM • Status variables • Performance Schema • Set of utilities, names start from myisam * 41 www.percona.com
  • 47. High concurrency issues 42 www.percona.com
  • 48. Common concurrency issues • Query or transaction waits a lock, held by another one • Fight for system resources • Resource overload • Resource underload 43 www.percona.com
  • 49. Lock types and transactions • Lock types • Levels • MDL • Table-level • Row-level • What do they lock • Read locks • Block writes • Write locks • Block reads and writes • Transactions • Server-level • MDL locks • Table locks • Engine-level • Table locks • Row locks • AUTOCOMMIT • supported 44 www.percona.com
  • 50. Locks diagnostic • SHOW [FULL] PROCESSLIST • SHOW ENGINE INNODB STATUS • INFORMATION SCHEMA • PROCESSLIST • InnoDB table • Performance Schema • METADATA LOCKS • TABLE HANDLES • EVENTS TRANSACTIONS * • Both server-level and engine-level • Contain GTID information 45 www.percona.com
  • 51. Locks diagnostic • SHOW [FULL] PROCESSLIST mysql> select id, state, info from information_schema.processlistG ******************** 1. row ******************** id: 5 state: info: NULL ******************** 2. row ******************** id: 4 state: Waiting for table metadata lock info: alter table titles add column f1 int ******************** 3. row ******************** id: 2 state: executing info: select id, state, info from information_schema.processlist 45 www.percona.com
  • 52. Locks diagnostic • Performance Schema 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 45 www.percona.com
  • 53. Locks diagnostic • SHOW ENGINE INNODB STATUS ------------- TRANSACTIONS ------------- Trx id counter 0 26243837 Purge done for trx’s n:o < 0 26243834 undo n:o < 0 0 History list length 2 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 0 26243836, ACTIVE 4 sec, OS thread id 101514240 starting index read mysql tables in use 1, locked 1 LOCK WAIT 2 lock struct(s), heap size 320, 1 row lock(s) MySQL thread id 4485, query id 25022137 localhost root Updating update t set a=36 where a=6 45 www.percona.com
  • 54. InnoDB Monitors • SHOW ENGINE INNODB STATUS • Permanent output • innodb status output • innodb status output locks • innodb-status-file - Deleted on normal shutdown! 46 www.percona.com
  • 55. Other InnoDB diagnostic • INFORMATION SCHEMA • INNODB TRX • INNODB LOCKS • INNODB LOCK WAITS • INNODB METRICS • Options innodb monitor * • Option innodb print all deadlocks 47 www.percona.com
  • 56. Locks diagnostic summary • Table-level • PROCESSLIST: ”Waiting for table lock” • P S.TABLE HANDLES • Row-level • InnoDB monitors • SHOW ENGINE INNODB STATUS • Tables in INFORMATION SCHEMA • Option –innodb print all deadlocks • MDL • PROCESSLIST • ”Waiting for metadata lock” • P S.METADATA LOCKS 48 www.percona.com
  • 58. MySQL Replication Overview • Always available, needs to be setup • Asynchronous master-slave • Master • Keeps all updates in binary log file • Two formats: ROW and STATEMENT • Slave • IO thread read updates from master and stores in relay log file • SQL thread executes updates • Multiple SQL threads since 5.6 • Multiple masters since 5.7 • GTIDs since 5.6 50 www.percona.com
  • 59. Main troubleshooting tools • SHOW SLAVE STATUS • Tables in Performance Schema and system database • Multi-threaded slave (MTS) has additional output for each worker • Error log file 51 www.percona.com
  • 60. Main troubleshooting tools • SHOW SLAVE STATUS mysql> show slave status G ************************ 1. row ************************ Slave_IO_State: Queueing master event to the relay log ... Master_Log_File: master-bin.000003 Read_Master_Log_Pos: 191 Relay_Log_File: slave-relay-bin.000006 Relay_Log_Pos: 4 Relay_Master_Log_File: master-bin.000002 Slave_IO_Running: Yes Slave_SQL_Running: Yes ... Last_Errno: 0 Last_Error: ... Exec_Master_Log_Pos: 319 ... 51 www.percona.com
  • 61. Main troubleshooting tools • Tables in Performance Schema and system database • replication connection configuration • replication applier configuration • replication connection status • replication applier status • replication applier status by coordinator • replication applier status by worker - MTS only • mysql.slave master info • mysql.slave relay log info • mysql.slave worker info 51 www.percona.com
  • 62. Main troubleshooting tools • Multi-threaded slave (MTS) mysql> select * from replication_applier_status_by_workerG *************************** 1. row *************************** CHANNEL_NAME: WORKER_ID: 1 THREAD_ID: 25 SERVICE_STATE: ON LAST_SEEN_TRANSACTION: LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00 *************************** 2. row *************************** CHANNEL_NAME: WORKER_ID: 2 THREAD_ID: 26 SERVICE_STATE: ON LAST_SEEN_TRANSACTION: d0753e78-14ec-11e5-b3fb-28b2bd7442fd:770 ... 51 www.percona.com
  • 63. IO thread: communication issues • Check slave error log • SHOW SLAVE STATUS • P S.replication connection status • Access error • Try to connect using normal MySQL client using slave credentials • SHOW GRANTS • Fix privileges on master • Restart slave 52 www.percona.com
  • 64. 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 53 www.percona.com
  • 65. 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 • Maybe master events were applied in wrong order? • Use mysqlbinlog to find queries caused the issue • Check application, running on master 54 www.percona.com
  • 66. Events applied in different order • Happens only with STATEMENT format • Row lock issues • Triggers • SET GLOBAL slave skip counter - No GTIDs! • Skip transaction - GTIDs • Synchronize tables! • Different options • Start slave with master’s options, then check • Happens in older versions 55 www.percona.com
  • 67. Slave lags behind master • Threads • Master runs in multiple update threads • Slave uses single • Seconds behind master is growing - Not 100 % reliable! • Tune slave performance • Multi-threaded slave • One thread per database in 5.6 • Affected by concurrency issues • Indexes on slave only • For statement-based replication 56 www.percona.com
  • 69. Further reading • MySQL Troubleshooting book • Planet MySQL • MySQL User Reference Manual • Bug trackers • http://bugs.mysql.com • https://bugs.launchpad.net/percona-server/ 58 www.percona.com
  • 70. Place for your questions ??? 59 www.percona.com