1.Bitmap index使用
DROP TABLE t;
dingjun123@ORADB》 SELECT COUNT(*),
COUNT(*) COUNT(DISTINCTOWNER)
76422 35
CREATE TABLE bitmap_test(ID NUMBER,status NUMBER);
CREATE BITMAP INDEX idx_bitmap_test ON bitmap_test(status);
INSERT INTO bitmap_test VALUES(1,0);
INSERT INTO bitmap_test VALUES(2,0);
INSERT INTO bitmap_test VALUES(3,0);
INSERT INTO bitmap_test VALUES(1,1);
INSERT INTO bitmap_test VALUES(2,1);
INSERT INTO bitmap_test VALUES(3,1);
COMMIT;
按照紅色數(shù)字標識執(zhí)行順序:
SESSION1:
SESSION2:
出現(xiàn)enq: TX - row lock contention等待。
1)Bitmap index上如果DML操作,按照位圖索引塊級別加鎖,鎖定的行多,容易造成阻塞或死鎖。
2)因此,雖然Bitmap index在一些統(tǒng)計運算、提升低選擇性列運算性能上有優(yōu)勢,Bitmap index在OLTP中則是堅決杜絕使用的。只有在OLAP環(huán)境下,數(shù)據(jù)加載完畢后,基本處于只讀狀態(tài),主要進行統(tǒng)計分析,才比較適合。
這個例子,在B*tree中則不會出現(xiàn)阻塞或死鎖情況。
編輯:hfy
-
死鎖
+關(guān)注
關(guān)注
0文章
25瀏覽量
8202 -
OLAP
+關(guān)注
關(guān)注
0文章
24瀏覽量
10303
發(fā)布評論請先 登錄
評論