메뉴 건너뛰기

Korea Oracle User Group

Guru's Articles

SQL Tuning Workshop

명품관 2020.02.20 17:18 조회 수 : 8155

SQL Tuning Workshop

Last week I had the pleasure of delivering a five-part SQL Tuning Workshop for my local Oracle User Group –  Northern California Oracle User Group. The workshop explains the fundamentals of the cost-based optimizer, the statistics that feed it, the hints that influence it and key tools you need to exam executions plans.

The workshop also provides a methodology for diagnosing and resolving the most common SQL execution performance problems. Given the volume of interest in this content, I want to share all of the material from the workshop here and give you links to additional material on each of the 5 topics.

Part 1 Understanding the Optimizer
The first part of the workshop covers the history of the Oracle Optimizer and explains the first thing the Optimizer does when it begins to optimize a query – query transformation.

Query transformations or the rewriting of the SQL statement into a semantically equivalent statement allows the Optimizer to consider alternative methods of processing or executing that query, which are often more efficient than the original SQL statement would allow. the majority of Oracle’s query transactions are now cost based, which means the Optimizer will cost the plan with and with the query transformation and pick the plan with the lowest cost. With the help of the Optimizer development team, I’ve already blogged about a number of these transformations including:

 

Part 2 Best Practices for Managing Optimizer Statistics
Part 2 of the workshop focuses on Optimizer Statistics and the best practices for managing them, including when and how to gather statistics, including fixed object statistics.

It also covers what additional information you may need to give the Optimizer such as histogramsextended statistics, as well as all of the techniques you can use to speed up statistics gathering including taking advantage of Incremental statisticsparallelism and concurrency. Finally we look at some guidance on when not to gather statistics. A lot of the topics covered in this presentation are discussed in details in the following two white papers:

 

Part 3 Explain the Explain Plan
Part 3 of the workshop examines the different aspects of an execution plan, from cardinality estimates to parallel execution and explains what information you should be gleaming from the plan and how it affects the execution. It offers insight into what caused the Optimizer to make the decision it did as well as a set of corrective measures that can be used to improve each aspect of the plan.

More information on displaying and reading execution plans can be found in my previous blog posts on DBMS_XPLAN.DISPLAY_CURSOR and using SQL Monitor. Or in the white paper Explain the Explain Plan.

 

Part 4 Influencing Execution Plans with Optimizer Hints
Part 4 is called “Harnessing the power of optimizer hints”. Although I am not a strong supporter of adding hints to SQL statements for a whole host of reasons, from time to time, it may become necessary to influence the plan the Optimizer chooses. The most powerful way to alter the plan chosen is via Optimizer hints. But knowing when and how to use Optimizer hints correctly is somewhat of a dark art. This session explains how Optimizer hints are interpreted, when and where they should be used, and why they sometimes appear to be ignored.

Part 5 SQL Tuning Tips and Tricks
The final part of the SQL Tuning workshop focuses on applying the techniques discussed in the previous sections to help diagnose and correct a number of problematic SQL statements and shows how you can use SQL Plan Management  or a SQL Patch to influence an execution plan.

Hope you find the materials useful!

 

출처 : https://sqlmaria.com/2020/02/19/sql-tuning-workshop/

번호 제목 글쓴이 날짜 조회 수
공지 Guru's Article 게시판 용도 ecrossoug 2015.11.18 605
44 Troubleshooting Another Complex Performance Issue – Oracle direct path inserts and SEG$ contention file ecrossoug 2015.11.16 99
43 On Invokers and Outs file 명품관 2015.11.23 102
42 Parallel Execution 12c New Features Overview file 명품관 2015.11.23 110
41 NOUG Session: How Cache Fusion Works file ecrossoug 2015.11.18 136
40 (유투브) KISS series on Analytics: Dealing with null - Connor McDonald 명품관 2016.01.05 155
39 Upgrade a Pluggable Database in Oracle 12c 명품관 2015.12.30 170
38 What is an In-Memory Compression Unit (IMCU)? 명품관 2016.02.24 181
37 Hybrid Columnar Compression Common Questions 명품관 2016.03.04 191
36 Quick tip on Function Based Indexes 명품관 2016.04.19 191
35 Oracle Enterprise Manager Cloud Control 13c Release 1 (13.1.0.0) Installation on Oracle Linux 6 and 7 명품관 2015.12.23 200
34 How do I capture a 10053 trace for a SQL statement called in a PL/SQL package? 명품관 2016.01.06 263
33 How many checkpoints in Oracle database ? [1] file 명품관 2015.11.20 283
32 Parameter Recommendations for Oracle Database 12c - Part II 명품관 2016.03.18 353
31 V$EVENT_NAME 뷰의 Name 컬럼에 정의된 event name에서 오는 오해 명품관 2017.03.08 370
30 On ROWNUM and Limiting Results (오라클 매거진 : AskTom) 명품관 2016.04.28 384
29 Can I apply a BP on top of a PSU? Or vice versa? 명품관 2016.06.01 398
28 New Features of Backup & Recovery in Oracle Database 19c 명품관 2019.02.07 431
27 SQL Window Functions Cheat Sheet 명품관 2020.05.26 440
26 Why You Can Get ORA-00942 Errors with Flashback Query 명품관 2016.02.01 448
25 Explaining the Explain Plan – How to Read and Interpret Execution Plans 명품관 2021.02.09 490
위로