对于update操作,索引将对原先的数据进行删除标记,然后增加一条新的记录,因此很多人,包括我在内,就有一个错误观念:大批量的update更新操作,就可能造成索引存储空间浪费,我们需要定期对索引进行重建。实际上,当leaf block被标记为删除记录的时候,这些空间能被ORACLE自动清除和重用。
以下是Richard Foote实验步骤:
1、创建表和索引
SQL>create table test_update (id number,name varchar2(10));
SQL>create index test_update_idx on test_update(name);
SQL>insert into test_update values(1, 'BOWIE');
SQL>commit;
2、dump 索引数据块
SQL>select header_file, header_block
from dba_segments
where segment_name='TEST_UPDATE_IDX'
HEADER_FILE HEADER_BLOCK
以下是Richard Foote实验步骤:
1、创建表和索引
SQL>create table test_update (id number,name varchar2(10));
SQL>create index test_update_idx on test_update(name);
SQL>insert into test_update values(1, 'BOWIE');
SQL>commit;
2、dump 索引数据块
SQL>select header_file, header_block
from dba_segments
where segment_name='TEST_UPDATE_IDX'
HEADER_FILE HEADER_BLOCK