Solved

Toad help

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
selective queries 7 38
form builder not starting 3 56
making a message body variable from an oracle select statement 4 25
Error in creating a view. 8 23
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to recover a database from a user managed backup

821 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