Site icon Database Tutorials

When To Rebuild an Index in Oracle

In Oracle databases, over time, indexes are fragmented and cause serious performance issues. We should check the indexes regularly and rebuild them if necessary.

Determine an index needs to be rebuilt

It is possible to determine whether rebuild is required for an index.

First, the relevant index should be analyzed. You can do this with the following command.

The analysis process fills the table “sys.index_stats”. This table contains only one row and therefore only one index can be analyzed at a time. Information about the relevant index can be obtained from the sys.index_stats table in the analyzed session.

After the analysis, according to the data in the “sys.index_stats” table, if any of the following conditions occur you can decide whether rebuild the index or not.

When one of these conditions occurs you can rebuild the index as follows.

Exit mobile version