Toad World Blog

Do you imbed your SQL in COBOL? Even if you don’t, Toad can proactively find and tune your SQL

Jul 23, 2018 10:22:24 AM by Jeff Surretsky

Within Toad, you can optimize SQL that has been identified as an issue. This is a self-contained functionality and nothing is required by the respective database vendors (Oracle, MS SQL Server). SQL Optimizer generates semantically equivalent alternatives with unique execution plans for your original SQL statement and then executes the alternatives to test each statement's performance. This will provide you with execution times and runtime statistics that allow you to find the best SQL statement for your database environment.

If you have used this feature within Toad, you may be most familiar with the use case of being reactive; i.e., a SQL statement is currently running and taking a very long time. Or, you are developing SQL for the first time and want to see if it is optimal. These are the viable use cases for optimizing SQL that are most widely known.

Another use case is to proactively scan for SQL that may not be running. This is the “Scan SQL” feature within Toad SQL Optimizer. You can scan a variety of sources for SQL as follows: 

 

  • Data dictionary for functions, PL/SQL, packages, procedures, triggers and views

 

  • Source Code residing in Text/Binary files, Oracle SQL*Plus scripts and, yes, COBOL programming source code

 

  • From the SGA 

 

  • From Foglight Performance Investigator

Once this scan is run, a report is produced which will categorize your imbedded SQL statements as Complex and/or Problematic, as seen below. While these SQL statements may not necessarily need to be optimized, they certainly present an opportunity for further investigation on a finite set of statements.

Only by sending them to be optimized will you be able to see if they can be improved. 

 

After sending the specific SQL to be optimized, you will get your best alternatives based upon your tuning goals (Elapsed Time is the default): 

 

 

Tags: SQL Optimizer for Oracle

Jeff Surretsky

Written by Jeff Surretsky

Jeffrey Surretsky has been working at Quest since 2000 as a Sales Engineer focusing on a wide variety of solutions including Foglight, SharePlex and the TOAD Family of Products. Before working at Quest, he was a DBA for various organizations spanning a diverse range of industries. With over 30 years of experience in Information Technology, Jeffrey has a Bachelor’s Degree in Computer Science and an MBA in Management of Information Systems.