Академический Документы
Профессиональный Документы
Культура Документы
CPU
Main
Memory
System Bus
Disk Controller
Block
(512B 50KB)
~ 100 MB/sec
...
Disk
Structure of a Platter
Access Time
CPU
Access Time
Disk
Access time =
(seek time) + (rotational delay) +
(transfer time)
page
Memory
10
Seek Time
Rotational Delay
Head Here
x
1
Typical disk:
Block I Want
Cylinders Traveled
12
Transfer Rate
Read blocks as
the platter rotates
Disk Head
13
14
q 6000 RPM
q 10,000 sectors/track
q Assume the head
is above the first
sector
q 6000 RPM
q 10,000 sectors/track
q 10ms seek time
q Assume the head
is above the first
sector
15
Random I/O
16
SSD
Random IO
~100 IOs/sec
~100K IOs/sec
Transfer rate
~ 100MB/sec
~500MB/sec
Capacity/$
~1TB/$50
(in 2015)
~100GB/$50
(in 2015)
18
RAID
19
20
RAID Levels
Data Modification
21
Abstraction by OS
Sequential blocks
22
2
3
4
.
.
.
24
Reference
Jane
CS
3.7
Susan
ME
1.8
June
EE
2.6
Tony
CS
3.1
25
Spanned vs Unspanned
26
Spanned vs Unspanned
Unspanned
T1
T2
T4
T5
T3
T6
Spanned
T4
T1
T2
T3
T4
T5
T6
T7
T8
28
Variable-Length Tuples
Reserved Space
Reserve the maximum space for each
tuple
T1
T2
T3
T2
T3
T4
T4
T5
T6
Q: Any problem?
29
30
Variable-Length Space
R1
Slotted Page
R2
R3
R4
Header
R5
R6
Free
space
Block
R3
R4
R1
R2
32
Long Tuples
Long Tuples
ProductReview(
pid INT,
reviewer VARCHAR(50),
date DATE,
rating INT,
comments VARCHAR(1000))
Block size 512B
How should we store it?
Spanning
Splitting tuples
Block with short attributes.
T1 (b)
T2 (a)
T2 (b)
T2 (b)
This block may also
have fixed-length slots.
33
Sequential File
34
Sequencing Tuples
T1 (a)
3.7
2.8
1.8
3.9
1.0
2.4
T3
T6
T8
?
T7
35
36
Sequencing Tuples
Sequencing Tuples
Two options
1) Rearrange
T1
T3
T6
T7
T8
T1
T4
T5
T8
T9
T1
T7
T3
T6
T8
?
T7
37
38
Sequencing Tuples
Things to Remember
Disk
Overflow page
header
T1
T2
T4
T6
T7
Overflow page
T8
T9
Files
Spanned/unspanned tuples
Variable-length tuples (slotted page)
Long tuples
PCTFREE in DBMS
CREATE TABLE R(a int) PCTFREE 40
40