Solved

Toad help

Posted on 2003-11-20
5
2,104 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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.

744 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

16 Experts available now in Live!

Get 1:1 Help Now