Hello, you are not logged in.  Login or sign up
Toad on Twitter Follow Toad Search Toad World Search
Blogger List   

All Recent Blog Entries
 

Johannes Ahrends
Unicode and Toad

Ben Boise
Toad SC Discussions

Kevin Dalton
Benchmark Factory

Steven Feuerstein
PL/SQL Obsession

Devin Gallagher
Toad SC discussions

Stuart Hodgins
JProbe Discussions

  Henrik "Mauritz" Johnson
Toad Tips & Tricks on the "other" Toads
  Mark Kurtz
Toad SC discussions
  Michael Lumbard
Toad SC discussions
Daniel Norwood
Toad for Data Analysts,
Toad Extension for Visual Studio
Debbie Peabody
Toad for Data Analysts
Gary Piper
Toad Reports Manager
John Pocknell
Toad for Oracle, JProbe
Kuljit Sangha
Toad SC discussions
Bert Scalzo Indicates Oracle ACE status
Toad for Oracle, Data Modeling, Benchmarking
Jeff Smith
Toad product family
Richard To
SQL Optimization
Jim Wankowski
DB2 - LUW and z/OS
John Weathington
  Toad World Editor
Toad World issues

  Toad Data Modeler Opens in a new window
Data Modeling
 
  Real Automated Code Testing for Oracle
Quest Code Tester blog

Blogs
Toad and Database Commentaries

Toad World blogs are a mix of insightful how-tos from Quest experts as well as their commentary on experiences with new database technologies.  Have some views of your own to share?  Post your comments!  Note:  Comments are restricted to registered Toad World users.

Do you have a topic that you'd like discussed?  We'd love to hear from you.  Send us your idea for a blog topic.

Optimizing SQL Part 2 – Generating fewer alternative SQL statements
 
Location: Blogs Richard To's Blog    
 RichardTo Friday, October 24, 2008 4:53 AM

Written by Rene Woody

This blog is a continuation of a series (view last blog on the Optimization Process) about the SQL optimization process in the Batch Optimizer and the Tuning Lab modules of Quest SQL Optimizer for Oracle. It covers how to limit the number of SQL alternatives generated by the optimization process.

When you are optimizing a complicated SQL statement, Quest SQL Optimizer is capable of generating hundreds to even thousands of SQL alternatives. While theoretically this may be nice, it is not practical to review, select, and test hundreds of SQL statements, especially if it is a long running SQL statement.
 
The options settings in Quest SQL Optimizer for Oracle enable you to control the maximum number of SQL alternatives generated, select which Oracle optimization hints are applied, exclude a few of the transformation rules that are used, and limit the maximum number of SQL statements generated.
 
We’ll take a look at how you can do this using the Optimizer options. These options apply to the optimization process in both the Tuning Lab and the Batch Optimizer.
  1. To open the Options window, click Options .
     
  2. Select Tuning Lab | Optimizer | Intelligence.
     
  3. By default, the “intelligence level” of the optimization process is set to Predefined Settings with level 4 selected. In order to customize the number of alternative statements that are generated and other options, set the intelligence level to Custom Settings.


      
  4. Select Tuning Lab | Optimizer | Optimization.
     
  5. If the Transform view to inline view or Transform query to inline view apply to your SQL statement, fewer SQL alternatives will be generated if you unselect these options. 
     
    1. The Transform view to inline view option inserts the SELECT statement from each VIEW used in the SQL statement and then transforms the syntax of the original SQL statement and the SQL statements from the VIEWs.
       
    2. The Transform query to inline view option transforms the subquery to an inline view (a subquery used as a table in a FROM clause).
       

        
  6. Select Tuning Lab | Optimizer | Hints.
     
  7. The Oracle optimization hints are displayed on six pages. Select the hints you want to use for optimizing your SQL statements. The fewer hints selected the fewer alternative SQL statements will be generated by the SQL Optimizer.
     

     
  8. Select Tuning Lab | Optimizer | Quota.
     
  9. Set the quotas to reduce the number of SQL statements generated during the optimization process.
     
    1. The Syntax transformation quota limits the number of SQL alternatives generated during the SQL syntax transformation phase of the optimization process. What this means is that the SQL Optimizer will stop finding syntactically different SQL statements after the quota has been reached.
       
      Note: Although the SQL statements are syntactically different, they still produce the same result.
       
    2. The Table join permutation quota limits the number of ways the order of the tables is rearranged. This table order rearrangement is actually one of the many rules that comprise the syntax transformation rules. The Table join permutation quota is used to control how many SQL syntax transformations are created using only this one rule.
       
    3. The Hints quota is the number of SQL alternatives that are generated by applying the Oracle optimization hints to the original SQL statement and the SQL alternatives that were created by transforming the SQL syntax.
       
 
By changing the options above, fewer or more SQL alternatives can be generated for your original SQL statement.
 
If you would like to learn more about Quest SQL Optimizer for Oracle, please visit the Inside SQL Optimizer for Oracle community.
 
Permalink |  Trackback
Search Blog Entries
 
Copyright 2010 by Quest Software  | Terms Of Use | Privacy Statement | Contact Us