cs4432 - week 3

52 flashcardsby alicia
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
Why is sorting important in databases?
to support order by queries grouping duplicate elimination joins and indexing
2
What is the main challenge of sorting in DBMS?
data is much larger than main memory
3
What dominates cost in external sorting?
disk io cost
4
What is the goal when designing external sorting algorithms?
reduce i o operations
5
What is the time complexity of merging two sorted lists?
o_n plus m
6
How does merge work?
compare elements from two lists and move the smaller one forward
7
What must be true about lists before merging?
they must already be sorted
8
What is external merge sort used for?
sorting data larger than memory using disk
9
What are the two phases of two way external sort?
prepare and merge
10
What happens in pass 0 of external sort?
read a page sort it and write it back
11
How many buffers are needed for two way merge?
three buffers
12
What is a run in external sorting?
a sorted sublist of pages
13
What happens in each merge pass?
merge smaller runs into larger sorted runs
14
What is the cost of one pass in external sort?
2n i/o operations
15
What is total i o cost in two way merge sort?
2n times number of passes
16
How many passes in two way merge sort?
log base 2 of n plus 1
17
What is the idea behind m way merge sort?
use more buffers to merge more runs at once
18
What happens in phase 0 of m way merge?
sort m pages at once into one run
19
How many runs are produced in pass 0?
n divided by m
20
How many buffers are used in merging?
m minus 1 for input and 1 for output
21
What is the benefit of using more buffers?
fewer passes and lower i o cost
22
What is the formula for number of passes in m way sort?
1 plus log base m minus 1 of n over m
23
What is total i o cost in m way sort?
2n times number of passes
24
What is a table scan?
reading every page and record in a table
25
What is the i o cost of table scan?
n page reads
26
What is the minimum memory needed for table scan?
one block
27
Why are table scans inefficient?
they read all data even if few records match
28
What is an index used for?
to speed up access to data
29
What is a search key?
attribute used to look up records
30
What does an index entry contain?
search key value and pointer
31
Why are index files smaller than data files?
they store only keys and pointers
32
What are types of indexes?
dense sparse primary secondary multi level
33
What is a dense index?
one index entry per record
34
What is a sparse index?
one index entry per data block
35
Can sparse index be used on unordered files?
no
36
Can dense index be used on unordered files?
yes
37
What is a primary index?
index on the sorted ordering column
38
What is a secondary index?
index on a non ordering column
39
What type of index must secondary index be?
dense
40
What is an advantage of sparse index?
uses less space
41
What is an advantage of dense index?
can determine if record does not exist without data file
42
What is a drawback of dense index?
requires more space and updates
43
What is a multi level index?
index built on top of another index
44
Are higher level indexes dense or sparse?
sparse
45
Why use multi level indexes?
reduce search time further
46
What is index binary search?
search sorted index by checking middle entries
47
How does sparse index locate a key?
find closest smaller key then scan data block
48
What happens when deleting in dense index?
may require updating many index entries
49
What happens when deleting in sparse index?
less reorganization needed
50
Why keep free space in blocks?
to allow easier insertions
51
What are overflow blocks?
extra blocks used when insertion space is full
52
What is a benefit of primary index?
records with similar keys are stored together enabling sequential io
Study all 52 cards for free