A unordered file, sometimes called a heap file, is the simplest type of file organization.
Records are placed in the file in the same order as they are inserted. A new
record is inserted in the last page of the file; if there is insufficient space in the last
page, a new page is added to the file. This process makes insertion very efficient.
However, as a heap file has no particular ordering with respect to field values, a
linear search must be performed to access a record. A linear search involves reading
pages from the file until the required record is found. This makes retrievals
from heap files that have more than a few pages relatively slow, unless the retrieval
involves a large proportion of the records in the file.
To delete a record, the required page first has to be retrieved, the record
marked as deleted, and the page written back to disk. The space with deleted
records is not reused. Consequently, performance progressively deteriorates as
deletions occur. This means that heap files have to be periodically reorganized by
the DBA to reclaim the unused space of deleted records.
Heap files are one of the best organizations for bulk loading data into a table.
Because records are inserted at the end of the sequence, there is no overhead of
calculating what page the record should go on.