Solved

Toad help

Posted on 2003-11-20
5
2,111 Views
Last Modified: 2012-05-07
I need to know if any of you has a function, procedure or process to measure the time a query (any query) takes to run.
 
I have two complicated queries and both pretty much do the same thing. I need to know wich one runs faster.
i think TOAD has some kind of functionality to do that, even in GUI
Any ideas?

0
Comment
Question by:mehak
5 Comments
 

Accepted Solution

by:
dconlon earned 168 total points
ID: 9786771

Under View/Options/SQL Editor in TOAD, there's a checkbox about Always showing statement execution time. Doing a 'run current statement' will then display execution time in ms in the very bottom left-hand corner. Also on the same screen, if you check the first tickbox (Process statements in threads), TOAD will pop up a separate window for each update statement you do, and the time taken in ms will be at the bottom of this window (remember to take into account Oracle's caching of statements though - as far as I know you can make Oracle think it's a new statement even just by changing capitalisation).

For even more info in TOAD, go to the Tuning/SGA Trace menu option. Pick a statement type and schema name from the drop-down boxes and hit the refresh button. On the lower pane, go to Execution Stats, which doesn't tell you the time but does tell you everything else.
0
 
LVL 7

Assisted Solution

by:grim_toaster
grim_toaster earned 166 total points
ID: 9787082
In sql*plus, to turn timing on issue the command:
set timing on
and then every query run will give an elapsed time.

In addition to this I would recommend looking into the execution plan of the queries (using explain plain and/or tkprof)

And for quick reference: in sql plus, using the command:
set autotrace on
will give further details of statistics and the execution plan (but I think you need to have created the plan_table first, which is under <ORA_HOME>/rdbms/admin/utlxplan.sql)
0
 
LVL 23

Assisted Solution

by:seazodiac
seazodiac earned 166 total points
ID: 9787307
Add another method: dbms_utility.get_time
I think it's very handy and very good benchmarking tool, esp when you comparing the running time of function, procedures

an example of using this:

declare
l_start number;
begin
     l_start :=dbms_utility.get_time;
     --call you procedure here
     test_proc;
     dbms_output.put_line('it takes about ' || round(dbms_utility.get_time - l_start)/100, 2) || ' seconds ...');
end;
/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now