download

Matakuliah : M0264/Manajemen Basis Data
Tahun
: 2008
Manajemen Basis Data
Pertemuan 2
Objectives
• Disks
• Files
Bina Nusantara
Disks And Files
• DBMS stores information on (“hard”) disks.
• This has major implications for DBMS design!
–
–
–
Bina Nusantara
READ: transfer data from disk to main memory (RAM).
WRITE: transfer data from RAM to disk.
Both are high-cost operations, relative to in-memory operations,
so must be planned carefully.
Disks
• Secondary storage device of choice.
• Main advantage over tapes: random access vs.
sequential.
• Data is stored and retrieved in units called disk blocks or
pages.
• Unlike RAM, time to retrieve a disk page varies
depending upon location on disk.
–
Bina Nusantara
Therefore, relative placement of pages on disk has major impact
on DBMS performance!
Disks
• Components of a Disk
Bina Nusantara
Disks
• The most important external storage devices. They allow
us to retrieve any page at (more or less) fixed cost per
page. However, if we read several pages in the order
that they are stored physically, the cost can be much
less that the cost of reading the same pages in random
order
• Space on disk is managed by the disks space manager.
Bina Nusantara
Files
• The file of records is an important abstraction in a DBMS
and implemented by the files and access methods layer
of code.
• A file can be created, destroyed, and have records
inserted into and deleted from it.
• It also supports scans. A scan operation allows us to
step through all the records in the file one at the time.
• A relation is typically stored as a file of records
Bina Nusantara
Files
• The files layer stores the records in a file in a collection
of disk pages.
• It keeps track of pages allocated to each file and as
records are inserted into and deleted from the file, it also
tracks available space within pages allocated to the file.
Bina Nusantara
Files of Records
• Page or block is OK when doing I/O, but higher levels of
DBMS operate on records, and files of records.
• FILE: A collection of pages, each containing a collection
of records. Must support:
–
–
–
Bina Nusantara
insert/delete/modify record
read a particular record (specified using record id)
scan all records (possibly with some conditions on the records to
be retrieved)