The Secrets of Oracle Bitmap Indexes
Overview
Oracle's two major index types are Bitmap indexes and B-Tree indexes. B-Tree indexes are the regular type that OLTP systems make much use of, and bitmap indexes are a highly compressed index type that tends to be used primarily for data warehouses.
Characteristic of Bitmap Indexes
- For columns with very few unique values (low cardinality)
Columns that have low cardinality are good candidates (if the cardinality of a column is <= 0.1 % that the column is ideal candidate, consider also 0.2% – 1%)
- Tables that have no or little insert/update are good candidates (static data in warehouse)
- Stream of bits: each bit relates to a column value in a single row of table
create bitmap index person_region on person (region);
Row Region North East West South
1 North 1 0 0 0
2 East 0 1 0 0
3 West 0 0 1 0
4 West 0 0 1 0
5 South 0 0 0 1
6 North 1 0 0 0Advantage of Bitmap Indexes
The advantages of them are that they have a highly compressed structure, making them fast to read and their structure makes it possible for the system to combine multiple indexes together for fast access to the underlying table.
Compressed indexes, like bitmap indexes, represent a trade-off between CPU usage and disk space usage. A compressed structure is faster to read from disk but takes additional CPU cycles to decompress for access - an uncompressed structure imposes a lower CPU load but requires more bandwidth to read in a short time.
One belief concerning bitmap indexes is that they are only suitable for indexing low-cardinality data. This is not necessarily true, and bitmap indexes can be used very successfully for indexing columns with many thousands of different values.
Disadvantage of Bitmap Indexes
The reason for confining bitmap indexes to data warehouses is that the overhead on maintaining them is enormous. A modification to a bitmap index requires a great deal more work on behalf of the system than a modification to a b-tree index. In addition, the concurrency for modifications on bitmap indexes is dreadful.
Bitmap Indexes and Deadlocks
Bitmap indexes are not appropriate for tables that have lots of single row DML operations (inserts) and especially concurrent single row DML operations. Deadlock situations are the result of concurrent inserts as the following example shows: Open two windows, one for Session 1 and one for Session 2
Session 1 Session 2 create table bitmap_index_demo (
value varchar2(20)
);
insert into bitmap_index_demo
select decode(mod(rownum,2),0,'M','F')
from all_objects;create bitmap index
bitmap_index_demo_idx
on bitmap_index_demo(value);
insert into bitmap_index_demo
values ('M');
1 row created.
insert into bitmap_index_demo
values ('F');
1 row created.insert into bitmap_index_demo
values ('F');
...... waiting ......
ERROR at line 1:
ORA-00060: deadlock detected while waiting for resourceinsert into bitmap_index_demo
values ('M');
...... waiting ......
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23895263/viewspace-699995/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Restrictions on Create Bitmap IndexesRESTIndex
- Bitmap Indexes and Nulls (224)IndexNull
- Bitmap Indexes (220)Index
- bitmap indexes 的結構分析Index
- Bitmap Indexes on Partitioned Tables (225)Index
- Bitmap Join Indexes (226)Index
- Bitmap Indexes on Index-Organized Tables (232)IndexZed
- 有關Bitmap Join Indexes的精彩帖一Index
- 有關Bitmap Join Indexes的精彩帖二Index
- Secrets of the Oracle Database筆記OracleDatabase筆記
- 高效的SQL(bitmap indexes optimize low cardinality columns)SQLIndex
- ORACLE INDEXESOracleIndex
- Oracle - Tables/IndexesOracleIndex
- ORACLE -> NULL & INDEXESOracleNullIndex
- Bitmap Indexes 學習與測試_20091213Index
- Secrets of Firefox 1.0Firefox
- [轉載]oracle_Bitmap IndexOracleIndex
- 閱讀CSS Secrets(四)CSS
- oracle 點陣圖索引(bitmap index)Oracle索引Index
- Oracle之不可見索引(invisible indexes)Oracle索引Index
- Rebuild IndexesRebuildIndex
- Oracle 19C 無法啟用Auto Indexes特性OracleIndex
- HTTP Server load balancing secretsHTTPServer
- Reverse Key IndexesIndex
- Overview of Partitioned IndexesViewIndex
- Local Partitioned IndexesIndex
- Global Nonpartitioned IndexesIndex
- Extents in Indexes (19)Index
- bitmap
- 翻譯(九)——Clustered Indexes: Stairway to SQL Server Indexes Level 3IndexAISQLServer
- [重慶思莊每日技術分享]-重建 oracle Bootstrap IndexesOraclebootIndex
- BITMAP索引的INLIST ITERATOR與BITMAP OR索引
- oracle sql hint提示_BITMAP CONVERSION FROM ROWIDSOracleSQL
- ubuntu中使用機密資料SecretsUbuntu
- Kubernetes 中 Secrets 物件的使用物件
- c# svg轉Bitmap Bitmap轉ImageSourceC#SVG
- skip_unusable_indexesIndex
- Global Range Partitioned IndexesIndex