Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

To Find Index Fragmentation and Usage

$
0
0

To Find Index Fragmentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~
analyze index <index_name> validate structure;
select round((del_lf_rows/lf_rows)*100,2) ratio, height, lf_blks, lf_rows   from index_stats;

We are comparing the ratio between no of leaf rows which have values with leaf rows which don't have any values, if it is above 20% then it index is fragmented. index_stats table can have only one row at a time so we need to query the table after each analyse index statement. The table exists the session where the analyze statement is executed.

analyze index APPS.ADS_INDUSTRY_NAME validate structure;

To find Index Usage
~~~~~~~~~~~~~~~~~~~
 alter index <index_name> monitoring usage;

Once Monitoring is enabled use the below query to find out the usage. We need to execute the command as the owner of the index to find the usage
 SELECT index_name,
       table_name,
       monitoring,
       used,
       start_monitoring,
       end_monitoring
FROM   v$object_usage
WHERE  index_name = 'MY_INDEX_I'
ORDER BY index_name;

Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>