Skip to main content
Version: 0.3.1


TerrabaseDB supports the persistent storage of data, which is an inherently obvious need for any database. In this document we explore how persistence works.

How persistence works

As per the current design, TDB on startup will check if a data.bin file exists in the working directory. If it does, then the existing key/value pairs are restored, otherwise an empty HashMap<K, V> is loaded into memory. When the database shuts down, the keys are written to disk.


However, the current persistence strategy is not very efficient since it rewrites the entire in-memory table back onto disk, regardless of changes, that is, even if no changes are made, TDB still rewrites the same data to disk. This will change in the future with a better disk storage format.