了解高水位与truncate

什么是High Water Mark 高水位? HWM "The high water mark starts at the first block of a newly created table. Ads data is inserted, the high water mark rises. And the HWM will remain at that level in spite of delete operations. The HWM matters since Oracle will scan all blocks below the HWM even when they contain no data during a full scan �C just to see if they have data. TRUNCATE will reset the HWM, so will other operations described next." 我们知道Oracle中的数据段(segment)均有一个存放数据的上边界。这条上边界被称作High Water Mark"高水位"或者简写为HWM。 高水位标记了那些已经分配给数据段但还没有真正被使用的数据块。常规情况下高水位以每次5个数据块的速度上涨。全表扫描通常从起始Extent开始到高水位标记结束。注意delete操作是无法降低高水位线的,而truncate操作可以,不管是truncate drop storage还是 truncate use storage 均会把 高水位线"置零"。 这里的置零具体是指:
在truncate drop storage 的情况下:

SQL> create table maclean_test1 tablespace users as select * from dba_objects;
Table created.

SQL> create index objd_test1 on maclean_test1(object_id) tablespace users;
Index created.

SQL> create table maclean_test2 tablespace users as select * from dba_objects;
Table created.

SQL> create index objd_test2 on maclean_test2(object_id) tablespace users;
Index created.

SQL> exec dbms_stats.gather_table_stats('SYS','MACLEAN_TEST1',cascade=>TRUE);
PL/SQL procedure successfully completed.

SQL> exec dbms_stats.gather_table_stats('SYS','MACLEAN_TEST2',cascade=>TRUE);
PL/SQL procedure successfully completed.

SQL> analyze index objd_test1 validate structure;
Index analyzed.

SQL> select HEIGHT,BLOCKS,LF_BLKS,BR_BLKS,BTREE_SPACE from index_stats;


    		

你可能感兴趣的:(oracle,数据库,truncate,hwm,administrate)