Project: ClickHouse (App Definition and Development / Database)
File: dictionaries.md

slug: /en/operations/system-tables/dictionaries Contains information about . Columns: `database` () Name of the database containing the dictionary created by DDL query. Empty string for other dictionaries. `name` () . `uuid` () Dictionary UUID. `status` () Dictionary status. Possible values: `NOT_LOADED` Dictionary was not loaded because it was not used. `LOADED` Dictionary loaded successfully. `FAILED` Unable to load the dictionary as a result of an error. `LOADING` Dictionary is loading now. `LOADEDANDRELOADING` Dictionary is loaded successfully, and is being reloaded right now (frequent reasons: query, timeout, dictionary config has changed). `FAILEDANDRELOADING` Could not load the dictionary as a result of an error and is loading now. `origin` () Path to the configuration file that describes the dictionary. `type` () Type of dictionary allocation. . `key.names` (()) Array of provided by the dictionary. `key.types` (()) Corresponding array of provided by the dictionary. `attribute.names` (()) Array of provided by the dictionary. `attribute.types` (()) Corresponding array of provided by the dictionary. `bytes_allocated` () Amount of RAM allocated for the dictionary. `query_count` () Number of queries since the dictionary was loaded or since the last successful reboot. `hit_rate` () For cache dictionaries, the percentage of uses for which the value was in the cache. `found_rate` () The percentage of uses for which the value was found. `element_count` () Number of items stored in the dictionary. `load_factor` () Percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). `source` () Text describing the for the dictionary. `lifetimemin` () Minimum of the dictionary in memory, after which ClickHouse tries to reload the dictionary (if `invalidatequery` is set, then only if it has changed). Set in seconds. `lifetimemax` () Maximum of the dictionary in memory, after which ClickHouse tries to reload the dictionary (if `invalidatequery` is set, then only if it has changed). Set in seconds. `loadingstarttime` () Start time for loading the dictionary. `lastsuccessfulupdate_time` () End time for loading or updating the dictionary. Helps to monitor some troubles with dictionary sources and investigate the causes. `loading_duration` () Duration of a dictionary loading. `last_exception` () Text of the error that occurs when creating or reloading the dictionary if the dictionary couldnt be created. `comment` () Text of the comment to dictionary. Example Configure the dictionary: ``` sql CREATE DICTIONARY dictionarywithcomment ( id UInt64, value String ) PRIMARY KEY id SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() TABLE 'source_table')) LAYOUT(FLAT()) LIFETIME(MIN 0 MAX 1000) COMMENT 'The temporary dictionary'; ``` Make sure that the dictionary is loaded. ``` sql SELECT * FROM system.dictionaries LIMIT 1 FORMAT Vertical; ``` ``` text Row 1: database: default name: dictionarywithcomment uuid: 4654d460-0d03-433a-8654-d4600d03d33a status: NOT_LOADED origin: 4654d460-0d03-433a-8654-d4600d03d33a type: key.names: ['id'] key.types: ['UInt64'] attribute.names: ['value'] attribute.types: ['String'] bytes_allocated: 0 query_count: 0 hit_rate: 0 found_rate: 0 element_count: 0 load_factor: 0 source: lifetime_min: 0 lifetime_max: 0 loadingstarttime: 1970-01-01 00:00:00 lastsuccessfulupdate_time: 1970-01-01 00:00:00 loading_duration: 0 last_exception: comment: The temporary dictionary ```