Tuesday, January 26, 2010

Query returns a percentage of work areas used with optimal memory size.

select
trunc (
       (sum(case when name like 'workarea executions - optimal' 
                                       then value else 0 end) *100) /
         (
                  sum(case when name like 'workarea executions - optimal'   
                                             then value else 0 end)         +
                  sum(case when name like 'workarea executions - one pass'  
                                             then value else 0 end)         +
                  sum(case when name like 'workarea executions - multipass' 
                                             then value else 0 end)
         )
        ) optimal_percent
from v$sysstat
where name like 'workarea executions - %'
/

Note
  • If this feature is not enabled the previous query will fail with ORA-01476: divisor is equal to zero
  • 'workarea memory allocated' - the total amount of PGA memory dedicated to work areas allocated in Kb.
  • 'workarea executions - optimal' - the cumulative count of work areas which had an optimal size. For example optimal size is defined if the sort does not need to spill to the disk.
  • 'workarea executions - onepass' - the cumulative count of work areas using the one pass size. One pass is generally used for big work areas where spilling to disk cannot be avoided.
  • 'workarea executions - multipass' - the cumulative count of work areas running in more than one pass. This should be avoided and is the symptom of poorly tuned system.
    
A workarea execution is either optimal, onepass or multipass.

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home