Files on disk may be organised in a variety of ways. The organisation
used by a data file depends on the function of the file and how it is commonly processed.
| Sequential |
- Access is sequential - like magnetic tape.
- Sequential files are good for simple lists, and files used for auditing and logging
access and usage.
|
| Relative (or direct) |
- Where the record is identified by its position in the file and can be accessed either
sequentially or randomly. eg. 'get record number 4','get the first 10 records'
- Relative files are used where the record number can be the key and immediate access is
necessary.
|
| Random |
- In this case, the physical position of the file is calculated by an algorithm which uses
the digits in the record's key.
- Random files are used where the record number cannot be the key, but a calculation gives
a unique result for each key.
- Random (and Relative) are particularly good for quick and frequent look-up exercises eg
pricing of products.
|
| Indexed sequential |
- Where the file is created sequentially and an index containing a specified key and its
location is also maintained.Thereafter can be manipulated either sequentially or randomly,
according to the index. eg. 'amend customer number 374128', 'list out the people in dept
42'
- Index sequential is the most common, since it is easily implemented in Relational
databases, and is used because it offers efficient access for both sequentially and
relatively.
|