You are on page 1of 2

Determine if an index is a good candidate for a rebuild.

It is important to regularly examine all the indexes to determine if they have become
skewed and might need to be rebuilt.When an index is skewed, parts of an index may be
accessed more frequently than others. As a result, more physical storage utilization and
!" utilization may cause of creating a bottleneck in database performance. #ere is a
sample procedure on how to identify the such indexes$
%& 'ather statistics on your indexes.
()*+A,--analyze index I*./,0*A1/ compute statistics2
/,A1!3/$
(435 analyze index 61!70!68.08./ compute statistics2
Index analyzed.
9for example my index name is :61!70!68.08./:;
<& find out how skewed each index is by running the below given query
(435 select index0name, blevel,
decode=blevel,>,:8? 73/@/3:,%,:8? 73/@/3:,<,
:8? 73/@/3:,A,:8? 73/@/3:,B,:8? 73/@/3:,:73/@/3 #I'#:& 8?
from user0indexes where table0nameC:D+A73/0*A1/:2
9for example my table name is :61!70!68."+:;
I*./,0*A1/ 73/@/3 8?
------------------------------ ---------- -----------
61!70!68.08./ > 8? 73/@/3
61!70!68.0*A1/ > 8? 73/@/3
61!70!68."+0I. > 8? 73/@/3
A& 'ather more index statistics using the @A3I.A+/ (+6"+"6/ option of the
A*A3)E/ command to populate the I*./,0(+A+( virtual table.
()*+A,--analyze index I*./,0*A1/ validate structure2
/,A1!3/$
(435 analyze index 61!70!68.08./ validate structure2
Index analyzed.
9for example my index name is :61!70!68.08./:;
B& 6un the following query to find out !+0./3/+/. ratio.
(435 select ./303F068W(G%>>Hdecode=3F068W(, >, %, 3F068W(&
!+0./3/+/.,
=3F068W(-.I(+I*+0?/)(&G%>>H decode=3F068W(,>,%,3F068W(&
.I(+I*+I@/*/((
from index0stats
where *A1/C:Dindex0name:2
!+0./3/+/. .I(+I*+I@/*/((
----------- ---------------
> >
9for example my index name is :61!70!68.08./:;
+he PCT_DELETED column shows the percent of leaf entries =i.e. index entries& that
have been deleted and remain unfilled. +he more deleted entries exist on an index, the
more unbalanced the index becomes. If the !+0./3/+/. is <>I or higher, the index
is candidate for rebuilding. If you can afford to rebuild indexes more frequently, then do
so if the value is higher than %>I. 3eaving indexes with high !+0./3/+/. without
rebuild might cause excessive redo allocation on some systems.
+he DISTINCTIVENESS column shows how often a value for the column=s& of the
index is repeated on average. For example, if a table has %>>>> records and J>>> distinct
((* values, the formula would result in =%>>>>-J>>>& x %>> H %>>>> C %>. +his shows a
good distribution of values. If, however, the table has %>>>> records and only < distinct
((* values, the formula would result in =%>>>>-<& x %>> H%>>>> C JJ.JK. +his shows that
there are very few distinct values as a percentage of total records in the column. (uch
columns are not candidates for a rebuild but good candidates for bitmapped indexes.

You might also like