Fragmented Indexes

Since (b-tree) indexes are stored in a sorted order, updating an indexed column usually involves deleting it from one position in the index and inserting into another place. If this happens often enough, the index can become riddled with holes. Range scans on the index will read more blocks than they have to because each block is under-utilised.

This can also happen when many rows are deleted; a common occurrence in a fast-refresh Materialized View.

The only solution is to rebuild the index when it becomes fragmented.

Run the following SQL to list fragmented indexes. If you have fast-refresh materialized views, you should run this SQL regularly.

Note that this query does not take into account block headers (a small space overhead in each block) or the prefix size of compressed and prefixed partitioned indexes. Also, bitmap indexes, bitmap join indexes, function-based indexes, and domain indexes are excluded. Space usage for these index types will differ from the standard calculated here.


©Copyright 2003