mysql 数据库高水位_了解高水位与truncate

什么是High Water Mark 高水位?

6130267616_664086679f_z.jpg

"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 – 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 in

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值