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

后端 未结 5 1854
感动是毒
感动是毒 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:51

    Best might be to use a commercial database engine.

    You might get rid of any O(log m) lookup of a B-tree by storing the index, i.e. the {"logical ID" maps to "physical location"} value pairs, in a hash map (hashing on the logical ID) ... or, even, storing the index in a contiguous vector (with the logical ID used as an index into the vector of offset values), as bdonlan suggested, if the ID values aren't sparse.

    An impotant implementation detail might be what the API you use to access the index: whether you store it in RAM (which the O/S backs with the system page file) and access it in-process using pointers, and/or store it on disk (which the O/S caches in the file system cache) and access it using file I/O APIs.

提交回复
热议问题