1、Database Systems(資料庫系統 ) November 7, 2005Lecture #7By Hao-hua Chu (朱浩華 )1Announcement Assignment #2 solution will be posted on the course homepage. Assignment #3 is due on Thur (11/10) outside TAs office. Do not accept late assignments. Assignment solution will be posted on the course homepage on Fr
2、iday (11/11). Practicum assignment #1 is available on course homepage. Midterm next Monday Chapters 1,2 (except 2.7),3, 4.14.2, 5,8,92Storing Data: Disks and FilesChapter 93Disks and Files DBMS stores information on (“hard”) disks. This has major performance implications for DB system design! READ:
3、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!4Why Not Store Everything in Main Memory? Costs too much. $100 for 1G of SDRAM $100 for 250 GB of HD (cost x250) $40 for
4、50 GB of tapes. (cost same as HD) - “Is Tape for backup dead?” Main memory is volatile. We want data to be saved between runs. Typical storage hierarchy: Main memory (RAM) for currently used data. Disk for the main database (secondary storage). Tapes for archiving older versions of the data (backup
5、storage) or just disk-to-disk backup.5Disks Secondary storage device of choice. Main advantage over tapes: random access vs. sequential. Tapes are for data backup, not for operational data. Access the last byte in a tape requires winding through the entire tape. Data is stored and retrieved in units
6、 called disk blocks or pages. Unlike RAM, time to retrieve a disk page varies depending upon location on disk. Therefore, relative placement of pages on disk has major impact on DBMS performance!6Components of a Disk The platters spin. The arm assembly is moved in or out to position a head on a desi
7、red track. Tracks under heads make a cylinder. Only one head reads/writes at any one time. Block size is a multiple of sector size (which is fixed).PlattersSpindleDisk headArm movementArm assemblyTracksSector78Accessing a Disk Page Time to access (read/write) a disk block, called access time, is a s
8、um of: seek time (moving arm to position disk head on right track) rotational delay (waiting for block to rotate under head) transfer time (actually moving data to/from disk surface) Seek time and rotational delay (mechanical parts) dominate the access time Seek time varies from about 1 to 20msec (avg 10msec) Rotational delay varies from 0 to 8msec (avg. 4msec) Transfer rate is about 100MBps (0.025msec per 4KB page) Key to lower I/O cost: reduce seek/rotation delays! If two pages of records are accessed together frequently, put them close together on disk. 910