134k views
4 votes
Why is a database not always stored sequentially on disk?

User Dialogik
by
8.1k points

1 Answer

3 votes

Final answer:

Databases may not be stored sequentially due to the inefficiency of shifting data when making updates, the disparate space needed when databases grow, and the use of indexing for optimization.

Step-by-step explanation:

A database is not always stored sequentially on a disk for several reasons. When databases are updated, rows may be deleted and new data has to be inserted. If databases were strictly sequential, every time a change was made, it would require shifting all subsequent data to maintain sequence, which would be highly inefficient. Moreover, as databases grow, the initial contiguous space allocated might not be enough, and additional space elsewhere on the disk may be used, causing further non-sequential storage. Also, modern databases often use indexing and other optimization techniques to improve data retrieval times, and these do not necessarily follow a sequential order. Fragmentation can also occur over time as data is added and removed, leading to non-sequential storage.

User Diogo Moreira
by
8.6k points