Lecture 02 Storage
Lecture 02 Storage
Storage (1)
Long Cheng
Assistant Professor
[email protected]
electronic
102 online
main
tape
electronic
dollars/MB
secondarymagnetic nearline
100 optical
tape &
disks
optical
disks
10-2 offline
tape
10-4
10-9 10-6 10-3 10-0 103
access time (sec)
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 3
Random Access Memory (RAM)
Which is RAM?
Main memory
or Disk?
Random access memory (RAM):
Irrespective of the physical
locations of data, the time to
access the data is the same
Main memory Disk
1. https://cdn3.iconfinder.com/data/icons/computer-and-hardware-2-1/34/114-
512.png
2. https://www.nicepng.com/maxp/u2q8u2o0i1w7o0u2/
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 4
Volatile Storage
Which is
volatile? Main
memory or
Disk? Non-volatile
Volatile storage:
Storage would be lost when
the power goes off.
1. https://cdn3.iconfinder.com/data/icons/computer-and-hardware-2-1/34/114-
512.png
2. https://www.nicepng.com/maxp/u2q8u2o0i1w7o0u2/
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 5
List of Volatile and Non-volatile Memory Types
Volatile
Non-volatile
https://en.wikipedia.org/wiki/Computer_memory
Disk:
• Relatively cheap
• ~10 ms
• Not RAM
• Non-volatile
Magnetic tape:
• Cheap
• Seconds
• Not RAM
• Non-volatile
Too slow!!
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 11
Most database systems are
Database Systems Landscape disk-based
A few are main (Oracle, DB2, SQL Server, etc.)
memory-based
(Spark,
SAP HANA, etc.)
https://www.researchgate.net/figure/Landscape-and-categorization-of-the-high-variety-of-existing-database-systems-18_fig2_303562879
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 12
Storage Types for Database Systems
Too small (size)
&
Too expensive
Too slow!!
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 13
Disk Appearance and Inside
1. https://www.indiamart.com/proddetail/2tb-seagate-hard-disk-
3264950212.html
2. http://17.cbhu.frauenchor-altendiez.de/a8/hard-drive-wiring-diagrams.html
Cylinder
Arm
Platter = 2 surfaces
sector
Typical
capacity:
4 KB
block
P CPU
... ...
Main memory M DC Disk controller
Disks
Typical Computer
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 19
Disk Access
Remark:
The unit of access (or the
Disk Access:
unit of transfer between disk
Data is stored and retrieved
and memory) is always a
in units of blocks
block even if only a single bit
is affected
Disk access:
1. Move the arm so that the
heads are on the cylinder of
Arm the block
2. Rotate the platters so that
the heads are on the starting
sector of the block
3. Transfer the data on the block
Seek time
Rotational delay
Disk access:
1. Move the arm so that the
heads are on the cylinder of Disk access time:
the block 1. Seek time +
2. Rotate the platters so that 2. Rotational delay +
the heads are on the starting 3. Transfer time
sector of the block
3. Transfer the data on the block
Transfer time
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 22
Disk Access Time: Seek Time
Seek time
∝
# of cylinders to travel
Disk access time: Seek time
1. Seek time + SEEKTIME(n)
3 or 5x
2. Rotational delay +
3. Transfer time
Needs time to accelerate at the x
beginning
1 N
Why is SEEKTIME(n) not linear? Cylinders Traveled
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 23
Disk Access Time: Seek Time
1 N
Cylinders Traveled
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 24
Disk Access Time: Rotational Delay
Angle to rotate
Head here
𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
Transfer time =
𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
Source: Wikipedia, “Transfer rate of HDD and SATA"
Average
HDD
rotational
[rpm]
latency [ms]
4,200 7.14
5,400 5.56
7,200 4.17
10,000 3.00
15,000 2.00
Source: Wikipedia, "Hard disk drive performance characteristics"
Rotational delay
= 5.5 9.54
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 ms ms
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
Rotational delay
= 0 0.04
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 ms ms
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔