cs4432- week 2

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

All cards

1
What is a database record tuple?
a sequence of bytes representing fields stored on disk
2
What are the two types of records?
fixed length and variable length
3
When is a record fixed length?
when all fields have fixed size
4
When is a record variable length?
when at least one field has variable size
5
What is an example of a fixed length data type?
char and int
6
What is an example of a variable length data type?
varchar
7
How are fixed length records stored?
fields are aligned and concatenated with a header
8
What is stored in a record header?
schema pointer length and metadata like timestamps
9
What is stored in a block header?
timestamps links to other blocks and record offsets
10
Can a record span multiple disk blocks?
no records are not split across blocks
11
How do you access the ith record in fixed length records?
directly without scanning previous records
12
How do you access the ith field in fixed length records?
directly using offsets
13
Why are variable length records useful?
they save space when most values are small
14
What does a variable length record header store?
record length and pointers to variable fields
15
How are variable length fields stored?
fixed fields first then variable fields
16
What is a slot directory?
a structure that stores offsets of records in a block
17
How do slot directories grow?
from one end of the block while records grow from the other
18
Does rid change when records move in slot directory?
no rid remains the same
19
What is a record id rid?
a pair block id and slot number
20
What happens when deleting a record in slot directory?
it leaves empty space and may create dead slots
21
How do you compute number of records per block for fixed length?
floor of block size divided by record size
22
Why is it harder to compute for variable length records?
sizes vary so only a range can be estimated
23
What is the packed approach?
records are stored with no gaps and moved on deletion
24
What is a drawback of packed approach?
moving records changes record id
25
What is the bitmap unpacked approach?
uses bits to mark occupied or free slots
26
What is a drawback of bitmap approach?
does not work for variable length records
27
What is the buffer manager?
component that manages which disk blocks are in memory
28
Why must data be in main memory?
processing can only happen in main memory
29
What is a buffer pool?
an array of frames storing disk pages in memory
30
What is a frame?
a slot in buffer pool that holds one disk block
31
What is a disk page in memory called?
a memory page
32
What metadata is stored per frame?
frame number disk page id pin count and dirty flag
33
What is a dirty flag?
indicates if a page has been modified
34
What is a pinned page?
a page that cannot be removed from memory
35
What is the pin count?
number of users currently using a page
36
What happens if a requested block is not in memory?
it is loaded from disk into a frame
37
What happens if no empty frame exists?
a frame must be replaced using a replacement policy
38
What happens if a replaced frame is dirty?
it must be written back to disk
39
What happens if all frames are pinned?
request cannot be served and is queued
40
How can we efficiently check if a block is in buffer pool?
use a hash table mapping block id to frame
41
How can we efficiently find empty frames?
use a list or bitmap of free frames
42
What is a replacement policy?
a strategy to choose which frame to evict
43
What is LRU?
least recently used page is replaced
44
What metadata does LRU require?
last touched timestamp
45
When does LRU work well?
when frequently used pages are accessed repeatedly
46
What is the clock policy?
an approximation of LRU using a circular scan
47
What extra metadata does clock policy use?
reference bit and pin count
48
What happens if ref bit is 1 in clock policy?
set it to 0 and skip
49
What happens if ref bit is 0 and page is unpinned?
it is replaced
50
What is sequential flooding?
repeated sequential scans causing constant page replacement
51
Why is sequential flooding bad?
it increases disk io and reduces buffer efficiency
Study all 51 cards for free