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.

Executing SQL In Tuning Lab – Part 5 – Selecting Alternatives to Test
 
Location: Blogs Richard To's Blog    
 RichardTo Friday, June 12, 2009 5:27 AM

Written by Rene Woody

This blog is a continuation of a series about test running the SQL statements in the Tuning Lab in Quest SQL Optimizer for Oracle to find the best performing SQL statement in your database environment. It covers how to select which SQL alternatives to test after Quest SQL Optimizer has generated the alternatives.

In Quest SQL Optimizer when you generate alternative SQL statements for your original SQL statement you may be presented with hundreds of SQL alternatives. The only way to be completely sure that you have the fastest one is to run all the SQL alternatives. But unless the SQL statements run relatively quickly, this is not always practical. So then you are left to determine which SQL statements you should select to test.

It is generally assumed that the SQL alternatives with the lowest plan cost (Oracle cost) should be the better performing SQL statements. But this frequently is not the case. So if you are using this criteria for selecting the SQL alternatives to test, faster executing SQL statements that have a higher cost are easily overlooked. So it is best if you do not just select a few of the lower cost SQL statements when testing the alternatives.

We have found that SQL statements with similar plan costs also have similar execution plans and consequently have similar execution times. So when selecting which alternatives to test, it is a good idea to select one alternative from each group of SQL statements with a similar plan cost.

For example, if you see a list of SQL alternatives like this:

Scenario Cost
Original 1,000
Alt #1 500
Alt #2 501
Alt #3 502
Alt #4 2,000
Alt #5 2,010
Alt #6 2,010
Alt #7 4,000
Alt #8 4,005
Alt #9 4,005

Alt #1, Alt #2, and Alt #3 has very similar costs -  around 500. So instead of running all three of them, you may choose to run only Alt #1 as a representative from this group. Applying the same logic to other SQL alternatives, the list of SQL alternatives to execute would be Alt #1, Alt #4, and Alt #7. It may give you a better result to run these SQL alternatives from different groups of costs than to simply run the SQL with the lower costs.

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