Oracle中檢查是否需要重構(gòu)索引的sql
更新時間:2013年08月08日 16:49:11 作者:
經(jīng)常需要在Oracle中檢查是否需要重構(gòu)索引,在此寫了個示例語句,有此需求的朋友可以參考下,希望對大家有所幫助
復(fù)制代碼 代碼如下:
SELECT
height, /*Height of the B-Tree*/
blocks, /* Blocks in the index segment */
name, /*index name */
lf_rows, /* number of leaf rows in the index */
lf_blks, /* number of leaf blocks in the index */
del_lf_rows, /* number of deleted leaf rows in the index */
rows_per_key /* average number of rows per distinct key */
blk_gets_per_access /* consistent mode block reads (gets) */
FROM INDEX_STATS
WHERE NAME='INDEX_NAME';
復(fù)制代碼 代碼如下:
ANALYZE index INDEX_NAME VALIDATE STRUCTURE
HEIGHT:
This column refers to the height of the B-tree index, and it's usually at the 1, 2, or 3 level.
If large inserts push the index height beyond a level of 4, it's time to rebuild, which flattens the B-tree.
DEL_LF_ROWS:
This is the number of leaf nodes deleted due to the deletion of rows.
Oracle doesn't rebuild indexes automatically and, consequently, too many deleted leaf rows can lead to an unbalanced B-tree.
BLK_GETS_PER_ACCESS:
You can look at the BLK_GETS_PER_ACCESS column to see how much logical I/O it takes to retrieve data from the index. If this row shows a double-digit number, you should probably start rebuilding the index.
相關(guān)文章
expdp 中ORA-39002、ORA-39070錯誤詳解及解決辦法
這篇文章主要介紹了expdp 中ORA-39002、ORA-39070錯誤詳解及解決辦法的相關(guān)資料,需要的朋友可以參考下2017-02-02Oracle數(shù)據(jù)庫數(shù)據(jù)丟失恢復(fù)的幾種方法總結(jié)
相信大家無論是開發(fā)、測試還是運維過程中,都可能會因為誤操作、連錯數(shù)據(jù)庫、用錯用戶、語句條件有誤等原因,導(dǎo)致錯誤刪除、錯誤更新等問題。當(dāng)你捶胸頓足或嚇得腿軟時,肯定希望有辦法來恢復(fù)這些數(shù)據(jù)。oracle就提供了一些強大的方法或機制,可以幫到有需要的你。2016-12-12oracle中 procedure(存儲過程)和function(函數(shù))本質(zhì)區(qū)別
這篇文章主要介紹了 oracle中 procedure(存儲過程)和function(函數(shù))本質(zhì)區(qū)別,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2017-02-02關(guān)于Oracle Dataguard 日志傳輸狀態(tài)監(jiān)控問題
ORACLE DATAGUARD的主備庫同步,主要是依靠日志傳輸?shù)絺鋷?,備庫?yīng)用日志或歸檔來實現(xiàn)。這篇文章主要給大家介紹了關(guān)于Oracle Dataguard 日志傳輸狀態(tài)監(jiān)控問題,感興趣的朋友跟隨小編一起看看吧2019-05-05淺談Oracle數(shù)據(jù)庫的建模與設(shè)計
淺談Oracle數(shù)據(jù)庫的建模與設(shè)計...2007-03-03關(guān)于ORA-04091異常的出現(xiàn)原因分析及解決方案
這篇文章主要介紹了關(guān)于ORA-04091異常的出現(xiàn)原因分析及解決方案,本文給大家分享異常出現(xiàn)的場景及解決代碼,感興趣的朋友跟隨小編一起看看吧2023-05-05