The present invention discloses a file data storage and reading method applied to
database storage, including file data storage, wherein the file data storage comprises: writing key-value data to a data area of a file, recording an offset and size S[offset+size] in the data area; calculating a hash value hash(key) of a key in the key-value data, and updating a bit value of the hashID position corresponding to the hash value hash(key) in a
bitmap; the hashID, key, and S[offset+size] are used as a hash index
record when writing key-value data, and the hash index
record is written in a file. The file data storage and reading method applied to
database storage of the present invention adopts a new
file format through a hash index when performing data storage, and the
time complexity can reach O(1) when performing key value retrieval, which greatly improves the retrieval efficiency of key-value data.