-
Notifications
You must be signed in to change notification settings - Fork 317
Table Detailed Design
The positive row index is stored in memory by row, and the fixed-length field and variable-length field are stored in two memory blocks respectively. The overall structure is as follows
Name | length bit | negative length |
---|---|---|
INT | 32 | Yes |
LONG | 64 | Yes |
FLOAT | 32 | Yes |
DOUBLE | 64 | Yes |
STRING | 64+16+str_len | No |
The front row index uses a whole block of memory storage. When the program starts, it applies for memory according to max_size and doc_size. max_size is the maximum number of documents, doc_size is the doc size of a fixed-length field, doc uses row storage, and each doc has a fixed length, which can be directly retrieved according to docid doc, variable length string is stored in a separate space, doc stores the starting position and length of the string
Find the last big docid according to max_docid, max_docid*doc_size is the insertion position of the doc, insert the doc, max_docid plus 1
Calculate the memory offset according to docid*doc_size, fetch the doc, read the starting position and length of the variable length field in the doc, and read the content of the variable length field
Use mark deletion in the engine, no need to operate the front row