Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Toad help

Posted on 2003-11-20
5
Medium Priority
?
2,164 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Accepted Solution

by:
dconlon earned 672 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 664 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 664 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

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 …
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
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.

719 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