15 March 2006

Which objects should go to KEEP or RECYCLE cache

KEEP and RECYCLE caches

X$BH
This view is a snapshot of buffer header, including objects' buffers, their position on the LRU list and number of touches.
The following SQL statement below tells you how many buffers an object takes and what is the average touch for that object. Sort it by "Average touches" to find the HOT blocks and sort it by "Object buffers" to see which objects are candidates for the RECYCLE cache. For HOT blocks, also check objects with lru_flag=8.

COLUMN object_name FORMAT a40
COLUMN number_of_blocks FORMAT 999,999,999,999

SELECT o.object_name, COUNT(1) number_of_blocks_per_object
FROM DBA_OBJECTS o, V$BH bh
WHERE o.object_id = bh.objd
AND o.owner != 'SYS'
GROUP BY o.object_name
ORDER BY count(1);

OR

PROMPT Number of buffers per object and per average touch
SELECT d_o.object_name as object_name,
sum(o.buffers) as obj_buffers, avg_touches
FROM (SELECT obj object, count(1) buffers, avg(tch) avg_touches
FROM x$bh
WHERE lru_flag <= 8 GROUP BY obj having avg(tch) >= 0) o, dba_objects d_o
WHERE o.object = d_o.data_object_id
GROUP BY d_o.object_name, avg_touches;


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?