Analyze Oracle Index space usage and whether indexes need to be rebuilt

Source: Internet
Author: User

Analyze index space usage. and whether the index needs to be rebuilt

Analysis of the index under other users need to analyze any permissions
Look at the size of the table and the size of the index before analyzing the index, assuming that the index size is as large as the table size or larger than the table size, then you can infer that the index may be problematic. Need to analyze Index
Query Object Size:
Select owner,segment_name,segment_type,bytes/1024/1024 from Dba_segments ORDER BY 4 desc

1. Analysis Index
Sql> Analyze Index AA. INDEX_AA Validate structure;
Sql>
Index analyzed

Query space usage:

Sql> select name, blocks, Lf_blks, Br_blks, blocks-(lf_blks+br_blks) empty from Index_stats;

NAME BLOCKS lf_blks br_blks EMPTY
------------------------------ ---------- ---------- ---------- ----------
AA 262144 253480 725 7939
--Index empty block reached 7939

2. Query index Delete row and delete scale (general deletion rate of 30% will consider rebuilding the index)
Sql> Select T.name,--index name
2 t.lf_rows,--number of leaf rows (values in the index)
3 T.lf_blks,
4 T.del_lf_rows,--number of deleted leaf rows in the index
5 (T.del_lf_rows/t.lf_rows) *100 ratio--delete scale
6 from Index_stats t
7 where t.name= ' Index_aa ';

NAME lf_rows lf_blks del_lf_rows RATIO
------------------------------ ---------- ---------- ----------- ----------
AA 77318533 253480 0 0

3. View index usage and index depth (consider rebuilding indexes when deep >=4)
sql> SELECT height, NAME, Btree_space, Used_space, pct_used from Index_stats;

HEIGHT NAME btree_space used_space pct_used
---------- ------------------------------ ----------- ---------- ----------
4 Index_aa 2032646380 1231201944 61
--Index depth of 4
The following conditions are met to consider rebuilding the index
The most common justifications given for rebuilding an index is:
-Index becomes fragmented
-Index grows and grows-deleted space is not re-used
-index clustering factor becomes out of sync

Analyze Oracle Index space usage and whether indexes need to be rebuilt

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.