Data Inverted/Bitmap Indexing Flashcards
In querying data
All attributes in the predicate are not PKs or FKs - clearly they are secondary attribute
The simplest solution is to serial read table and apply contrived predicate on each row. Expensive if there’s a lot of data.
How can we use indexes to be more effective than a sequential scan.
Solutions to Indexes in queries
Split queries to 2 and merge for common -> success depends on selectiveness
Split queries by column and merge for common -> high selectiveness required.
Bitmap
- If an access request is not restricted to one PK attribute, simple direct access methods fail.
Bitmaps are an example of secondary index file structure. Convert search keys to a bit sequence related to a record or attribute instance.
Secondary index file structure
Table for relating secondary key field values to a number of master file records that have value. Essential for queries on multiple attributes or sequence of joins.
Bitmaps Variety
Fully inverted or Partially inverted indexes
Fully inverted index
A file that inverts all the attributes of a data file into bitmap. Some implementations make data file online retention redundant.
Partially inverted index
File structure that inverts only a subset of the data file attributes
Building a bitmap
Every value in a record’s attribute is represented as a key and the supplementary value in the index is a list of record pointers that hold that value.
- Build by converting search keys into a boolean flag
Bitmap Characteristics
- Compact
- Highly sparse
- Accept no unique value
Pattern Matching with Bitmaps
efficient. Once read, a bitmap page is unpadded and querying offers huge gains. Inadequate if attribute to invert has many distinct values. Expect rows to have little changes in reference-look-up values
Bitmap entries in covered indexes
Index Range Scan of an IOT: Oracle reads root node of index 1 and block in each branch 2+3 to find starting point of the range scan.
As row data is in IOT oracle needs to scan only leaf blocks 4,5,6 until all rows in range have been found.
More leaf blocks than normal index but less block reads overall.
IOT meaning
index-organised-tables
Queries that can be addressed by bitmaps include
- AND as intersection
- OR as Union
- NOT as compliment
- Minus (A and not B)
How to get result bitmap
Each op takes 2 bitmaps of same size and applies the operation on corresponding bits
Bitmap enhancements
Compression is possible (on strings of zero) to counter sparsity. Requires decompress on unpadding into RAM, and needs to be compressed before writing to disk.