Skip to content

Storage structure

toxa108 edited this page Dec 18, 2019 · 11 revisions

How is the data stored in the database?

The each database has own directory according the name.

/ROOT_DIRECTORY/databaseone
/ROOT_DIRECTORY/databasetwo

In the database directory stores tables. Each table has own file with .ddd extension.

The table structure: The block size by default equals 16 KB.

First (BLOCK_SIZE * 1024) KB reserved for metadata. By default it is 16384.

For indexes metadata reserved 1024 bytes from ((BLOCK_SIZE - 2) * 1024; (BLOCK_SIZE - 1) * 1024]
For fields metadata reserved 1024 bytes from ((BLOCK_SIZE - 1) * 1024; (BLOCK_SIZE * 1024)]

Index metadata block:



For example the seek for index metadata is 0 bytes.
Number of indexes = 2, pos = 0, size = 4 byte
Seek of index 1 = 12, pos = 4 byte, size = 4 byte
Seek of index 2 = 20, pos = 8 byte, size = 4 byte
Size of 1 index = 1, pos = 12 byte, size = 4 byte
Type of 1 index = 1, pos = 16 byte, size = 2 byte
Filed names for 1 index = "id", pos = 18 byte, size = 2 byte
Size of 2 index = 1, pos = 20 byte, size = 4 byte
Type of 2 index = 1, pos = 24 byte, size = 2 byte
Filed names for 2 index = "id%name%", pos = 26 byte, size = 7 byte

Clone this wiki locally