RE: fastest SQL?

  • From: "Allen, Brandon" <Brandon.Allen@xxxxxxxxxxx>
  • To: "martin.a.berger@xxxxxxxxx" <martin.a.berger@xxxxxxxxx>, ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 11 Mar 2010 14:09:45 -0700

For example - first execution was .039358 seconds, second execution was only 
.000154 seconds:

SQL> select 1 from dual;

         1
----------
         1

SQL> select sql_id, sql_text, executions, elapsed_time, 
round(elapsed_time/1000000,6) elapsed_seconds from v$sqlstats where sql_text = 
'select 1 from dual';

SQL_ID        SQL_TEXT                       EXECUTIONS ELAPSED_TIME 
ELAPSED_SECONDS
------------- ------------------------------ ---------- ------------ 
---------------
520mkxqpf15q8 select 1 from dual                      1        39358         
.039358

SQL> select 1 from dual;

         1
----------
         1

SQL> select sql_id, sql_text, executions, elapsed_time, 
round(elapsed_time/1000000,6) elapsed_seconds from v$sqlstats where sql_text = 
'select 1 from dual';

SQL_ID        SQL_TEXT                       EXECUTIONS ELAPSED_TIME 
ELAPSED_SECONDS
------------- ------------------------------ ---------- ------------ 
---------------
520mkxqpf15q8 select 1 from dual                      2        39512         
.039512


From: Allen, Brandon


In 9i+, you should be able to get the elapsed_time down to microseconds from 
v$sql/v$sqlstats.


________________________________
Privileged/Confidential Information may be contained in this message or 
attachments hereto. Please advise immediately if you or your employer do not 
consent to Internet email for messages of this kind. Opinions, conclusions and 
other information in this message that do not relate to the official business 
of this company shall be understood as neither given nor endorsed by it.

Other related posts: