Skip to content

Low level DocDB key encoding format

Mikhail Bautin edited this page Sep 6, 2019 · 5 revisions

This document describes the low-level format of key encoding in DocDB. By "key encoding" we mean the way we turn logical keys to sequences of bytes that are used as keys in RocksDB. An encoded key could include primary key columns (hash-based and range-based), the computed hash value for hash-based columns, and an internal column id.

Value types

The "value type" is an enum that defines the types of individual components of an encoded key (primary key. It is defined in value_type.h.

Primitive values

A primitive value (primitive_value.h) represents a single component of a primary key or a number of other simple data types that could be used during key encoding., which could be e.g. integer, a string, an internal 16-bit hash value, a UUID, etc.

DocKey vs SubDocKey

A DocKey corresponds to the primary key in a SQL table, including some internal information such as the computed hash value corresponding to the hash-based components of that primary key. Also, if the schema of a certain table has range components, e.g. (h1, h2, r1, r2), then prefixes obtained by trimming the list of range components could logically be considered valid DocKeys as well -- in this example (h1, h2) and (h1, h2, r1).

Clone this wiki locally