Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: an easier way to time a sql statement?

Re: an easier way to time a sql statement?

From: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: Wed, 07 Dec 2005 21:14:55 +0100
Message-ID: <dn7f8n$89k$2@news6.zwoll1.ov.home.nl>


DaLoverhino wrote:
> Hello. If I am writing a select statement and I am concerned about the
> performance impact, I'll try to time the sql using the following
> 'technique':
>
> DECLARE
> v_begin_time NUMBER;
> v_end_time NUMBER;
> BEGIN
> v_begin_time := DBMS_UTILITY.GET_TIME;
> EXECUTE IMMEDIATE '<put select statement here';
> v_end_time := DBMS_UTILITY.GET_TIME;
>
> DBMS_OUTPUT.PUT_LINE( 'Finished in: ' || TO_CHAR( (v_end_time -
> v_begin_time) / 100 ) || ' seconds.' );
> END;
>
>
> I might play around more with the sql statement, and then submit the
> anonymous block, and do this over again, if need be. I'm wondering if
> there is an easier way to time a sql statement, since this can be error
> prone. I was hoping something like:
>
> SELECT /*+ stopwatch */ ...... ;
>
> thanks.
>

set timing on

-- 
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
Received on Wed Dec 07 2005 - 14:14:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US