01.09.2016 Views

Beginning Oracle Database 11g Administration From Novice to Professional

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 17 SQL TUNING 395<br />

Sorts (memory) and sorts (disk) track the number of sorting operations performed<br />

by <strong>Oracle</strong> during the course of our query. Sorting operations are performed in<br />

memory if possible; they spill on<strong>to</strong> the disks if the data does not fit in<strong>to</strong> <strong>Oracle</strong>’s<br />

memory buffers. It is desirable for sorting <strong>to</strong> be performed in memory because<br />

reading and writing data <strong>to</strong> and from the disks are expensive operations. The<br />

amount of memory available <strong>to</strong> database sessions for sorting operations is controlled<br />

by the value of .<br />

rows processed is the number of rows of information required by the user.<br />

The preceding explanations should make it clear that a lot of overhead is involved in<br />

executing a query—for example, physical reads are required if data blocks are not found<br />

in <strong>Oracle</strong>’s cache. There were no physical reads necessary when we executed our query<br />

the first time, indicating that all the required blocks were found in the cache. We can<br />

gauge the extent of overhead by flushing the shared pool (cache of query execution plans)<br />

and buffer cache (cache of data blocks) and executing the query again:<br />

<br />

<br />

<br />

<br />

The numbers rise dramatically; 1,653 recursive calls and 498 consistent gets (including<br />

136 physical reads) are required after the flush. The number of sort operations also<br />

jumps—from 0 <strong>to</strong> 37:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!