






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Query Processing with Indexes, Selection Using Index, Equality Predicate, Range Predicate, Index versus Table Scan, Index Nested-loop Join, Zig-zag Join using Ordered Indexes, Bitmap Index, Projection Index, Bit-sliced Index, Value-list Index, Technicalities, SUM without Any Index, SUM With a Value-list Index, SUM with a Projection Index, SUM With a Bit-sliced Index, Median, Median with a Projection Index, Median With an Ordered Value-list Index, Median with a Bit-sliced Index, Variant Indexes,
Typology: Slides
1 / 11
This page cannot be seen from the preview
Don't miss anything!







2
Buffer management (due next Wednesday)
“Data Mining Using Fractals and Power Laws” 4-5pm, Monday, February 28 130A North Building (telecast from UNC)
3
Scan (e.g., nested-loop join) Sort (e.g., sort-merge join) Hash (e.g., hash join) )Index
Use an ISAM, B+^ -tree, or hash index on R ( A )
Use an ordered index (e.g., ISAM or B+^ -tree) on R ( A ) Hash index is not applicable
Example: B+^ -tree index on R ( A , B ) How about B+^ -tree index on R ( B , A )?
5
Example: π A (σ A > v ( R ))
One lookup leads to all result tuples in their entirety
6
Need to follow pointers to get the actual result tuples Say that 20% of R satisfies A > v
Generalized value-list index
11
Keywords × documents
1 1 0 … 0 0 0 0 … 0 0 0 1 … 1 0 0 0 … 0 0 0 0 … 0 … … … … …
Tuples
8
10
9
26 108
Search key values
1 means tuple has the particular search key value 0 means otherwise
0 1 2 n – 1
12
Traditionally list contains pointers to tuples B+^ -tree: tuples with same search key values Inverted list: documents with same keywords
How about a bitmap? Still a B+^ -tree, except leaves have a different format
Because of deletion, or variable-length tuples Keep an existence bitmap: bit set to 1 if tuple exists
14
Bitmap AND: bit-wise AND Value-list AND: sort-merge join
Smaller means more in memory and fewer I/O’s
15
TID A B … 0 8 … … 1 8 … … 2 26 … … 3 108 … … … … … … n -1 10 … …
Could be implicit and not explicitly stored
TID A B … 0 8 … … 1 8 … … 2 26 … … 3 108 … … … … … … n -1 10 … …
Projection index
Assuming we fetch them in sorted order
20
Assume a value-list index on Sales ( dollar_sales )
Idea: the index stores dollar_sales values and their counts (in a pretty compact form)
sum = 0; Scan Sales ( dollar_sales ) index; for each indexed value v with value-list B (^) v : sum += v × count-1-bits( B (^) v AND B (^) f );
I/Os: number of blocks taken by the value-list index
Bitmaps can possibly speed up AND and reduce the size of the index
21
Assuming both B (^) f and the index are sorted on TID
Compared with a value-list index, the projection index may be more compact (no empty space or pointers), but it does store duplicate dollar_sales values
Assume a bit-sliced index on Sales ( dollar_sales ), with slices B (^) k – 1 , …, B 1 , B 0
sum = 0; for i = 0 to k – 1: sum += 2 i^ × count-1-bits( B (^) i AND B (^) f );
I/O’s: number of blocks taken by the bit-sliced index
Conceptually a bit-sliced index contains the same information as a projection index But the bit-sliced index does not keep TID Bitmap AND is faster
23
Index is small B (^) f can be applied fast!
Full-fledged index carries a bigger overhead
24
median = 0; B (^) current = B (^) f ; // which tuples we are considering sofar = 0; // number of tuples whose values are less // than what we are considering for i = k – 1 to 0: if (sofar + count-1-bits( B (^) current AND NOT( Bi )) · ½ × count-1-bits( B (^) f )): B (^) current = B (^) current AND B (^) i ; sofar += count-1-bits( B (^) current AND NOT( Bi ); median += 2 i ; else: B (^) current = B (^) current AND NOT( B (^) i );
I/O’s: still need to scan the entire index
29
It helps to be ordered!
Could beat ordered value-list index if B (^) f is “clustered”
30
Traditional: one for each combination of foreign columns Bitmap: one for each foreign column