D73549GC10 01

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

1

Course Introduction

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.


Course Objectives

After completing this course, you should be able to:


• Choose an appropriate SQL tuning approach
• Gather the suspected session statistics by using the SQL
trace facility and interpret the traced information
• Identify poorly performing SQL statements
• Use basic tuning techniques to tune inefficient SQLs
• Interpret execution plans
• Describe the Oracle optimizer fundamentals
– Explain the various phases of optimization
– Control the behavior of the optimizer
– Optimizer access paths, join, and other operations
– Optimizer statistics best practices
• Manage SQL performance through changes

1-2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Course Outline Map
Introduction
Ch1: Course Introduction

SQL Tuning Approaches


Ch2: Introduction to SQL Tuning

Data Collection
Ch3: Using SQL Trace Facility and TKPROF

Restructure SQL
Ch4: Using Basic Techniques

Choose a SQL Tuning Strategy


Plan Analysis Approach

Quick Tuning Approach Optimizer Statistics


Ch5: Optimizer Fundamentals Ch10: Optimizer Statistics Best Practices

Plan Comparison Strategy Tune Access Paths Tune Join Operations


Ch6: Understanding Serial Ch7: Optimizer Access Paths Ch8: Optimizer Join Operations
Execution Plans

Advanced SQL Tuning Analysis


Tune Other Operations Parse Time Reduction Strategy
Appendix A: SQL Tuning Advisor
Ch9: Optimizer Others Ch11: Using Bind Variable Appendix B: SQL Access Advisor

Maintain SQL Plans Workshop


Ch12: SQL Plan Management Ch13: Workshop

1-3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Audience and Prerequisites

• This course is intended for experienced Oracle SQL


developers or Oracle DBAs who require a thorough
understanding of Serial SQL execution.
• A good working knowledge and understanding of SQL
statements is assumed.
• The following prior training for Oracle Database 11g is
recommended: Introduction to SQL course or equivalent
experience

1-4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Course Schedule

• Day 1: • Day 3:
1. Course Introduction 10. Optimizer Statistics
11. Using Bind Variables
2. Introduction to SQL Tuning
12. SQL Plan Management
3. Using SQL Trace 13. Workshop
Facility & TKPROF
4. Using Basic Techniques
5. Optimizer Fundamentals
• Day 2:
6. Understanding Serial Execution Plans
7. Optimizer Access Paths
8. Optimizer Join Operations
9. Optimizer Other Operators

1-5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Activities

This course includes three types of activities to help you


understand the concepts:
• Quizzes test your knowledge of the important concepts in
each chapter.
• Practices reinforce your learning through guided, hands-on
practices.
• Workshops give you an opportunity to practical experience
through problem-solving workshops.

1-6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
About You

To ensure that the class is customized to meet your specific


needs and to encourage interaction, answer the following
questions:
• Which organization do you work for?
• What is your role in your organization?
• What is your level of SQL tuning expertise?
• What Oracle versions do you use?
• What do you hope to learn from this class?

1-7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Sample Schemas Used in the Course

• Sales History (SH) schema


• Human Resources (HR) schema

1-8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Human Resources (HR) Schema

DEPARTMENTS LOCATIONS
department_id location_id
department_name street_address
manager_id postal_code
location_id city
state_province
country_id

JOB_HISTORY
employee_id
start_date EMPLOYEES
end_date employee_id
job_id first_name
department_id last_name COUNTRIES
email country_id
phone_number country_name
hire_date region_id
job_id
salary
commission_pct
manager_id
JOBS
department_id
job_id
job_title
min_salary REGIONS
max_salary region_id
region_name

1-9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Sales History (SH) Schema
TIMES
PROMOTIONS time_id
day_name
promo_id day_number_in_week
promo_name day_number_in_month
promo_subcategory calendar_week_number
promo_subcategory_id fiscal_week_number
promo_category week_ending_day
promo_category_id week_ending_day_id
promo_cost calendar_month_number
promo_begin_date fiscal_month_number
promo_end_date calendar_month_desc
promo_total calendar_month_id
promo_total_id fiscal_month_id
days_in_cal_month
days_in_fis_month
end_of_cal_month
end_of_fis_month
SALES calendar_month_name
COSTS fiscal_month_name
prod_id calendar_quarter_desc
prod_id cust_id calendar_quarter_id
time_id time_id fiscal_quarter_desc
promo_id channel_id fiscal_quarter_id
channel_id promo_id days_in_cal_quarter
unit_cost quantity_sold days_in_fis_quarter
unit_price amount_sold end_of_cal_quarter
end_of_fis_quarter
calendar_quarter_number
fiscal_quarter_number
calendar_year
calendar_year_id
CHANNELS fiscal_year
channel_id fiscal_year_id
channel_desc days_in_cal_year
PRODUCTS channel_class days_in_fis_year
channel_class_id end_of_cal_year
channel_total end_of_fis_year
channel_total_id

1 - 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.


Sales History (SH) Schema
COSTS SALES SALES

PRODUCTS CUSTOMERS
prod_id cust_id
prod_name cust_first_name
prod_desc cust_last_name
prod_subcategory cust_gender
prod_subcategory_id cust_year_of_birth
prod_subcategory_desc cust_marital_status COUNTRIES
prod_category cust_street_address
cust_postal_code country_id
prod_category_id country_iso_code
prod_category_desc cust_city
cust_city_id country_name
prod_weight_class country_subregion
prod_unit_of_measure cust_state_province
cust_state_province_id country_subregion_id
prod_pack_size country_region
supplier_id country_id
cust_main_phone_number country_region_id
prod_status country_total
prod_list_price cust_income_level
cust_credit_limit country_total_id
prod_min_price country_name_hist
prod_total cust_email
prod_total_id cust_total
prod_src_id cust_total_id
prod_eff_from cust_src_id
prod_eff_to cust_eff_from
prod_valid cust_eff_to
cust_valid

1 - 11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.


Class Account Information

• Your account IDs are sh and hr.


• The password matches your account ID.
• Each machine has a stand-alone installation of Oracle
Database 11g, Enterprise Edition for Linux, with access to
the SH and HR sample schemas.

1 - 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.


SQL Environments Available in the Course

This course setup provides the following tools for you to


execute SQL statements:
• Oracle SQL*Plus
• Oracle SQL Developer
• Oracle Enterprise Manager (EM)

1 - 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.


Workshops, Demo Scripts, and Code Example
Scripts
The workshop scripts, demo scripts, and code example scripts
and solutions are available to you.

1 - 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.


Appendixes in the Course

• Appendix A: SQL Tuning Advisor


• Appendix B: SQL Access Advisor
• Appendix C: Oracle Database Architecture

1 - 15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

You might also like