How Indexes Grow and Pctfree

tolywang發表於2005-01-26

       Indexes are always balanced and they grow from the bottom up. As rows are added, the leaf block fills. When the leaf block is full, the Oracle server splits it into two blocks and puts 50% of the block’s contents into the original leaf block and 50% into a new leaf block. 



            If another block is added to the index, this newly added block must be added to the directory entry in the parent branch block. If this parent branch block is full, the parent branch block is split in a similar way to the leaf block, with 50% of the existing contents being divided between the existing and new branch blocks. If required, this pattern is repeated until the place where the root block becomes a branch block and a new root block is added.


              索引從下往上增長的時候總是會被平衡,當一個行增加時,leaf block被填充,當leaf block被填滿後,oracle server 把該block一分為二並各放50%的資料。當有新的塊被增加到索引時,這個新增的塊必須在父的branch block中增加一條directory entry,當父的branch block被填滿後,branch block就像leaf block一樣,分成兩個branch block並各有50%的資料,如果需要的話,這樣模式會一直被重複,直到root block成為一個branch block並有一個新的root block被增加。

              The more levels an index has, the less efficient it may be. Additionally, an index with many rows deleted might not be efficient. Typically, if 15% of the index data is deleted, then you should consider rebuilding the index.


               如果索引的層次較多,那麼它的效率就不那麼好了,另外一個被刪除很多列的索引也不會那麼有效,如果一個索引的15%的資料被刪除,那麼就需要考慮重建索引了。重建索引比先刪除索引再建立索引效率要高的多。

http://www.itpub.net/showthread.php?s=&postid=2135062#post2135062

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-84268/,如需轉載,請註明出處,否則將追究法律責任。

相關文章