As already discussed, ALTER INDEX COALESCE in 10g onwards works in a very similar manner to ALTER INDEX SHRINK SPACE.
However, there are a number of key differences.
The first thing to point out is that each command has a slightly different purpose.
Coalesce is designed specifically to reduce fragmentation within an index but not to deallocate any freed up blocks which are placed on the freelist and recycled by subsequent block splits.
Shrink is designed specifically to reduce the overall size of an index segment, resetting the High Water Mark (HWM) and releasing any excess storage as necessary.
The key difference being that Shrink must reorganise the index leaf blocks in such a way that all the freed up, now empty blocks are all grouped together at “one end” of the index segment. All these blocks can then be deallocated and removed from the index segment. This means that specific leaf block entries must be removed from these specific blocks, in order to free up the leaf blocks in this manner.
Although Coalesce in 10g performs the operation in a similar manner to that of the Shrink Space, it can be more “lazy” in how it deals with the subsequent empty blocks and places then on the segment freelist as necessary.
COALESCE and SHRINK SPACE COMPACT are logically equivalent commands. Both options will “defragment” an index by “merging” index entries where possible thus reducing the number of blocks within the logical index structure. Both will result in the same number of leaf blocks within the index and both will result in the index height not being changed.
However, there are two key differences.
1) The SHRINK SPACE COMPACT option has the disadvantage of being more expensive to process as it has to concern itself with ensuring all necessary blocks can be emptied from the physical “end” of the index segment to be subsequently deallocated. This will result in more undo and redo being generated during the defragmentation of the index than would have been generated by the same corresponding COALESCE command.
2) The SHRINK SPACE COMPACT option has the advantage of being able to immediately deallocate the empty blocks, thereby reducing the actual size of the index segment by issuing a subsequent SHRINK SPACE option (although of course this can be performed in the one step by issuing SHRINK SPACE in the first place). However, the COALESCE option will not be able to just deallocate the free space. A subsequent Index SHRINK SPACE command on a previously coalesced index will require additional undo and redo than that of a previously “Shrunk” index as the necessary empty blocks are removed from the freelist and redistributed to allow for the de-allocation of blocks and the resetting of the High Water Mark of the index segment.
Note also that the Shrink option can only be used in Automatic Segment Space Management (ASSM) tablespaces.
Use Coalesce when the intent is to just defragment an index, knowing that the freed leaf blocks will be recycled by subsequent block splits, as it uses less resources than an equivalent Index Shrink Space.
Use Shrink Space when the intent is to reduce the actual storage allocated to an index, for example in the scenario where a table has permanently reduced its size and the index is unlikely to reuse the freed storage.
This demo highlights the Differences (and similarities) between an Index Coalesce and an Index Shrink Space.
Note however, that an index REBUILD might actually use substantially less resources than either a Coalesce or a Shrink Space and might reduce the height of an index as well.
参考至:http://richardfoote.wordpress.com/2008/02/06/differences-and-similarities-between-index-coalesce-and-shrink-space/
如有错误,欢迎指正
邮箱:czmcj@163.com
相关推荐
This invaluable resource will help practitioners and students sort out differences and similarities between popular myofascial styles. Early chapters offer a solid review of anatomy and physiology as ...
C++与C#是两种广泛应用的编程语言,它们在很多方面都有显著的区别。本文将详细探讨这两种语言之间的主要差异,帮助开发者理解它们各自的特点。 1. 命名空间和成员访问: - C# 使用点号(.)来分隔命名空间、类以及...
标题“IFRS and US GAAP similarities and differences 2018”指的是2018年国际财务报告准则(IFRS)与美国通用会计准则(US GAAP)之间的相似性和差异。描述中提到的PwC是普华永道(PricewaterhouseCoopers)的缩写,这是...
Talk Show Differences Between China and America from the Perspective of the Form and Express.zip
Differences-between-LIN20-and-LIN21 (1)
The Differences Between Chinese and American Cultures from the Perspective of Politeness Utterances.zip
进化编程(Evolutionary Programming, EP)与进化策略(Evolution Strategies, ES)是两种在计算机科学领域中广泛应用的优化算法,它们源自生物进化论的基本原理,旨在通过模拟自然选择、遗传变异等过程来解决复杂...
《东西方饮食文化差异》 饮食,作为人类生活的基本需求之一,不仅是生理的满足,更是文化的体现。中国和西方在饮食习惯、食材选择、烹饪方式等方面存在着显著的文化差异,这些差异背后反映了各自的历史传统、哲学...
It will guide you through installing the Android SDK for Intel Architecture, help you understand the differences and similarities between processor architectures available in Android devices, teach ...
The information about differences and similarities between these groups would certainly be interesting for a professional working in South London; however, it is overly detailed for an American ...
【描述】:“Similarities and differences from the perspective of value.zip” 描述中的“.zip”表明这是一个压缩文件,通常包含多个文档或其他类型的文件。这个文件名进一步强调了主题,即对价值视角下的相似点...
There is a detailed segment comparing solid-state drives (SSDs) to conventional hard disk drives (HDDs), explaining all the differences and similarities between them in an easy to understand fashion....
在IT领域,尤其是在企业软件开发中,理解不同的增强技术至关重要。本文将深入探讨EEWB(Enhancement Element Workbench)和BDT(Business Data Type)之间的差异,这两种工具都是用于SAP CRM系统中的对象扩展和定制...
新一代图形API,如Vulkan、Direct3D 12 (D3D12) 和Metal,是计算机图形学领域的重大进展,它们在SIGGRAPH 2015会议上被广泛讨论。这些API旨在解决旧有图形接口的局限性,提高性能并提供更稳定的驱动程序体验。...
The information about differences and similarities between these groups would certainly be interesting for a professional working in South London; however, it is overly detailed for an American ...
Chapter 8 transitions to C++, discussing the differences and similarities between C and C++. Topics include object-oriented programming (OOP) concepts, such as inheritance and polymorphism, and how ...
### 最小二乘法与卡尔曼滤波的区别 在GPS导航系统和其他位置定位技术中,两种最常用的估计方法是最小二乘法(Least Squares, LS)和卡尔曼滤波(Kalman Filtering, KF)。这两种方法虽然表面上看起来有很大区别,但...
SPSS Data Analysis for Univariate, Bivariate, and Multivariate Statistics By 作者: Daniel J. Denis ISBN-10 书号: 1119465818 ISBN-13 书号: 9781119465812 Edition 版本: 1 出版日期: 2018-09-25 pages 页数:...