High watermark for Oracle Clear table

Source: Internet
Author: User

When you add a record, HWM slowly moves up, but when you delete a record, HWM does not move down. Therefore, deleting large amounts of data with the delete from command can cause performance problems caused by HWM.

The most straightforward way to delete a high water level is to truncate Table but this way is too violent, so use the following method to remove the high watermark.


--Delete data

DELETE from Gjds_bus_oil_log

WHERE VERSION < (13112-100);


--Fast Compression

Move is best done when you are free to remember move is a TM lock will be generated after the move to remember to rebuild index

ALTER TABLE Gjds_bus_oil_log MOVE;


--After compression, all indexes will be invalidated and the index needs to be rebuilt.

ALTER INDEX index_name REBUILD;


--then analyze the table below

ANALYZE table Gjds_bus_oil_log COMPUTE STATISTICS for TABLE for all INDEXES for all INDEXED COLUMNS;


--View the total number of blocks

SELECT segment_name, extents, BLOCKS

From User_segments

WHERE segment_name = ' gjds_bus_oil_log ';

--View high water level

SELECT BLOCKS, Empty_blocks

From Dba_tables

WHERE table_name = ' Gjds_bus_oil_log '

and OWNER = ' BUS ';

--See how many blocks are actually used

SELECT COUNT (DISTINCT dbms_rowid. Rowid_block_number (ROWID)) Used_block

From Gjds_bus_oil_log S;


Another way is to use shrink SPACE

Shrink SPACE cannot be used in the following cases

IOT Mapping Tables
Tables with ROWID based materialized views
Tables with function-based indexes     --Function Index
securefile lobs
Compressed Tables


If a function index is required to delete the function index, you can use the

--Enable row movement

ALTER TABLE gjds_bus_oil_log ENABLE ROW movement;

--Compression section

ALTER TABLE gjds_bus_oil_log SHRINK SPACE;

Also need to rebuild indexes and re-parse tables


Reference: http://www.blogjava.net/decode360/archive/2009/07/14/287767.html


High watermark for Oracle Clear table

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.