Notes on how a multi-table SQL database is mapped into the storage engine. We assume the storage engine supports key/value pairs where each key and value is arbitrary binary data. Keys are in lexicographical order. In other words, keys compare according to memcmp() and if one key is a prefix of the other, the shorter key comes first. A sample key comparison function is the following: int key_compare(const void *key1, int n1, const void *key2, int n2){ int c = memcmp(key1, key2, n1