Chapter 3: Storage and Retrieval

Storage and Retrieval #

Data Structures that power your DB #

log -> In DB context, refers to “an append only sequence of records”.

Many DBs use a log to store data (but need additional processing e.g. concurrency control, reclaiming disk space, handling errors etc)

Writing data in a log is fast since it only appends to the end of the file but reading can be slow since it requires scanning the entire file, and hence DBs need an index.

An index slows down writes because it needs to be updated every time the data changes, so not everything is indexed by default and needs intuition by the developer to choose the right indexes.

Hash Indexes #