dbTalk Databases Forums  

Query Execution Time "alone"

comp.databases.oracle.server comp.databases.oracle.server


Discuss Query Execution Time "alone" in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
raja
 
Posts: n/a

Default Query Execution Time "alone" - 03-15-2011 , 08:28 AM






Hi,

I need to take the elapsed time / response time / query execution time
alone of a particular query. For example, if i try to take the
response time of the following query :

set timing on
select * from table_name;
..
..
8000 rows selected
elapsed time : 2 mins

so my log gets filled up with 8000 rows and when i try for more
queries, the log if going like 1GB in size. but i need to check only
the elapsed time of the query and not the query output. Is there
anyway to do so?
Can anyone please help me out on this? Thanks in Advance.

With Regards,
Raja.

Reply With Quote
  #2  
Old   
yossarian
 
Posts: n/a

Default Re: Query Execution Time "alone" - 03-15-2011 , 08:37 AM






raja wrote:

Quote:
i need to check only
the elapsed time of the query and not the query output. Is there
anyway to do so?
Using PL/SQL?

hr@> declare
2 junk owa_text.vc_arr ;
3 begin
4 select object_name bulk collect into junk from all_objects ;
5 end ;
6 /

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.43

Reply With Quote
  #3  
Old   
raja
 
Posts: n/a

Default Re: Query Execution Time "alone" - 03-15-2011 , 09:49 AM



thanks for the response. but i am having more than 5 queries like :

set timing on
select * from table1 where a=20;
select * from table2 where b=20 and a not in ('A');
select * from table3;
select * from table4;
select * from table5;

i dont want the output of these queries but only the elapsed time.

Reply With Quote
  #4  
Old   
raja
 
Posts: n/a

Default Re: Query Execution Time "alone" - 03-15-2011 , 10:06 AM



sorry i missed one point : its oracle 10gR2 and i am running these
queries from sqlplus :-)

Reply With Quote
  #5  
Old   
Jonathan Lewis
 
Posts: n/a

Default Re: Query Execution Time "alone" - 03-15-2011 , 01:44 PM



set timing on
set arraysize {something fairly big - maybe 1000}
set autotrace traceonly statistics
{queries}

Oracle fetches the data, but dumps it straight into /dev/null.
No time wasted on formatting and filing.
The times you get are query and network traffic only

--
Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com


"raja" <dextersunil (AT) gmail (DOT) com> wrote

Quote:
Hi,

I need to take the elapsed time / response time / query execution time
alone of a particular query. For example, if i try to take the
response time of the following query :

set timing on
select * from table_name;
.
.
8000 rows selected
elapsed time : 2 mins

so my log gets filled up with 8000 rows and when i try for more
queries, the log if going like 1GB in size. but i need to check only
the elapsed time of the query and not the query output. Is there
anyway to do so?
Can anyone please help me out on this? Thanks in Advance.

With Regards,
Raja.

Reply With Quote
  #6  
Old   
raja
 
Posts: n/a

Default Re: Query Execution Time "alone" - 03-15-2011 , 01:48 PM



so, set autotrace traceonly statistics, will execute the query and
just gives the elapsed time of the query and not the data ???

Reply With Quote
  #7  
Old   
Donatello Settembrino
 
Posts: n/a

Default Re: Query Execution Time "alone" - 03-16-2011 , 04:28 AM



On Mar 15, 8:48*pm, raja <dextersu... (AT) gmail (DOT) com> wrote:
Quote:
so, set autotrace traceonly statistics, will execute the query and
just gives the elapsed time of the query and not the data ???

as Jonathan says,
get the elapsed time and the statistics captured during the execution
of the query

Here's an example of

SQL> create table t as
2 select rownum as c from dual connect by level <= 10000;

Tabella creata.

SQL> select count(*) from t;

COUNT(*)
----------
10000

SQL> set timing on;
SQL> set arraysize 1000
SQL> set autotrace traceonly statistics
SQL> select * from t;

Selezionate 10000 righe.

Passati: 00:00:00.28

Statistiche
----------------------------------------------------------
8 recursive calls
0 db block gets
36 consistent gets
0 physical reads
0 redo size
90442 bytes sent via SQL*Net to client
323 bytes received via SQL*Net from client
11 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
10000 rows processed

Reply With Quote
  #8  
Old   
Donatello Settembrino
 
Posts: n/a

Default Re: Query Execution Time "alone" - 03-16-2011 , 04:30 AM



On Mar 15, 8:48*pm, raja <dextersu... (AT) gmail (DOT) com> wrote:
Quote:
so, set autotrace traceonly statistics, will execute the query and
just gives the elapsed time of the query and not the data ???
as Jonathan says,
get the elapsed time and the statistics captured during the execution
of the query

Here's an example of

SQL> create table t as
2 select rownum as c from dual connect by level <= 10000;

Tabella creata.

SQL> select count(*) from t;

COUNT(*)
----------
10000

SQL> set timing on;
SQL> set arraysize 1000
SQL> set autotrace traceonly statistics
SQL> select * from t;

Selezionate 10000 righe.

Passati: 00:00:00.28

Statistiche
----------------------------------------------------------
8 recursive calls
0 db block gets
36 consistent gets
0 physical reads
0 redo size
90442 bytes sent via SQL*Net to client
323 bytes received via SQL*Net from client
11 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
10000 rows processed

Reply With Quote
  #9  
Old   
onedbguru
 
Posts: n/a

Default Re: Query Execution Time "alone" - 03-16-2011 , 06:56 PM



On Mar 16, 6:28*am, Donatello Settembrino
<donatello.settembr... (AT) gmail (DOT) com> wrote:
Quote:
On Mar 15, 8:48*pm, raja <dextersu... (AT) gmail (DOT) com> wrote:

so, set autotrace traceonly statistics, will execute the query and
just gives the elapsed time of the query and not the data ???

as Jonathan says,
get the elapsed time and the statistics captured during the execution
of the query

Here's an example of

SQL> create table t as
* 2 *select rownum as c from dual connect by level <= 10000;

Tabella creata.

SQL> select count(*) from t;

* COUNT(*)
----------
* * *10000

SQL> set timing on;
SQL> set arraysize 1000
SQL> set autotrace traceonly statistics
SQL> select * from t;

Selezionate 10000 righe.

Passati: 00:00:00.28

Statistiche
----------------------------------------------------------
* * * * * 8 *recursive calls
* * * * * 0 *db block gets
* * * * *36 *consistent gets
* * * * * 0 *physical reads
* * * * * 0 *redo size
* * * 90442 *bytes sent via SQL*Net to client
* * * * 323 *bytes received via SQL*Net from client
* * * * *11 *SQL*Net roundtrips to/from client
* * * * * 0 *sorts (memory)
* * * * * 0 *sorts (disk)
* * * 10000 *rows processed

I would add that by not doing the formating or transferring the data
to something useful - like an application or file - your timings are
going to be off. So, it really depends on what is your real goal here.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.