Analyze ClickHouse external dictionaries including configuration, memory usage, reload status, and performance. Use for dictionary issues and load failures.
Answers "are the dictionaries loaded, fresh, and worth the RAM they cost" from system.dictionaries, system.query_log, system.asynchronous_metrics and system.text_log.
Run altinity-expert-clickhouse-connection first if the connection mode, cluster and time window are not yet established.
checks.sql — 15 checks: dictionary inventory, health and load status, memory usage against server RAM, top dictionaries by memory, configuration and layout, staleness against lifetime_max, current failures, load errors in the log, lookup performance from query_log, hit and miss ratio, cache dictionary analysis, flat and hashed size check, source types, source connectivity for ClickHouse-sourced dictionaries and scheduled reload status. 1 of them needs system.text_log.reference.md — background (settings, sizing, anti-patterns); read only when you need to explain a recommendation.; and start with a -- @check <id> <title> header; keep the id with its result.-- @requires: skip the statement when the named table is missing, when keeper is required and the server has no Keeper/ZooKeeper, or when the version condition is not met. List skipped ids with the reason.{cluster} as written when a cluster macro exists; otherwise apply the connection skill's rewrite rule. Any other {placeholder} is a template variable: substitute a real value first or skip the statement.UNKNOWN_IDENTIFIER, run DESCRIBE TABLE system.<table> and drop the missing column.severity column is the verdict for that row. Copy it; do not re-grade.After a dictionary has been reloaded, or when one dictionary needs a closer look, read its load state directly. Substitute {dictionary_name} with the name from check dictionaries-02 or dictionaries-07.
SELECT
database,
name,
status,
loading_start_time,
last_successful_update_time,
loading_duration,
element_count,
formatReadableSize(bytes_allocated) AS memory,
last_exception
FROM clusterAllReplicas('{cluster}', system.dictionaries)
WHERE name = '{dictionary_name}';
FAILED or LOADING_FAILED with a non-empty last_exception is a source problem, not a ClickHouse problem. Quote the exception text; it names the failing host, table or credential. NOT_LOADED is normal when dictionaries_lazy_load is on and nothing has queried the dictionary yet.seconds_since_update greater than lifetime_max means a reload is overdue or silently failing. Greater than twice lifetime_max means the dictionary is serving stale data and reloads have been failing for a while; pair it with the load errors from dictionaries-08 to find out which.bytes_allocated / element_count above 1000 bytes per key is a wasteful layout. A flat layout over sparse or high integer keys allocates for the whole key range; switch to hashed or sparse_hashed. When the working set is a small slice of a very large source, a cache or ssd_cache layout is cheaper than holding it all.SYSTEM RELOAD DICTIONARY for one dictionary or SYSTEM RELOAD DICTIONARIES for all of them. Do not run either yourself: a reload of a large dictionary blocks lookups and re-reads the whole source, and reloading everything at once can spike memory on a busy server.max_server_memory_usage.check, severity, object, evidence, recommendation; one row per finding, Critical first. Evidence quotes the numbers from the result rows.altinity-expert-clickhouse-memoryaltinity-expert-clickhouse-logsdictGet lookups dominating query time → load skill altinity-expert-clickhouse-reportingaltinity-expert-clickhouse-replicationaltinity-expert-clickhouse-grantsaltinity-expert-clickhouse-overview