24
Database Systems Disk Management Concepts

Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information physical representation bigger databases, larger records,

Embed Size (px)

Citation preview

Page 1: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

Database Systems

Disk Management Concepts

Page 2: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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

Page 3: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

What role does the DBMS have?

1. QUERY PARSING, RELATIONAL OPERATORS

2. OPTIMISATION AND EXECUTION

3. FILES AND ACCESS METHODS

4. BUFFER MANAGEMENT

5. DISK SPACE MANAGEMENT

QUERY

Page 4: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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)

Page 5: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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.

Page 6: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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 ManagementPartitions available main memory into pages

Bring pages from disk to main memory

Uses routines in DSM

• Disk Space ManagementManagement of space on disk

Page 7: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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

Page 8: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

DBMS, STORAGE DEVICE PROPERTIES

Secondary Storage

• tape

• magnetic disk

• drum

• optical disk, CD-ROM,

• database-oriented hardware devices

• other

Page 9: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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

Page 10: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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

Page 11: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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

• Block• Seeking a track• Rotational delay

(latency)

Illustration – Disk, Track, Sector

Page 12: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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

• Block

• Seeking a track

• Rotational delay (latency)

• Block transfer

Illustration – Disk, Track, Sector …

Page 13: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

Illustration – Disk, Track, Sector …

• Disk pack

Page 14: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

Hardware parameters and access performance

• Disk OrganisationConceptual: Select Semester from Section …Logical: Read Byte I of Record n of File f

Physical: Read block m of track t of cylinder c of disk d and transfer to buffer b

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:

• Access time = seek time + latency + transfer time

seek time + latency is much greater than transfer time

Page 15: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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

Page 16: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

Physical Disk Structure

Page 17: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,
Page 18: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,
Page 19: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,
Page 20: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,
Page 21: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,
Page 22: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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/sec10* 73,728 = 737,280 1024/737280 = 0.001388 sec

1.39 msec

Page 23: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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

Page 24: Database Systems Disk Management Concepts. WHY DO DISKS NEED MANAGING? logical information  physical representation bigger databases, larger records,

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