« Swingbench Trace Analyzer | Main | Creating larger swingbench data sets »

SQL Timing utility

Some times I feel like Ia??ve missed out on a whole chunk on functionality in Oracle products. One little nugget is the a??timinga?? function in SQL*Plus. This allows you to time groups of operations.

Obviously turning on is achieved with the a??set timing ona?? operation. i.e

SQL > set timing on

SQL > select count(1) from all_objects;

COUNT(1)
----------
68653

Elapsed: 00:00:03.95

SQL>

Which is great but what if want to time mulitiple operations. Use the timing function and simply give the timer a name, in this case statement timer.

SQL> timing start statement_timer
SQL> select count(1) from all_objects;

COUNT(1)
----------
68653

SYS@orcl > /

COUNT(1)
----------
68653

SQL> timing show statement_timer;
timing for: statement_timer
Elapsed: 00:00:30.85
SQL>

Which times anything that went on in between the timer starting and finishing. In this case also my typing of the commands. Its a fantastic utility for timing stages in a batch job including call outs to os operations.

TrackBack

TrackBack URL for this entry:
http://blogs.oracle.com/mte1521/mt-tb.cgi/6116

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on September 3, 2008 1:16 AM.

The previous post in this blog was Swingbench Trace Analyzer.

The next post in this blog is Creating larger swingbench data sets.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle