Databases Physical Organization

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/57

encourage image

There's no tags or description

Looks like no tags are added yet.

58 Terms

1
New cards

What does one lookup cost with a B* tree on a dense index?

One tree walk, one dense-index block, one data block

2
New cards

How many entries does a dense index hold?

One entry per record

3
New cards

In what order is the data file under a dense index?

Unordered

4
New cards

Where do the records of an interval sit under a dense index?

Scattered over the data blocks

5
New cards

Why does an interval search suffer under a dense index?

It reads one data block per matching record

6
New cards

How many block reads can c matching records cost under a dense index?

Up to c block reads

7
New cards

What would a sorted data file do for an interval?

Put it in consecutive blocks

8
New cards

What is a dense index between the tree and the data?

An extra level

9
New cards

How much more does one lookup cost with a dense index than with a B* tree on a sorted file?

One more block read

10
New cards

Which structure answers intervals best?

A B* tree built directly on a data file sorted by the search key

11
New cards

How does a B* tree on a sorted data file answer an interval?

One root-to-leaf walk plus consecutive data blocks

12
New cards

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."

13
New cards

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."

14
New cards

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."

15
New cards

What does set semantics say about a relation?

It has no logical order

16
New cards

Is the data file of a relation logical or physical?

Physical: its records can be stored in any order we choose

17
New cards

In which order can we store the data file of a relation for a sparse index?

Sorted by the search key

18
New cards

What can be built on a data file of a relation that is sorted on the search key?

A sparse index

19
New cards

What does a sparse index need from the data file?

A physical order on block level

20
New cards

How does the book define a file?

A collection of records

with the same format.

21
New cards

What does the book say a file is appropriate for?

"Thus, for example, a file is an appropriate physical representation for a relation."

22
New cards

Record size

sum of the sizes of all attributes

23
New cards

Records per block

⌊block size / record size⌋

24
New cards

Data blocks

⌈number of records / records per block⌉

25
New cards

Index entries per block of a sparse index

⌊block size / (key size + pointer size)⌋

26
New cards

Index blocks of a sparse index

⌈data blocks / index entries per block⌉

27
New cards

Pointers per B* tree node

⌊(block size + key size) / (pointer size + key size)⌋

28
New cards

Height of a B* tree

⌈log base (pointers per node) of data blocks⌉

29
New cards

Leaf blocks of a B* tree

⌈number of records / pointers per node⌉

30
New cards

Hash-table blocks

⌈pointer size · number of buckets / block size⌉

31
New cards

Total blocks with bucket hashing

data blocks + hash-table blocks

32
New cards

Records per bucket

number of records / number of buckets

33
New cards

Blocks per bucket

⌈records per bucket / records per block⌉

34
New cards

Expected block reads in bucket hashing, hash table on disk

1 + (blocks per bucket + 1) / 2

35
New cards

Average time in bucket hashing, hash table on disk

block read time · expected block reads

36
New cards

Expected block reads in bucket hashing, hash table in RAM

≈ 1 + data blocks / number of buckets

37
New cards

Cost of a heap scan

data blocks

38
New cards

Cost of a binary search on a sorted file

⌈log₂(data blocks + 1)⌉

39
New cards

Cost of a search with a sparse index

⌈log₂(index blocks + 1)⌉ + 1

40
New cards

Cost of a search with a B* tree

tree height + 1

41
New cards

Order of the methods for a uniqueness check, most efficient first

bucket hashing ≻ B* tree ≻ sparse index ≻ sorted file ≻ heap

42
New cards

Uniqueness check before an insert

search the new record's ATT value ⇒ insert only if not found

43
New cards

Matching records of a query

fraction · number of records

44
New cards

Cost of an interval query with a primary index

tree height + ⌈matching records / records per block⌉

45
New cards

Cost of an interval query with a secondary index, known fraction

tree height + leaf blocks · matching records / number of records + matching records − 1

46
New cards

Cost of an interval query with a secondary index, unknown bound

tree height + leaf blocks / 2 + number of records / 2 − 1

47
New cards

Blocks of an interval, such as one year

⌈records per interval / records per block⌉

48
New cards

Block reads of an interval query with a B* tree

tree height + blocks per interval

49
New cards

Query time of an interval query with a B* tree

block reads · block read time

50
New cards

Linear-scan time

data blocks · block read time

51
New cards

Fewest data blocks with uneven buckets

⌈number of records / records per block⌉

52
New cards

Most data blocks with uneven buckets

max over the buckets of the sum of ⌈records in the bucket / records per block⌉

53
New cards

Average blocks read with uneven buckets

most data blocks / number of buckets

54
New cards

Query time with uneven buckets

average blocks read · block read time

55
New cards

Time lost with uneven buckets

worst time − even-bucket time

56
New cards

Limit on the index blocks for a search with a sparse index

⌈log₂(index blocks + 1)⌉ + 1 ≤ limit ⇒ index blocks ≤ 2^(limit − 1) − 1

57
New cards

Maximum number of records for a given number of index blocks

records per block · index entries per block · max index blocks

58
New cards

Number of additional insertions

max records − initial records