alter index rebuild与alter index rebuild online的区别

转载 2013年12月02日 11:56:15
alter index rebuild online实质上是扫描表而不是扫描现有的索引块来实现索引的重建;在重建的过程中,允许对表做DML操作;花费的时间较长;

alter index rebuild 只扫描现有的索引块来实现索引的重建;在重建的过程中,不允许对表有任何DML操作;花费时间较短。

可以用10046事件来发现这个现象。

metalink Note:272762.1

Problem:
========
- Online Index rebuild takes a long time.
- ONLINE INDEX REBUILD SCANS THE BASE TABLE AND NOT THE INDEX

Symptoms:
=========
Performance issues while rebuilding very large indexes.
- The offline rebuilds of their index is relatively quick -finishes in 15 minutes.
- Issuing index rebuild ONLINE statement => finishes in about an hour.
- This behavior of ONLINE index rebuilds makes it a non-option for large tables
as it just takes too long to scan the table to rebuild the index. The
offline may not be feasible due to due to the 24/7 nature of the database.
- This may be a loss of functionality for such situations.
- If we attempt to simultaneously ONLINE rebuild the same indexes we may encounter
hanging behavior indefinitely (or more than 6 hours).

DIAGNOSTIC ANALYSIS:
--------------------
We can trace the sessions rebuilding the indexes with 10046 level 12.
Comparing the IO reads for the index-rebuild and the index-rebuild-online
reveals the following:

-ONLINE index rebuilds
It scans the base table and it doesn't scan the blocks of the index.

-OFFLINE index rebuilds
It scans the index for the build operation.

- This behaviour is across all versions.

Cause
Cause/Explanation
=============
When you rebuild index online,
- it will do a full tablescan on the base table.
- At the same time it will maintain a journal table for DML data, which has
changed during this index rebuilding operation.
So it should take longer time, specially if you do lots of DML on the same table,
while rebuilding index online.

On the other hand, while rebuilding the index without online option, Oracle will grab
the index in X-mode and rebuild a new index segment by selecting the data from
the old index. So here we are
- not allowing any DML on the table hence there is no journal table involved
- and it is doing an index scan
Hence it will be pretty fast.
Fix
Solution/Conclusion:
===========
- The ONLINE index rebuild reads the base table, and this is by design.
- Rebuilding index ONLINE is pretty slow.
- Rebuilding index offline is very fast, but it prevents any DML on the base table.

转alter index rebuild online引发的血案

‘早上起来没有一个人……‘,伸手抓起手机,‘喂,……应用hang住了……rac的一节点在手工shutdown……需要到现场……’。赶紧穿上衣服,拿起电脑往客户办公室赶。路上还接到客户电话具体描述了下故...

Oracle alter index rebuild 说明

在ITPUB 论坛上看到的一个帖子,很不错。根据论坛的帖子重做整理了一下。 原文链接如下:        alter index rebuild online引发的血案        http:/...

Oracle alter index rebuild 与 ORA-08104 说明

在ITPUB 论坛上看到的一个帖子,很不错。根据论坛的帖子重做整理了一下。 原文链接如下:       alter index rebuild online引发的血案       http://www...

alter index rebuild与alter index rebuild online的区别

一般在什么情况下重构索引 1.当索引所基于表上的DML操作频繁,随着时间推移,索引效率就越来越低,所以就需要重建索引 2.当表被移动另一个表空间时,此表所在的索引会变得无效,也需要重建索引   ...

oracle alter index rebuild online和alter index rebuild的区别

本文用10046事件来解析alter index rebuild与alter index rebuild online的区别 alter index rebuild online实质上是扫描...

alter index index_name rebuild真能释放索引表空间吗?

1楼:  表中的数据每天晚上都要删除一部分(150万条左右),且表上建有主键索引。  当删除掉这些数据后,其所占的索引表空间并没有释放,于是使用了rebuild,  rebuild能释放空间吗?...

index rebuild

  • 2013年05月07日 22:11
  • 49KB
  • 下载

可恶SQL SERVER的索引Disable后不能直接ENABLE,只有rebuild后才OK!SQL SERVER – Disable Clustered Index and Data Insert

Earlier today, I received following email. “Dear Pinal, We looked at your script and found out...

Oracle rebuild index 使用 parallel 时 与 并行度 的注意事项

一.Rebuild 索引 与 并行度 说明在之前的Blog里整理了一些列有关索引相关的Blog,如下: Oracle 索引 详解http://blog.csdn.net/tianlesoftware/...

Index Rebuild Using Job Scheduler

Indexes are the key element for any Database Tuning. In Oracle 10g, REBUILD ONLINE is one of the key...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:alter index rebuild与alter index rebuild online的区别
举报原因:
原因补充:

(最多只允许输入30个字)