0% found this document useful (0 votes)
6 views

Lecture 02 Storage

The document discusses database system storage. It compares different memory types based on access time and cost, with registers and cache being the fastest and most expensive, main memory being faster than disk but also volatile, and disk being slower than main memory but larger in size and non-volatile. Most database systems use disk storage due to its large capacity and lower cost compared to main memory, though some are main memory-based. A disk contains platters, tracks, sectors, and blocks as its basic units and mechanisms of storage and access. It also explains disk capacity calculations using sample configuration parameters.

Uploaded by

jablejinx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lecture 02 Storage

The document discusses database system storage. It compares different memory types based on access time and cost, with registers and cache being the fastest and most expensive, main memory being faster than disk but also volatile, and disk being slower than main memory but larger in size and non-volatile. Most database systems use disk storage due to its large capacity and lower cost compared to main memory, though some are main memory-based. A disk contains platters, tracks, sectors, and blocks as its basic units and mechanisms of storage and access. It also explains disk capacity calculations using sample configuration parameters.

Uploaded by

jablejinx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Lecture 02: Database Systems

Storage (1)
Long Cheng
Assistant Professor
[email protected]

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 1


Memory Hierarchy

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 2


Comparisons Among Different Memory Types
from Gray & Reuter
104 cache

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.

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) 5
List of Volatile and Non-volatile Memory Types

Volatile

Non-volatile

https://en.wikipedia.org/wiki/Computer_memory

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 6


Comparisons Among Different Storage Types:
Summary

Register and Cache:


• Expensive
• 1-10 ns
• RAM
• Volatile

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 7


Comparisons Among Different Storage Types:
Summary

(Typical) main memory:


• Relatively expensive
• 10-1000 ns
• RAM
• Volatile

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 8


Comparisons Among Different Storage Types:
Summary

Disk:
• Relatively cheap
• ~10 ms
• Not RAM
• Non-volatile

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 9


Comparisons Among Different Storage Types:
Summary

Magnetic tape:
• Cheap
• Seconds
• Not RAM
• Non-volatile

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 10


Storage Types for Database Systems
Too small
(capacity)
&
Too expensive

Database system storage:


• Main memory
• Disk

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

Database system storage:


• Main memory
• Disk

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

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 14


Disk Mechanics
Spindle
Read/write heads
Track

Cylinder
Arm

Platter = 2 surfaces

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 15


Disk Mechanics

sector

Typical
capacity:
4 KB

block

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 16


Disk Capacity

A Sample Disk Configuration:


• 4 platters Question:
• 8192 tracks per surface What’s the capacity of this
• 256 sectors per track disk?
• 512 bytes per sector

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 17


Disk Capacity

A Sample Disk Configuration: Capacity


• 4 platters = 4 × 2 × 8192 × 256 × 512
• 8192 tracks per surface = 22 × 2 × 213 × 28 × 29
• 256 sectors per track = 2(2 + 1 + 13 + 8 + 9) = 233 (bytes)
• 512 bytes per sector = 8 (Gigabytes)

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 18


Disk Access

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

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 20


Disk Access
Spindle
Read/write heads

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

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 21


Disk Access Time

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

Seek time = SEEKTIME(n),


n is the # of cylinders to travel

Disk access time: Seek time


1. Seek time + SEEKTIME(n)
3 or 5x
2. Rotational delay +
3. Transfer time
x

1 N
Cylinders Traveled
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 24
Disk Access Time: Rotational Delay
Angle to rotate

Disk access time:


1. Seek time +
2. Rotational delay +
3. Transfer time
Block we want

Head here

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 25


Disk Access Time: Rotational Delay
Rotational delay
=
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
Disk access time:
Revolutions per minute (RPM):
1. Seek time +
Angle rotated per minute
2. Rotational delay +
Speed = RPM × 2𝜋𝜋 / 60 s
3. Transfer time
A disk with 5400 RPM:
• Time for one rotation is
2𝜋𝜋 over the speed
• 11 ms
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 26
Disk Access Time: Transfer Time
Transfer rate:
the amount of data that
could be moved to/from disk
per unit of time
Disk access time: HDD:
1. Seek time + 100-200 MB/s
2. Rotational delay + SSD:
3. Transfer time ~ 600 MB/s

𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
Transfer time =
𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
Source: Wikipedia, “Transfer rate of HDD and SATA"

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 27


Disk Access Time: Summary
Seek time = SEEKTIME(n)
Depends on where the
n is the # of cylinders to travel
block is located

Disk access time: Rotational delay


1. Seek time + =
2. Rotational delay + 𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
3. Transfer time 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔

Irrespective of where 𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔


the block is located Transfer time =
𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 28


Disk Access Time: Summary

Disk access time:


Conclusion:
1. Seek time +
Disk storage is not RAM
2. Rotational delay +
(random access memory)
3. Transfer time

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 29


Disk Access Scenarios

Random disk access Sequential disk access

The block to be accessed


The block to be accessed
is the one that follows
is a random one
what was just accessed

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 30


Random Disk Access: Seek Time
Suppose
Seek time = SEEKTIME(n) • i is the cylinder of the block
n is the # of cylinders to travel just accessed
• j is the cylinder of the block to
be accessed
Rotational delay
n = |i - j|
=
𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 𝑡𝑡𝑡𝑡 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 Average seek time =
𝑵𝑵 ∑𝑵𝑵
∑𝒊𝒊=𝟏𝟏 𝒋𝒋=𝟏𝟏 𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺𝑺( 𝒊𝒊 − 𝒋𝒋 )
𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠
𝑵𝑵𝟐𝟐
N: # of cylinders
𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 Average seek time (HDD)
Transfer time =
𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 ~4 ms for high end drives
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 31
Random Disk Access: Rotational Delay

Seek time = SEEKTIME(n)


n is the # of cylinders to travel Average rotational delay
=
𝑨𝑨𝑨𝑨𝑨𝑨𝑨𝑨𝑨𝑨𝑨𝑨𝑨𝑨 𝒐𝒐𝒐𝒐𝒐𝒐𝒐𝒐𝒐𝒐𝒐𝒐𝒐𝒐 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
Rotational delay
= 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 =
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒐𝒐𝒐𝒐 𝒉𝒉𝒉𝒉𝒉𝒉𝒉𝒉 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 (𝒊𝒊. 𝒆𝒆. , 𝝅𝝅)
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
=
𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠
Transfer time = Time for half rotation
𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 32


Random Disk Access: Rotational Delay

Seek time = SEEKTIME(n) Average rotational delay


n is the # of cylinders to travel =
Time for half rotation
Rotational delay
=
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔 A disk with 5400 RPM:
• The amount time for half
𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 rotation: 𝜋𝜋 over the speed
Transfer time =
𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 • 5.5 ms
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 33
Random Disk Access: Rotational Delay

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"

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 34


Random Disk Access: Transfer Time

Seek time = SEEKTIME(n) Transfer time relies only on the


n is the # of cylinders to travel disk configuration and is
irrespective of the physical
Rotational delay address of the block.
=
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 Consider a disk with
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔 • block size = 4KB
• transfer rate = 100MB/sec
𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔 Transfer time
Transfer time = = 4KB / 100MB/sec
𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
≈ 4 / 100 ms = 0.04 ms
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 35
Random Disk Access:

Seek time = SEEKTIME(n) 4


n is the # of cylinders to travel ms

Rotational delay
= 5.5 9.54
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 ms ms
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔

𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔 0.04


Transfer time =
𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 ms

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 36


Disk Access Scenarios

Random disk access Sequential disk access

The block to be accessed


The block to be accessed
is the one that follows
is a random one
what was just accessed

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 37


Sequential Disk Access: Seek Time
Since
Seek time = SEEKTIME(n) • the block to be accessed is
n is the # of cylinders to travel the next one
• probably at the same
Rotational delay cylinder
= n=0
𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 𝑡𝑡𝑡𝑡 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟
𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠
Seek time ≈ 0
𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠
Transfer time =
𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 38


Sequential Disk Access: Rotational Delay

Seek time = SEEKTIME(n) Since


n is the # of cylinders to travel • after the current block is
accessed, the head points
Rotational delay to the next block
= Angle to rotate = 0
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
Rotational delay ≈ 0
𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠
Transfer time =
𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 39


Sequential Disk Access: Transfer Time

Seek time = SEEKTIME(n) Transfer time relies only on the


n is the # of cylinders to travel disk configuration and is
irrespective of the physical
Rotational delay address of the block.
=
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 Consider a disk with
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔 • block size = 4KB
• transfer rate = 100MB/sec
𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔 Transfer time
Transfer time = = 4KB / 100MB/sec
𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓
≈ 4 / 100 ms = 0.04 ms
DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 40
Sequential Disk Access

Seek time = SEEKTIME(n) 0


n is the # of cylinders to travel ms

Rotational delay
= 0 0.04
𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 ms ms
𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔

𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃𝒃 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔 0.04


Transfer time =
𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕 𝒓𝒓𝒓𝒓𝒓𝒓𝒓𝒓 ms

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 41


Disk Access Scenarios

Random disk access Sequential disk access


9.54 0.04
ms/block ms/block
This would have fundamental influence on the
design and implementation of disk-oriented
Rule of Thumb: database systems as will be seen later
• Random disk access is expensive
• Sequential disk access is much cheaper

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 42


Recap
• Memory hierarchy and disk oriented database systems
• Disk mechanics
• Disk access and disk access time
• Random disk access vs sequential disk access

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 43


Next Lecture

Lecture 03: Database Systems Storage (2)

DATABASE SYSTEM PRINCIPLES: Lecture 02: Database Systems Storage (1) 44

You might also like