Presentation is loading. Please wait.

Presentation is loading. Please wait.

April 2002Information Systems Design John Ogden & John Wordsworth FOI: 1 Database Design File organisations and indexes John Wordsworth Department of Computer.

Similar presentations


Presentation on theme: "April 2002Information Systems Design John Ogden & John Wordsworth FOI: 1 Database Design File organisations and indexes John Wordsworth Department of Computer."— Presentation transcript:

1 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 1 Database Design File organisations and indexes John Wordsworth Department of Computer Science The University of Reading J.B.Wordsworth@rdg.ac.uk Room 129, Ext 6544

2 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 2 Lecture objectives Relate tables and their rows to file structures on secondary storage Review data organisations and access methods Introduce the different kinds of indexes supported by access methods

3 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 3 Tables and files Table: Lecturer StaffNoNamePhoneDept 012345Andrews6789AG File: Lecturer 012345Andrews6789AG025891Eaglefield7890CS103001Irwin8901CS156990Ogbourne6543AG 0 1 212121Unwin8765MU253825Yateley7654CS

4 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 4 Access methods Software provided by the operating system. Mediates between the programmer’s logical view of data and the operating systems view of the I/O hardware (disk architecture). The implementer of the DBMS works with the the file organisations provided by the operation system’s access methods.

5 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 5 A heap file 103001212121012345156990 Records stored in the order they are added to the file New records added at the end Deletions by marking the records Retrieval for update means a linear search of the file Needs reorganisation from time to time

6 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 6 An ordered file 103001212121012345156990 Records stored in the order of a key field (access method might leave gaps) New records added in place (some reorganisation) Deletions by marking the records (space can be reused) Retrieval for update can be done by binary search 025891253825

7 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 7 A hash file (1) 103001212121012345156990025891253825 Bucket 0 Bucket1 Bucket 2 Overflow

8 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 8 A hash file (2) The file space is organised into buckets When a record is to be added, the key is hashed to a bucket number When a bucket is full, the overflow area(s) have to be used To retrieve a record, hash the key and search the bucket Deletions by marking the records (space can be reused) A good hash algorithm produces a good spread of bucket numbers from the current and future keys

9 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 9 A sparse index 103001212121156990025891253825 Track 0 Track 1 KeyTrackKeyTrack 103001253825 KeyTrack 01 012345

10 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 10 A secondary index Track 0 Track 1 025891CS012345AG103001CS156900AG212212MU253825CS TKey AG0 R 1 TKey AG0 R 0 TKey CS1 R 0 TKey CS2 R 0 TKey CS2 R 1 TKey MU1 R 2

11 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 11 A multilevel index KeyTrack 2987650 KeyTrack 3001043 KeyTrack 4567894 KeyTrack 4987655 KeyTrack 1030010 KeyTrack 2538251 KeyTrack 2987652 index track 0 index track 1 KeyTrack 4987651

12 April 2002Information Systems Design John Ogden & John Wordsworth FOI: 12 Key points Database tables are stored in files on secondary storage The heap file, ordered file, and hashed file are common file organisations An access method is an operating system component that supports a file organisation The DBMS manages the data by using the access methods. Indexes are used with ordered files to improve access


Download ppt "April 2002Information Systems Design John Ogden & John Wordsworth FOI: 1 Database Design File organisations and indexes John Wordsworth Department of Computer."

Similar presentations


Ads by Google