Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

Free Oracle Tips

HTML Text

 Home
 E-mail Us
 Oracle Articles



 Oracle Training
 Oracle News

 Oracle Forum
 Class Catalog


 Our Staff
 Our Prices
 Help Wanted!

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 UNIX
 Oracle UNIX
 Linux
 Oracle Linux
 Monitoring
 Remote help

 Remote plans
 Remote
services
 Oracle C++
 Oracle Java
 Apache
 JDeveloper
 App Server

 Applications
 Oracle Forms
 Oracle Portal
 11i Upgrades
 SQL Server
 Oracle Concepts
 HTML-DB Tips
 Software Help

 Remote Help  
 Development  

 Implementation


 Financials Training
 Oracle 11i
 Oracle Apps 11i
 Oracle Workflow
 Oracle AR 11i Class
 Oracle AP 11i class
 Oracle GL 11i class
 Oracle HR 11i class
 Oracle FA 11i class
 11i Project Mgt
 11i procurement
 11i collections


 Oracle Posters
 Oracle Books

 Oracle Tuning Book
 Oracle RAC Book
 Oracle Security
 Easy Oracle Books
 Oracle Scripts
 SQL Server DBA
 SQL Design Patterns
 WISE
 Excel-DB   


 BC Oracle News


 Rednecks!
 Dress code
 Arabian Stallion

 Burleson Arabians
 Guide Horses
 Don Burleson Blog
 Golf & Travel


 Privacy Policy
 

 

 

 
 

Oracle execution plan tips

Oracle Tips by Burleson Consulting


Understanding a SQL execution plan is critical to SQL tuning as I note in my book
"Oracle Tuning: The Definitive Reference".

The execution plan reveals the internal details about the SQL execution including table join types (nested loops, hash join, merge join), and sorting.

Creating an execution plan

For any specific SQL query you can see SQL execution plan.  In SQL*Plus you can issue the "set autotrace" command and then issue your SQL statement:

SQL> set autotrace traceonly explain
SQL> select ename from emp where empno = 12;

Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'EMP'
2 1 INDEX (UNIQUE SCAN) OF 'PK_EMP' (UNIQUE)


Statistics
----------------------------------------------------------
83 recursive calls
0 db block gets
21 consistent gets
3 physical reads
0 redo size
221 bytes sent via SQL*Net to client
368 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processed

For even more detailed SQL execution statistics, see the TKPROF (SQL Trace) utility.

Reading an execution plan

For a full tutorial, get my book  "Oracle Tuning: The Definitive Reference" where I've devoted over 100 pages to reading execution plans.  My goals for SQL tuning with execution plans are simple, "Fetch the rows while minimizing data block touches":

  • Eliminate sub-optimal large-table full-table scans: Ensure that the fastest access path to the data is chosen.  The execution plan "FULL" is the key.
     
  • Use fastest table join method: The optimizer must choose intelligently between nested loop joins, hash joins and star transformation join methods and these are displayed in the execution plan.
     
  • Ensure optimal table-joining order: SQL will run fastest when the first table joins deliver the smallest result set.

In sum, I review execution plans looking for tuning opportunities as follows:

  • Add indexes (especially function-based indexes)
  • Change the optimizer parms 
  • Employ Materialized Views
  • Improve CBO statistics (especially histograms)
  • Cache high-use small tables & indexes
  • Tune the library cache (cursor_sharing, etc)
  • Adjust segment structure (large blocksizes for index range scans, small blocksizes for random OLTP)

Global tuning with execution plans

My plan9i and plan10g scripts are invaluable for holistic SQL tuning because they examine v$sql_plan and dba_hist_sql_plan and plot summary execution plans, identifying possible unnecessary large-table full-table scans (that may result from a missing index).

 

If you like Oracle tuning, you may enjoy the new book "Oracle Tuning: The Definitive Reference", over 900 pages of BC's favorite tuning tips & scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.


    Need an Oracle Health Check?
  • Do you have bad performance after an upgrade?
     
  • Need to certify that your database follows best practices?

BC Oracle performance gurus can quickly certify every aspect of your Oracle database and provide a complete verification that your database is fully optimized.

 

 

 

 
 
 

Oracle performance tuning book

 

 

Oracle performance tuning software

 
Oracle performance tuning software
 
SearchOracle web site
 
Oracle performance Tuning 10g reference poster
 
Oracle performance tuning webcast
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.
 
 


Burleson Consulting

The Oracle of database support


 

Copyright © 1996 -  2007 by Burleson Enterprises, Inc. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.


Hit Counter