<Insert Picture Here> Looking at Performance - What s new in MySQL Workbench 6.2 Mario Beck MySQL Sales Consulting Manager EMEA
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. 2
Agenda Very Brief Product History & Overview What s New Performance Tools Performance Dashboard Performance Schema Reports and Sys Schema Visual Explain 2 Request Results Status Details View Other related extras and tips 3
MySQL Workbench Overview Design, Develop, Administer, Migrate And now adding Performance MySQL Database IDE Millions of Users Millions of Downloads Windows, OS X, Linux 4
History Workbench 6.1 New Performance Tools fabforce.net DBDesigner4 Workbench 5.0/5.1 EER Designer Windows Workbench 5.2 Design Admin Develop Migrate Native X-Platform Workbench 6.0 New GUI Enhanced Workflow Query Browser Administrator Migration Toolkit 5
Performance Dashboard 6
Previously Basic Health Graphs On the server CPU Load Linux Load Average Windows CPU usage % Mac Load Average Total Connections Network Traffic MySQL Only Byte Sent + Bytes Rcved Total QPS for entire server Total Ops Percentage of Pages Free/Total 7
Performance Dashboard Connect (DB Click or Open and Connect) Go to Management Tab If needed (Bottom Left) Go to Dashboard New Performance Section 8
The Dashboard 3 core areas Network, General Server, InnoDB Network to Disk Left to Right, Top to Bottom 9
General Dashboard Max Time Window is ~2.5 minutes Data is transient Nothing is stored long term in WB For storing history of performance use MEM Plenty of mouse over's for details and descriptions 10
Incoming / Outgoing Traffic Mouse over for Details 11
SQL Statements By Select, DML, DDL Mouse over for Details 12
Table Cache and Buffer Pool Hits and Misses in Mouse Over 13
Track Writes and Reads, Redo Log, Db Write Buffer 14
Performance Schema Reports and Sys Schema 15
What are Performance Reports for Finding problems looking at the whole server Queries IO and Files Buffers Threads Connections Etc 16
Performance Schema Reports Connect (DB Click or Open and Connect) Go to Management Tab If needed (Bottom Left) Go to Performance Reports New Performance Section 17
Open Settings Before Running Performance Reports 18
First Run Installs the SYS schema Or updates to newer version in needed 19
SYS now Added No Tables Only Views SPs Functions Operates on Performance Schema Information Schema 20
Notice x$<view name> 21
Unit String within result versus (x$) Single Unit Providing 2 options One is easy To read in a query Other (x$) is easier To compare To Export to spreadsheet To Graph To consume in code 22
SYS - SPs and Functions SPs Used to simplify management FUNCTIONS Used for Formatting and Simple Checks 23
Many WB Performance Reports WB wrappers many SYS views If we ve missed a needed report or view Let us know Happy to add more Even if not performance related Could go in an Inspector 24
General Lay Out - Header Title and Brief Description Sortable Columns Column Labels indicate Units 25
General Lay Out Footer - Export 26
Load Spreadsheet 27
Graph and Analyze Further 28
General Lay Out Footer - Copy Selected 29
General Lay Out Footer - Copy Selected 30
Using the Performance Reports 4 Categories IO High Cost SQL Statements Database Statistics Wait Event Times InnoDB Statistics 31
IO Reports For Files, Event Categories, User/Thread Quickly View, Sort By #, Time, Reads, Writes, Percentages Look for Hot Spots Use to determine system requirements, tuning, etc. 32
High Cost SQL Statements Look at query statements and statistics Look for Full Table Scans Frequency of execution Errors, Warnings Long Runtimes Total, Max, Ave Large numbers of Rows Total, Max, Ave Usage of Temp Tables 33
Database Schema Statistics Quickly Review Various Stats Counts Rows Timing Paging Buffering IOs Easily find Full Scans Spot Unused Indexes Also See Schema/Table Inspectors Table, Column, Index, Statis 34
Wait Event Times (For Experts) Wait Event Analysis is Complex However for power expert users These reports show collected data Show the queries used to collect Provides Statistics Breaks out events by Users and Classes 35
InnoDB Statistics Quick views Aggregated By Schema By Table Easy to sort by Allocation, Data, Pages, Pages hashed, Old Pages Rows cached 36
Schema Inspector/Table Inspector Review and Maintain Assess Tables Engine Types Statistics Column Types Size Indexes and Triggers 37
Look at details TABLEs Inspect sizes, engine types COLUMNs 38
Go To Maintenance Options 39
Maintenance Multi-select Apply Confirm Access to table maintenance ANALYZE updates statistics important for innodb tables OPTIMIZE TABLE formats data more efficiently on disk CHECK if not valid may be having some problems important for myisam 40
Perform Maintenance or Checks 41
Visual Explain 2 42
What are Explain Plans for When you're working on a specific query To optimize performance Understand how it executes Hints for how to restructure query Add indexes Change design of schema Etc 43
Running an Explain SELECT * FROM sakila.film_list; Runs EXPLAIN FORMAT=JSON (for 5.6 and up) 44
Visualization of the Query Plan Complex Query 45
What you ll see Based on MySQL Version The higher the version the more details in latest JSON explain data The more details in JSON Explain Data the more Workbench shows Some simpler terms versus JSON explain Output For example ALL -> Full Table Scan REF -> Non-Unique Key Lookup 46
Boxes and Colors Color Hint at Importance Bad to Good - Red, Yellow, Green Boxes are A lookup Action Hover over for details Type Objects References Possible Issues Optimization Hints/Ideas 47
How to read Lines, Numbers, and Labels Bottom # How many rows Number of rows 992 from loop is 16x31x1x2x1 Joined values are here Category_Id Film_id Actor_id 48
Costs Prefix Cost (read + Eval) Read Cost Eval Cost Data Read Per Join Rows Returned Cost Shown on Left Hand Side based on Cost Type Selected 49
Query Results Details View 50
Look at general response time Duration = Execution time on the server Fetch = Time to transfer the result (Network + Client App Latency) 51
New Side Tabs 52
Easy to use form Editor 53
Results field type view 54
Query statistics Server # more accurate typically 55
If you get a message like this Either PS is off see next page OR You didn t run mysql_upgrade 56
New Screen Performance Schema Setup YES its on, NO its off Advanced for power users 57
New Connection Screen Features 58
Improved Connections Screen Connections From Where Who / What Which DB How long Look for Unexpected apps Analysis Jobs Right Click View Thread Stack Go to Explain Plan (5.7) Time Duration Look for high time values for Queries for example 59
Grab SQL from a Connection To try it - in WB editor run select * from actor where (select sleep(30)); Show SQL from a Connection in Editor Format SQL so its more readable Execute to see timing Run Explain on the SQL 60
Final Tips 61
Know and inspect the model Insight into improving design, improving indexing, how to write SQL 62
Monitor What s Slow Slow Query Log Enable, Set time in seconds, Set to 0 to test 63
Look At Server Logs Go to Slow Query Log 64
Quick Links Download: http://dev.mysql.com/downloads/tools/workbench/ Bugs: http://bugs.mysql.com Forums: http://forums.mysql.com/index.php?151 65
Supporting Resources Oracle and MySQL MySQL MySQL Workbench Team Blog https://blogs.oracle.com/mysqlworkbench/ MySQL Community Edition MySQL Enterprise Edition MySQL Blog, Twitter, Facebook Optimizer Blog http://oysteing.blogspot.co.uk/ 66