Principle of Bitmap Indexing
Advantages of Bitmap indexes1. Quick statisticsBecause Bitmap indexes only store 0 and 1 fingers, the space occupied by Bitmap indexes is very small, and operations such as count (*) are very fast.2. Efficient ad hoc queriesIn OLAP systems, we often use multi-dimensional statistics, such as census. We often need to perform multi-dimensional queries on gender, age, and place of birth. This is an ad hoc query. Bitmap indexing is very useful for ad hoc queries, because for computers, it is a direct or operation between 0 and 1, which is very fast.
Disadvantages of Bitmap Indexing1. Low repetition leads to a huge bitmap Index
From the above principle, we can know that if the index column of the bitmap is very unique, the graph index may be larger than the original table, which is obviously not suitable.
2. Frequent Updates lead to a large number of locksIf we update a record of gender = 'M', all records of gender = 'M' are locked, and other sessions cannot update the data, this is a nightmare for OLTP systems with high concurrency.
Therefore, bitmap indexes are suitable for scenarios that must meet two requirements:1. A large number of Bitmap index columns are repeated.2. This table is rarely updated.