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;
按照紅色數字標識執行順序:
SESSION1:
SESSION2:
出現enq: TX - row lock contention等待。
1)Bitmap index上如果DML操作,按照位圖索引塊級別加鎖,鎖定的行多,容易造成阻塞或死鎖。
2)因此,雖然Bitmap index在一些統計運算、提升低選擇性列運算性能上有優勢,Bitmap index在OLTP中則是堅決杜絕使用的。只有在OLAP環境下,數據加載完畢后,基本處于只讀狀態,主要進行統計分析,才比較適合。
這個例子,在B*tree中則不會出現阻塞或死鎖情況。
編輯:hfy
-
死鎖
+關注
關注
0文章
25瀏覽量
8184 -
OLAP
+關注
關注
0文章
24瀏覽量
10269
發布評論請先 登錄
評論