Data structure/algorithm for variable length record storage and lookup on disk withsearch only on primary keys

后端 未结 5 1843
感动是毒
感动是毒 2021-02-10 01:05

I am looking for an algorithm / data structure that works well for large block based devices (eg a mechanical hard drive) which is optimised for insert, get, update and delete w

5条回答
  •  灰色年华
    2021-02-10 01:58

    If a database is to heavy weight for you, consider a key-value store.

    If you really what to implement it yourself, use a disk-based hash table or a B-tree. To avoid the problems with the variable-length values, store the values in an separate file and use the B-tree as index for the data file. Space-reclaimation after deletion of values will be tricky, but it is possible (e.g. by a bitset for freed space in the data file).

提交回复
热议问题