Oracle table fragmentation

Source: Internet
Author: User
During the routine use of databases, it is inevitable that the insert, delete, and update operations occur constantly, resulting in fragmentation of tables and indexes. When there are more fragments, the SQL Execution efficiency will naturally be poor, the reason is simple, high water level

During the routine use of databases, it is inevitable that the insert, delete, and update operations occur constantly, resulting in fragmentation of tables and indexes. When there are more fragments, the SQL Execution efficiency will naturally be poor, the reason is simple, high water level

During the routine use of databases, it is inevitable that the insert, delete, and update operations occur constantly, resulting in fragmentation of tables and indexes. When there are more fragments, the SQL Execution efficiency will naturally be poor, the reason for the Hong Kong virtual host is very simple. Many data blocks under the HWL are non-data, but the data blocks of the high-water line need to be scanned during full table scanning, that is to say, oracle has to do a lot of useless work! Therefore, oracle provides the shrink space fragment function. For indexes, rebuild online can be used for fragment. Generally, DBAs that frequently perform DML operations should be regularly maintained, and statistics should be updated in a timely manner!

I. Prepare test data, free of Record Filing space, and a Hong Kong VM. Use HR users to create table T1, insert about 30 W of data, and create common indexes based on object_id, tables occupy about 34 MB of storage space, and indexes occupy about 6 MB of storage space.

Ii. estimate how much space is available in the table under the high water level. The lower the value, the better. The closer the table usage is to the high water level. The less useless the full table scan will be!

The DBMS_STATS package cannot obtain the statistics of EMPTY_BLOCKS. Therefore, you need to use the analyze command to collect statistics again.

Iii. view the execution plan. A full table scan consumes about 1175 of the CPU.

4. delete most of the data and collect statistics. The full table scan still consumes 1168 of the CPU.

5. estimate the amount of space in the table under high water level without data, but useless data is required during full table scan.

Vi. defragmentation of tables and re-collect statistics

Refer:

For details about how to determine which tables need to be split, you can use the script in the attachment to query. For details, refer:

This article is from the "Bo Yue" blog and will not be reproduced!

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.