Skip to main content
Skip to main content

flat dictionary layout

With the flat layout, the dictionary is completely stored in memory in the form of flat arrays. The amount of memory used is proportional to the size of the largest key (in space used).

Tip

This layout type provides the best performance among all available methods of storing a dictionary.

The dictionary key has the UInt64 type and the value is limited to max_array_size (by default — 500,000). If a larger key is discovered when creating the dictionary, ClickHouse throws an exception and does not create the dictionary. The initial size of dictionary flat arrays are controlled by the initial_array_size setting (by default — 1024).

All types of sources are supported. When updating the dictionary, data (from a file or from a table) is read in its entirety.

Configuration example:

LAYOUT(FLAT(INITIAL_ARRAY_SIZE 50000 MAX_ARRAY_SIZE 5000000))