1/57
Looks like no tags are added yet.
What does one lookup cost with a B* tree on a dense index?
One tree walk, one dense-index block, one data block
How many entries does a dense index hold?
One entry per record
In what order is the data file under a dense index?
Unordered
Where do the records of an interval sit under a dense index?
Scattered over the data blocks
Why does an interval search suffer under a dense index?
It reads one data block per matching record
How many block reads can c matching records cost under a dense index?
Up to c block reads
What would a sorted data file do for an interval?
Put it in consecutive blocks
What is a dense index between the tree and the data?
An extra level
How much more does one lookup cost with a dense index than with a B* tree on a sorted file?
One more block read
Which structure answers intervals best?
A B* tree built directly on a data file sorted by the search key
How does a B* tree on a sorted data file answer an interval?
One root-to-leaf walk plus consecutive data blocks
What does the sorted organization allow us to look at?
"On the other hand, the sorted organization allows us to look almost exclusively at those blocks of the index and the main file that contain relevant records."
How many extra accesses does a dense index always require?
"It would thus seem that a file with a dense index always requires two more accesses than if we used, for the main file, whatever organization (e.g., hashed, indexed, or B-tree) we use on the dense index file."
What advantage does the B-tree share with sorted files over hashed access?
"The B-tree shares with the methods the advantage over hashed access of permitting the file to be listed or searched conveniently in sorted order."
What does set semantics say about a relation?
It has no logical order
Is the data file of a relation logical or physical?
Physical: its records can be stored in any order we choose
In which order can we store the data file of a relation for a sparse index?
Sorted by the search key
What can be built on a data file of a relation that is sorted on the search key?
A sparse index
What does a sparse index need from the data file?
A physical order on block level
How does the book define a file?
A collection of records
with the same format.
What does the book say a file is appropriate for?
"Thus, for example, a file is an appropriate physical representation for a relation."
Record size
sum of the sizes of all attributes
Records per block
⌊block size / record size⌋
Data blocks
⌈number of records / records per block⌉
Index entries per block of a sparse index
⌊block size / (key size + pointer size)⌋
Index blocks of a sparse index
⌈data blocks / index entries per block⌉
Pointers per B* tree node
⌊(block size + key size) / (pointer size + key size)⌋
Height of a B* tree
⌈log base (pointers per node) of data blocks⌉
Leaf blocks of a B* tree
⌈number of records / pointers per node⌉
Hash-table blocks
⌈pointer size · number of buckets / block size⌉
Total blocks with bucket hashing
data blocks + hash-table blocks
Records per bucket
number of records / number of buckets
Blocks per bucket
⌈records per bucket / records per block⌉
Expected block reads in bucket hashing, hash table on disk
1 + (blocks per bucket + 1) / 2
Average time in bucket hashing, hash table on disk
block read time · expected block reads
Expected block reads in bucket hashing, hash table in RAM
≈ 1 + data blocks / number of buckets
Cost of a heap scan
data blocks
Cost of a binary search on a sorted file
⌈log₂(data blocks + 1)⌉
Cost of a search with a sparse index
⌈log₂(index blocks + 1)⌉ + 1
Cost of a search with a B* tree
tree height + 1
Order of the methods for a uniqueness check, most efficient first
bucket hashing ≻ B* tree ≻ sparse index ≻ sorted file ≻ heap
Uniqueness check before an insert
search the new record's ATT value ⇒ insert only if not found
Matching records of a query
fraction · number of records
Cost of an interval query with a primary index
tree height + ⌈matching records / records per block⌉
Cost of an interval query with a secondary index, known fraction
tree height + leaf blocks · matching records / number of records + matching records − 1
Cost of an interval query with a secondary index, unknown bound
tree height + leaf blocks / 2 + number of records / 2 − 1
Blocks of an interval, such as one year
⌈records per interval / records per block⌉
Block reads of an interval query with a B* tree
tree height + blocks per interval
Query time of an interval query with a B* tree
block reads · block read time
Linear-scan time
data blocks · block read time
Fewest data blocks with uneven buckets
⌈number of records / records per block⌉
Most data blocks with uneven buckets
max over the buckets of the sum of ⌈records in the bucket / records per block⌉
Average blocks read with uneven buckets
most data blocks / number of buckets
Query time with uneven buckets
average blocks read · block read time
Time lost with uneven buckets
worst time − even-bucket time
Limit on the index blocks for a search with a sparse index
⌈log₂(index blocks + 1)⌉ + 1 ≤ limit ⇒ index blocks ≤ 2^(limit − 1) − 1
Maximum number of records for a given number of index blocks
records per block · index entries per block · max index blocks
Number of additional insertions
max records − initial records