2.4 Organisation and Structure of Data Flashcards
What is a serial file?
File where records are not stored in any particular order, they are just stored in the order they occur.
How do you add to a serial file?
A new record is just added to the end of the file.
What is a sequential file?
File where records are stored and accessed in file sequence order e.g. sorted by a primary key.
How do you add to a sequential file?
Make a new copy of the records until the correct place to add the new record is reached.
Add the new record to the new copy and continue until the end of the file is reached.
If multiple records are to be added, they should be sorted before so there isn’t multiple updates to the file.
How do you delete records from a sequential file?
Make a new copy of all the records until the record to be deleted is reach.
Do not make a copy of the record to be deleted.
Continue until the end of the file is reached.
If multiple records are to be deleted, they must be sorted in advance.
What are random files?
File where records are stored at an address based on the Key Field.
This allows individual records to be accessed without loading the entire file.
How can data collisions occur in random files?
When two data items are hashed to the same location.
The latest data must then be stored in an overflow area.
If there are too many data items in the overflow area, access becomes slow.
To fix this, a new hashing algorithm may be required or a larger file may be needed.
What is an indexed sequential file?
File structure where records are stored in key sequence order but there is also an index which allows data to be accessed directly.
(Benefits of sequential and random file access, stored on random access media)
What is an index in an indexed sequential file?
Stored at the start of the file and given the highest key stored in each ‘block’ of the file.
When a key is searched for, the index will indicate which block the file is stored in.
What is a Multi-Level index?
An index which is too large so it is split into smaller indexes.
The index at the start to the file would point to other smaller indexes instead of the data.
How do you add records to an indexed sequential file?
Place in a block.
If block is full, use overflow area.
Access may become slower as more records are in this area, re-organisation may become necessary.
How do you delete records from an indexed sequential file?
Record to be deleted is marked as deleted in the index but not physically removed.
What is a hashing algorithm?
Takes the key field and performs a calculation to return a disc address.
What happens when the hashing algorithm allocates a record an address to a block that is already full?
The computer will store the record in an overflow area whilst also leaving a pointer at the original block to indicate where the record is now stored.
What is the difference between a record and a file?
A record is a collection of items all relating to an object and a file is an organisation of these records.