Bitmap indexes are more advantageous than B-tree indexes in certain situations:
• When a table has millions of rows and the key columns have low cardinality—that
is, there are very few distinct values for the column. For example, bitmap indexes
may be preferable to B-tree indexes for the gender and marital status columns of a
table containing passport records.
• When queries often use a combination of multiple WHERE conditions involving
the OR operator.
• When there is read-only or low update activity on the key columns.
A bitmap index is an indexing method added with Oracle V7.3 that can provide both performance benefits and storage savings. Bitmap indexes are particularly useful for data warehousing environments because data is usually updated less frequently and ad hoc queries are more common.
Bitmap INdex is only useful when you have a large number of records but few distinct value . It's very different from B-tree index .
If the table is updated frequently , you should not apply Bitmap Index on it .
位图索引适用于相异程度比较小,值不经常改变的数据列,例如flag之类的字段,位图索引执行数据库操作时的代价比较大,使用时应该权衡。
位图索引的创建:
create bitmap index index_name on table_name(col[,col]);
建立位图索引后,我们也应该对相关的表、索引定期进行分析。
如果位图索引列是非空列时,在对相应表的非空列进行count查询时,在没有where子句时,oracle也可能使用到位图索引,并且速度提高比较明显。