Solved

Toad help

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
null value 15 99
Oracle Next Available Number 2 41
Oracle - SQL Where clause causing Invalid Number Error 4 32
PL SQL Search Across Columns 4 35
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

813 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

14 Experts available now in Live!

Get 1:1 Help Now