Skip to main content
These settings configure the ClickHouse server and are autogenerated from ClickHouse source.

query_cache

Query cache configuration. The following settings are available:
  • Changed settings take effect immediately.
  • Data for the query cache is allocated in DRAM. If memory is scarce, make sure to set a small value for max_size_in_bytes or disable the query cache altogether.
Example

query_log

Setting for logging queries received with the log_queries=1 setting. Queries are logged in the system.query_log table, not in a separate file. You can change the name of the table in the table parameter (see below). The following settings can be configured by sub-tags: Additionally, the following server-level setting controls the default flush policy for all system log tables:
The enable_user_query_log parameter (enabled by default) creates system.user_query_log, which shows every user their own records of the configured query log table without requiring access to the table itself. This only works when the query log is stored locally: if engine delegates to another server (for example, Distributed), disable enable_user_query_log, since system.user_query_log cannot enforce the per-user access check across a ClickHouse-protocol server boundary and refuses to read from such a backend. If the table does not exist, ClickHouse will create it. If the structure of the query log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically. Example

query_masking_rules

Regexp-based rules, which will be applied to queries as well as all log messages before storing them in server logs, system.query_log, system.text_log, system.processes tables, and in logs sent to the client. That allows preventing sensitive data leakage from SQL queries such as names, emails, personal identifiers or credit card numbers to logs. Example
Config fields: The masking rules are applied to the whole query (to prevent leaks of sensitive data from malformed / non-parseable queries). The system.events table has counter QueryMaskingRulesMatch which has an overall number of query masking rules matches. For distributed queries each server has to be configured separately, otherwise, subqueries passed to other nodes will be stored without masking.

query_metric_log

It is disabled by default. Enabling To manually turn on metrics history collection system.query_metric_log, create /etc/clickhouse-server/config.d/query_metric_log.xml with the following content:
Disabling To disable query_metric_log setting, you should create the following file /etc/clickhouse-server/config.d/disable_query_metric_log.xml with the following content:
The following settings can be configured by sub-tags: Additionally, the following server-level setting controls the default flush policy for all system log tables:

query_thread_log

Setting for logging threads of queries received with the log_query_threads=1 setting. Queries are logged in the system.query_thread_log table, not in a separate file. You can change the name of the table in the table parameter (see below). The following settings can be configured by sub-tags: Additionally, the following server-level setting controls the default flush policy for all system log tables:
If the table does not exist, ClickHouse will create it. If the structure of the query thread log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically. Example

query_views_log

Setting for logging views (live, materialized etc) dependant of queries received with the log_query_views=1 setting. Queries are logged in the system.query_views_log table, not in a separate file. You can change the name of the table in the table parameter (see below). The following settings can be configured by sub-tags: Additionally, the following server-level setting controls the default flush policy for all system log tables:
If the table does not exist, ClickHouse will create it. If the structure of the query views log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically. Example
Last modified on August 3, 2026