Reducing MIPS Using InfoSphere Optim Query Workload Tuner TDZ-2755A Lloyd Matthews, U.S. Senate 0
Disclaimer Copyright IBM Corporation 2010. All rights reserved. U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN ADDITION, THIS INFORMATION IS BASED ON IBM S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM WITHOUT NOTICE. IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, NOR SHALL HAVE THE EFFECT OF, CREATING ANY WARRANTIES OR REPRESENTATIONS FROM IBM (OR ITS SUPPLIERS OR LICENSORS), OR ALTERING THE TERMS AND CONDITIONS OF ANY AGREEMENT OR LICENSE GOVERNING THE USE OF IBM PRODUCTS AND/OR SOFTWARE. IBM, the IBM logo, ibm.com, DB2,IBM Optim Query Workload Tuner and DB2 SQL Performance Analyzer are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol ( or ), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at Copyright and trademark information at www.ibm.com/legal/copytrade.shtml Other company, product, or service names may be trademarks or service marks of others.
Agenda U.S. Senate Technical Environment U.S. Senate Objectives Why Tune Difficulties with SQL Tuning Tools to Assist with SQL Tuning U.S. Senate Scenarios Conclusions Questions 2
U.S. Senate Technical Environment Server System Layer SLES Enterprise Linux for Z/Series DB2 V9 NFM (z9 Series) DB2 v9.7 (Sun) Middleware Software z/os V1.9 Solaris CICS TS (3.2) Websphere 7.0 ACF2/RACF JDBC Java SE v6.0 3
U.S. Senate Objectives The ability to meet our SLA The ability to be pro-active in tuning SQL The ability to monitor, capture and analyze SQL The ability to support multiple platforms 4
Why Tune Why is query tuning important DB2 won t know what queries are going to be submitted DB2 won t know object sizes or cardinality unless statistics are gathered DB2 won t know how many rows will be fetched, unless told Performance problems can appear without warning, especially dynamic SQL Transaction goes from 1 second to 3 minutes Minimize Production outage 5
Why is query tuning Difficult Lack of Query Tuning Expertise DBA s with minimal experience Monitoring tools help but provide no direct actionable insight Complexity of analysis requires specialized skills Knowledge of DB2 engine Knowledge of workload and application Larger percentage of SQL generating applications Application development done via frameworks/code generators, so hard to pinpoint section of application code generating bad SQL Disconnect between developers and DBAs 6
IBM Tooling to Assist with Tuning Optim Query Workload Tuner (OQWT) for DB2 z/os & LUW 7 7
IBM Tooling to assist with tuning Optim Query Workload Tuner for DB2 Eclipse based interface tool Analyze one query or entire workload Rules-based analysis of SQL statement text Able to invoke Visual EXPLAIN to understand access path and cost of query blocks Able to annotate queries with statistics Able to Invoke Statistics Advisor to understand what statistics are interesting to DB2 and statistics that maybe in conflict or missing Able to invoke Index Advisor and create Virtual Indexes for What If scenarios Able to invoke Query Advisor with recommendation Able to capturing SQL from various sources (i.e., cache, catalog, file, text, QMF) Able to produce detail reports on objects Profile monitoring Supports multiple platforms 8 8
U.S. Senate approach to SQL Tuning Identify bad SQL both dynamic and static Creation of workload filtering by different criteria Run advisors on single query or workload Forecast SQL Performance Enhanced Explain Reporting 9
10 Capture SQL
Capture SQL Statement Cache 11 11
Capture SQL - Filter Name 12 12
Capture SQL - Display 13
Capture SQL - Filter Rows 14 14
15 Tuning Activities
Tuning Activities 16
Tuning Activities - Recommendations 17
Tuning Activities Access Path Graph (APG) 18
Tuning Activities Access Path Graph (APG) 19
Tuning Activities - Annotation 20
Tuning Activities Statistics Table space, Table, Index and column group statistics 21
Tuning Activities - Statistics 22
Tuning Activities - Index 23 23
Tuning Activities Virtual Index 24
Tuning Activities - Compare Graph Compare before/after table scan index scan 25
Tuning Activities Path Advisor 26 26
Tuning Activities - Query 27 27
28 Workload Scenario
Workload Scenario - Create 29
Workload Scenario Source Type 30
Workload Scenario - Filter 31
Workload Scenario Capture Type 32
Workload Scenario - Captured 33
Workload Scenario List Statements 34
Workload Scenario Filter 35 35
Workload Scenario - Explain 36
Workload Scenario - Explained 37
Workload Scenario Run Advisors 38
Workload Scenario Query Summary 39 39
Workload Scenario Query Recommendations 40 40
Workload Scenario Query Recommendation Highlighted 41 41
Workload Report Scenario 42 42
Workload Report Scenario 43 43
Conclusion We use the following features extensively when tuning SQL Statistics Advisor Query Advisor Index Advisor / What-if-Analysis Access Plan Graph and Query Annotation Workload Forecast Reports Enhanced Explain Reports 44