15
11.1 Database System Concepts

11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

Embed Size (px)

Citation preview

Page 1: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.1Database System Concepts

Page 2: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.2Database System Concepts

Now Something DifferentNow Something Different

1st part of the course: Application Oriented

2nd part of the course: Systems Oriented

What is “Systems”?

A: Not Programming Not programming big things..

Systems = Efficient and safe use of limited resources (e.g., disks)

Efficient: resources should be shared, utilized as much as possible

Safe: sharing should not corrupt work of individual jobs

Page 3: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.3Database System Concepts

General OverviewGeneral Overview

Relational model - SQL Formal & commercial query languages

Functional Dependencies Normalization

Physical Design Indexing Query evaluation Query optimization ….

ApplicationOriented

Systems Oriented

Page 4: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.4Database System Concepts

The systems side of DatabasesThe systems side of Databases

What will we talk about?

1. Data Organization: physical storage strategies to support efficient updates, retrieval

2. Data retrieval: auxiliary data structures to enable efficient retrieval. Techniques for processing queries to ensure efficient retrieval

3. Data Integrity: techniques for implementing Xactions, to ensure safe concurrent access to data. Ensuring data is safe in the presence of system crashes.

Page 5: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.5Database System Concepts

Data OrganizationData Organization

Key points

1. Storage Media “Memory hierarchy” Efficient/reliable transfer of data between disks and main memory Hardware techniques (RAID disks)

Software techniques (Buffer mgmt)

2. Storage strategies for relations-file organization Representation of tuples on disks

Storage of tuples in pages, clustering.

Page 6: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.6Database System Concepts

CPU

M C

TypicalComputer

SecondaryStorage

......

Page 7: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.7Database System Concepts

Storage Media: PlayersStorage Media: Players

Cache – fastest and most costly form of storage; volatile; managed by the computer system hardware.

Main memory: fast access (10s to 100s of nanoseconds; 1 nanosecond = 10–9 seconds)

generally too small (or too expensive) to store the entire database

Volatile — contents of main memory are usually lost if a power failure or system crash occurs.

But… CPU operates only on data in main memory

Page 8: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.8Database System Concepts

Storage Media: PlayersStorage Media: Players

Disk Primary medium for the long-term storage of data; typically stores entire database.

random-access – possible to read data on disk in any order, unlike magnetic tape

Non-volatile: data survive a power failure or a system crash, disk failure less likely than them

New technology: Solid State Disks and Flash disks

Page 9: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.9Database System Concepts

Storage Media: PlayersStorage Media: Players Optical storage

non-volatile, data is read optically from a spinning disk using a laser

CD-ROM (640 MB) and DVD (4.7 to 17 GB) most popular forms

Write-one, read-many (WORM) optical disks used for archival storage (CD-R and DVD-R)

Multiple write versions also available (CD-RW, DVD-RW, and DVD-RAM)

Reads and writes are slower than with magnetic disk

Tapes Sequential access (very slow) Cheap, high capacity

Page 10: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.10Database System Concepts

Memory HierarchyMemory Hierarchycache

Main memory

disk

Optical storage

Tapes

Higher speed

Lower price

Traveling the hierarchy:1. speed ( higher=faster)2. cost (lower=cheaper)3. volatility (between MM and Disk)4. Data transfer (Main memory the “hub”)5. Storage classes (P=primary, S=secondary,T=tertiary)

V

NV

Page 11: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.11Database System Concepts

Main memory Main memory Disk Data Xfers Disk Data Xfers

Concerns:1. Efficiency (speed)

can be improved by...

a. improving raw data transfer speed

b. avoiding untimely data transfer

c. avoiding unnecessary data transfer

2. Safety (reliability, availability)

can be improved by...

a. storing data redundantly

Page 12: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.12Database System Concepts

Hard Disk MechanismHard Disk Mechanism

Page 13: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.13Database System Concepts

Read-write head Positioned very close to the

platter surface (almost touching it)

Surface of platter divided into circular tracks

Each track is divided into sectors. A sector is the smallest unit

of data that can be read or written.

To read/write a sector disk arm swings to position

head on right track platter spins continually;

data is read/written as sector passes under head

Block: a sequence of sectors Cylinder i consists of ith

track of all the platters

Page 14: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.14Database System Concepts

“Typical” ValuesDiameter: 1 inch 15 inchesCylinders: 100 2000Surfaces: 1 or 2(Tracks/cyl) 2 (floppies) 30Sector Size: 512B 50KCapacity: 360 KB (old floppy)

1.5 TB

Page 15: 11.1Database System Concepts. 11.2Database System Concepts Now Something Different 1st part of the course: Application Oriented 2nd part of the course:

11.15Database System Concepts

Performance Measures of DisksPerformance Measures of DisksMeasuring Disk Speed

Access time – consists of: Seek time – time it takes to reposition the arm over

the correct track.

(Rotational) latency time – time it takes for the sector to be accessed to appear under the head.

Data-transfer rate – the rate at which data can be retrieved from or stored to the disk.

Analogy to taking a bus:

1. Seek time: time to get to bus stop

2. Latency time; time spent waiting at bus stop

3. Data transfer time: time spent riding the bus