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