Lei*_*fel 4 index oracle oracle-11g-r2
有没有办法知道COALESCE一个索引是否已经完成?这样一个似乎没有更新CREATED,LAST_DDL_TIME或LAST_ANALYZED属性。
注意:我指的COALESCE不是返回表达式列表中第一个非空 expr 的 ,而是用于在块中使空闲空间像这样连续的那个:
ALTER INDEX [Index Name] COALESCE;
Run Code Online (Sandbox Code Playgroud)
目前还不完全清楚你的问题是什么。我假设您想知道是否并且重要的alter index .. coalesce是何时执行了。
我认为没有(在其他答案中已经提到审计设置)不可能获得这样的日期(尽管我想知道是否有人知道得更好)。
也就是说,alter index coalesce可以通过 a 使an 的效果可见analyze index .. compute statistics。
create table ix_test (
a number
);
create unique index ix_test_ix on ix_test(a);
insert into ix_test
select
rownum
from
dba_objects, dba_objects, dba_objects
where
rownum < 1e7;
commit;
Run Code Online (Sandbox Code Playgroud)
现在表已填满,对索引进行分析并提取一些与索引相关的值:
analyze index ix_test_ix compute statistics;
select
LEAF_BLOCKS,
AVG_LEAF_BLOCKS_PER_KEY,
CLUSTERING_FACTOR,
SAMPLE_SIZE
from
user_indexes
where
index_name = 'IX_TEST_IX';
LEAF_BLOCKS AVG_LEAF_BLOCKS_PER_KEY CLUSTERING_FACTOR SAMPLE_SIZE
----------- ----------------------- ----------------- -----------
2 19875 1 15152
Run Code Online (Sandbox Code Playgroud)
除了一行之外的所有行都被删除并分析了索引(再次):
delete from ix_test where a != 500000;
analyze index ix_test_ix compute statistics;
Run Code Online (Sandbox Code Playgroud)
上面的查询返回相同的值。
合并索引:
alter index ix_test_ix coalesce;
analyze index ix_test_ix compute statistics;
Run Code Online (Sandbox Code Playgroud)
上面的查询现在返回
LEAF_BLOCKS AVG_LEAF_BLOCKS_PER_KEY CLUSTERING_FACTOR SAMPLE_SIZE
----------- ----------------------- ----------------- -----------
1 1 1 1
Run Code Online (Sandbox Code Playgroud)
因此,有可能找出是否已完成合并,但这不是直接的,而且可能没用,具体取决于您的上下文。
| 归档时间: |
|
| 查看次数: |
1869 次 |
| 最近记录: |