You are on page 1of 1

When should one rebuild an index?

Submitted by OraFAQ admin on Sun, 2005-12-25 18:54.



command on the affected indexes - each invocation of
this command creates a single row in the INDEX_STATS
view. This row is overwritten by the next ANALYZE
INDEX command, so copy the contents of the view into a
local table after each ANALYZE. The 'badness' of the
index can then be judged by the ratio of 'DEL_LF_ROWS'
to 'LF_ROWS'.

Posted by: Sumer Singer

Submitted by sumer on Mon, 2007-09-17 05:21.

Index fragmentation occurs when a row included in the

index is deleted.

You will need to analyze indexes individually to find

those deleted indexes, once discovered they can be

To analyze issue the following command :-

analyze index owner.index_name validate structure;

The above command create a single row in 'index_stats'


Now find the ratio of del_lf_rows and lf_rows:-

select del_lf_rows * 100 / decode(lf_rows,0,1,lf_rows)

from index_stats

where name = 'index_ name'

If it is more than 20% of rows are deleted then the

index should be rebuilt.

The index stats table can only hold one record of

information at a time, therefore you will need to
analyze each index individually.