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 7 – Testing SQL with Variables
 
Location: Blogs Richard To's Blog    
 RichardTo Friday, July 10, 2009 5:33 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 executing SQL statements that require you to enter a parameter before the SQL statements are executed.

A SQL statement with a variable that is provided at run time poses an extra challenge when trying to determine which alternative SQL statement is going to give the best overall performance. Each time the SQL statement is executed, a different variable could be supplied.

You may find that when you use one variable, alternative 1 has the best elapsed time and when you use another variable, maybe alternative 2 has the best elapsed time. So, how can you determine which SQL statement to use in the application?

This diagram shows two SQL statements (SQL1 and SQL2) plus the performance time and the retrieved data volume relationship.

If you look at the performance of the SQL statements to the left of the Meet Point (the point where the two lines intersect), you can see that when the variable that is used produces a lower data volume that falls into the range to the left of the Meet Point, SQL 2 has the best performance.

So in this example, let’s say that the first variable that you test falls into the left range of Meet Point, and therefore SQL2 gives better performance than SQL1. Then the second variable that you test selects more data and falls into the data volume range that is to the right of the Meet Point. In this second test, SQL1 provides the best performance. The big challenge when doing performance tuning for a SQL statement which requires a variable is that there is no single winner between SQL1 and SQL2 for entire data set.

Two factors should be considered when choosing the SQL statement for your application. The first criterion that you should use to pick the “best” SQL statement is the best fit for most of the variables that will likely to be used when this SQL statement is executed. Another selection criterion is that there should not be a rapid rise in the performance time after the Meet Point. For this example, SQL1 is likely to be a better overall choice rather than SQL2, since there is a rapid growth on the right-hand side of the Meet Point for SQL2. SQL1 will provide a more consistent performance throughout the entire data set.

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