Sie sind auf Seite 1von 1

To check for index fragmentation

================================
-- +-----------------------------------------------------------------------------+
-- | PURPOSE : To check for index fragmentation. As a rule of thumb if 10-15%
|
-- |
of the table data changes, then you should consider rebuilding t
he index |
-- +------------------------------------------------------------------------------+
ANALYZE INDEX &&index_name VALIDATE STRUCTURE;
COL
COL
COL
COL

name
del_lf_rows
lf_rows_used
ibadness

HEADING
HEADING
HEADING
HEADING

'Index Name'
'Deleted|Leaf Rows'
'Used|Leaf Rows'
'% Deleted|Leaf Rows'

FORMAT
FORMAT
FORMAT
FORMAT

a30
99999999
99999999
999.99999

SELECT
name
, del_lf_rows
, lf_rows - del_lf_rows lf_rows_used
, TO_CHAR( del_lf_rows /(DECODE(lf_rows,0,0.01,lf_rows))*100,'999.99999') ibad
ness
FROM index_stats
/
prompt
prompt Consider rebuilding any index if % of Deleted Leaf Rows is > 20%
prompt
undefine index_name

Das könnte Ihnen auch gefallen