Transcript Slide 1

Database Systems
Disk Management Concepts
WHY DO DISKS NEED MANAGING?
• logical information  physical representation
• bigger databases, larger records, more complex
structures in the logical schema, unusual data types
• more points at which bottleneck develop, and
performance degrades
• behaviour of the data population over time
• behaviour of the user population over time
• interaction between
What role does the DBMS
have?
QUERY
1. QUERY PARSING, RELATIONAL
OPERATORS
2. OPTIMISATION AND EXECUTION
3. FILES AND ACCESS METHODS
4. BUFFER MANAGEMENT
5. DISK SPACE MANAGEMENT
Logical Layers
Construct a strategy for a given Query, e.g.:
SELECT S.Semester, count(*)
FROM
Section S
WHERE
S.Year > 91
GROUP BY
S.Semester
HAVING COUNT (*) > all (Select count(*) from
section
Group by Section)
Query Optimiser, Relational
Operators
• Phase 1: Convert into relational algebra
expression using Select, Join, Project;
e.g., includes S.Semester in the Projection
list
• Phase 2: Consider alternate access plans
- without index, with index - and choose an
execution plan.
Physical Layers
• File Level Management
Pages - Collection of data records, index records
Keeps track of pages within a file
Organizes the information within a page
• Buffer Management
Partitions available main memory into pages
Bring pages from disk to main memory
Uses routines in DSM
• Disk Space Management
Management of space on disk
DBMS & STORAGE DEVICE
PROPERTIES
•
•
•
•
•
•
Why not put everything in Primary Storage?
fast access
but (often) limited storage capacity
even if PS large, there are other reasons…
– volatility
– stability
cost per unit stored
consistency and integrity
locking and concurrency
DBMS, STORAGE DEVICE
PROPERTIES
Secondary Storage
•
•
•
•
•
•
tape
magnetic disk
drum
optical disk, CD-ROM,
database-oriented hardware devices
other
Secondary Storage
• Hardware parameters and access performance
• Disk Capacity
– number of surfaces
– number of read/write heads
– number of tracks
(30 to 16000)
– sectors, blocks, pages
– capacity of a track in blocks (512..2048)
– capacity of a cylinder
Illustration – Disk, Track, Sector
• Disk, sector, track, block
• Seeking a track
Seek time Is a time needed to move R-W head from one
position to another – the desired one.
In estimations only the average seek time is considered
The average seek time is provided in the manufacturer disk
specification
Illustration – Disk, Track, Sector
• Block
• Seeking a track
• Rotational delay
(latency)
Rotational delay is a time needed for rotation of the disk resulting
in the positioning of of the desired block under the R-W head.
In estimations only the average rotational delay is considered
The average rotational delay is calculated as ½ time of one full
rotation
Illustration – Disk, Track, Sector
…
•
•
•
•
Block
Seeking a track
Rotational delay (latency)
Block transfer
Block transfer time is a time of moving one block under the R-W head.
Block transfer time (btt) is proportional to the relative size of a block in the
track and to the time of one rotation.
Eg. If a block occupies 1/100 part of a track and one rotation of a track needs
50msec then btt is 50*1/100 = 0.5 msec
Illustration – Disk, Track, Sector
…
• Disk pack
Hardware parameters and access performance
• Disk Organisation
Conceptual:
…
Logical:

Physical:
cylinder c
to buffer b
Select Semester from Section
Read Byte I of Record n of File f
Read block m of track t of
of disk d and transfer
Transfer of a block (or cluster of blocks):
smallest unit of transfer
Total transfer time is combined from seek times,
rotational delays and block transfer times:
Illustration - Cylinder
• Cylinder, Contiguous blocks
• No seek time is necessary for each block if the desired blocks are located
on one cylinder
• One rotational delay is to be used in time evaluation if blocks are
contiguous
Physical Disk Structure
Examples - Exercises
• A. Double sided disk has on each side 44 Tracks, each track
has 64 blocks, and usable size of each block is 1024 bytes.
Find usable capacity of the disk
2*44*64*1024 = 5,767,168
• B. Disk pack consists of 15 disks with the above
parameters. Find full capacity of the disk pack and the
capacity of a cylinder
5,767,168 * 15 = 86,507,520 15*2*64*1024 = 1,966,080
• C. The size of gaps between blocks (interblock gap) are of
128 bytes. Assuming rotational speed 600 revs/min
calculate the time for the transfer of one block ( do not
include seek and latency).
64 *(1024+128) = 73728 600 r/min = 10 r/sec
10* 73,728 = 737,280 1024/737280 = 0.001388 sec
1.39 msec
Hardware parameters and access performance
• Access time = seek time + latency +
transfer time
• seek time + latency is much greater than
transfer time
• Hence
– Cache storage to capitalise on pages already
fetched
– Advantage of storing a file in clusters of
contiguous blocks
– Advantage of storing a file on one cylinder
Hardware parameters and access
performance
Time taken to accomplish a file read thus
depends on:
• whether the block with the desired record is
in cache;
• seek: number of tracks to traverse
• latency: disk revolution speed
• block transfer rate
• buffering
• file organisation