Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for ClickHouse®
  • Getting started
    • All guides
      • Information about existing clusters
      • Creating a cluster
      • Updating cluster settings
        • Server level
        • Query level
      • ClickHouse® version upgrade
      • Stopping and starting a cluster
      • Managing backups
      • Deleting a cluster
  • Access management
  • Terraform reference
  • Yandex Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Specifying ClickHouse® settings using the Yandex Cloud interfaces
  • Checking MergeTree table settings
  • Specifying settings for MergeTree tables using SQL queries
  • Changing settings when creating a MergeTree table
  • Changing the settings of an existing MergeTree table
  • Restoring the default settings of a MergeTree table
  1. Step-by-step guides
  2. Clusters
  3. Editing ClickHouse® settings
  4. Server level

Changing ClickHouse® settings at the server level

Written by
Yandex Cloud
Updated at May 13, 2025
  • Specifying ClickHouse® settings using the Yandex Cloud interfaces
  • Checking MergeTree table settings
  • Specifying settings for MergeTree tables using SQL queries
    • Changing settings when creating a MergeTree table
    • Changing the settings of an existing MergeTree table
    • Restoring the default settings of a MergeTree table

You can specify ClickHouse® settings at the server level to configure the way the databases or individual tables work in a Managed Service for ClickHouse® cluster. You can specify settings in several ways:

  • Using the Yandex Cloud interfaces. This way you can specify only the ClickHouse® settings available in Yandex Cloud.

  • Using SQL queries. This way you can specify settings for MergeTree tables. You can:

    • Specify the settings when creating a table.
    • Specify the settings of an existing table.
    • Restore the default settings of an existing table.

Specifying ClickHouse® settings using the Yandex Cloud interfaces

Changing some server settings will restart ClickHouse® servers on the cluster hosts.

Note

You cannot directly update the Max server memory usage value. Managed Service for ClickHouse® sets this value automatically depending on the amount of RAM available to ClickHouse® hosts. To edit this setting, you first need to change the ClickHouse® host class. For more information, see Memory management.

Management console
CLI
Terraform
REST API
gRPC API

To configure ClickHouse®:

  1. In the management console, navigate to the folder page and select Managed Service for ClickHouse.
  2. Select the cluster and click Edit in the top panel.
  3. Under DBMS settings, click Settings.
  4. Specify the ClickHouse® settings.
  5. Click Save changes.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To configure ClickHouse®:

  1. View the full list of settings specified for the cluster:

    yc managed-clickhouse cluster get <cluster_name_or_ID> --full
    
  2. View the description of the CLI command to update the cluster configuration:

    yc managed-clickhouse cluster update-config --help
    
  3. Set the required parameter values:

    yc managed-clickhouse cluster update-config <cluster_name_or_ID> \
       --set <parameter_1_name>=<value_1>,...
    

To configure ClickHouse®:

  1. Open the current Terraform configuration file that defines your infrastructure.

    For more information about creating this file, see Creating clusters.

  2. In the Managed Service for ClickHouse® cluster description, under clickhouse.config, change the values of the following parameters:

    resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
      ...
      clickhouse {
        ...
    
        config {
          # General DBMS settings
          ...
    
          merge_tree {
            # MergeTree engine settings
            ...
          }
    
          kafka {
            # General settings to get data from Apache Kafka
            ...
          }
    
          kafka_topic {
            # Settings for an individual Apache Kafka topic
            ...
          }
    
          rabbit_mq {
            # Settings for getting data from RabbitMQ
            username = "<username>"
            password = "<password>"
          }
    
          compression {
            # Data compression settings
            method              = "<compression_method>"
            min_part_size       = <data_part_size>
            min_part_size_ratio = <size_ratio>
          }
    
          graphite_rollup {
            # GraphiteMergeTree engine settings for thinning, aggregating, and averaging (rollup) Graphite data.
            ...
          }
        }
        ...
      }
      ...
    }
    

    Where:

    • method: Compression method, LZ4 or ZSTD.
    • min_part_size: Minimum size of a table data part, bytes.
    • min_part_size_ratio: Smallest table data part to the full table size ratio.
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for ClickHouse® cluster operations:

  • Creating a cluster, including by restoring one from a backup: 60 minutes.
  • Editing a cluster: 90 minutes.
  • Deleting a cluster: 30 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.Update method and send the following request, e.g., via cURL:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
       --request PATCH \
       --header "Authorization: Bearer $IAM_TOKEN" \
       --header "Content-Type: application/json" \
       --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>' \
       --data '{
                  "updateMask": "configSpec.clickhouse.config.<setting_1>,...,configSpec.clickhouse.config.<setting_N>",
                  "configSpec": {
                     "clickhouse": {
                        "config": {
                           "<setting_1>": "<value_1>",
                           "<setting_2>": "<value_2>",
                           ...
                           "<setting_N>": "<value_N>"
                        }
                     }
                  }
               }'
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.
    • configSpec.clickhouse.config: ClickHouse® server-level settings. For the list of possible parameters and their values, see the method description.

    You can request the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.Update call and send the following request, e.g., via gRPCurl:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
       -format json \
       -import-path ~/cloudapi/ \
       -import-path ~/cloudapi/third_party/googleapis/ \
       -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/cluster_service.proto \
       -rpc-header "Authorization: Bearer $IAM_TOKEN" \
       -d '{
              "cluster_id": "<cluster_ID>",
              "update_mask": {
                 "paths": [
                    "configSpec.clickhouse.config.<setting_1>",
                    "configSpec.clickhouse.config.<setting_2>",
                    ...
                    "configSpec.clickhouse.config.<setting_N>"
                 ]
              },
              "config_spec": {
                 "clickhouse": {
                    "config": {
                       "<setting_1>": "<value_1>",
                       "<setting_2>": "<value_2>",
                       ...
                       "<setting_N>": "<value_N>"
                    }
                 }
              }
           }' \
       mdb.api.cloud.yandex.net:443 \
       yandex.cloud.mdb.clickhouse.v1.ClusterService.Update
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.
    • config_spec.clickhouse.config: ClickHouse® server-level settings. For the list of possible parameters and their values, see the method description.

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

Checking MergeTree table settings

SQL
  1. Connect to the database in the cluster.

  2. To view all table-level settings, run the following query:

    SHOW CREATE TABLE <table_name>;
    

    Warning

    The SHOW CREATE TABLE output only includes settings overridden by the user. If a user-defined value matches the default value, this setting is also displayed in the output.

Specifying settings for MergeTree tables using SQL queries

Changing settings when creating a MergeTree table

SQL
  1. Connect to the database in the cluster.

  2. Create a table. To specify its settings, list them in the SETTINGS parameter, separated by commas:

    CREATE TABLE <table_name>
       (
       <table_column_description>
       )
       ENGINE = MergeTree
       PRIMARY KEY (<column_or_group_of_columns>)
       SETTINGS
       <setting_name> = <setting_value>,
       <setting_name> = <setting_value>;
    

    Example query for the merge_with_ttl_timeout and merge_with_recompression_ttl_timeout settings:

    CREATE TABLE <table_name>
       (
       user_id UInt32,
       message String,
       )
       ENGINE = MergeTree
       PRIMARY KEY (user_id)
       SETTINGS merge_with_ttl_timeout = 15000,
       merge_with_recompression_ttl_timeout = 15000;
    

For more information about creating MergeTree tables, see the ClickHouse® documentation.

Changing the settings of an existing MergeTree table

SQL
  1. Connect to the database in the cluster.

  2. To change the settings for an existing table, run the following query:

    ALTER TABLE <table_name> MODIFY SETTING <setting_name> = <new_setting_value>;
    

    You can change multiple settings in a single query. To do this, list the <setting_name> = <new_setting_value> pairs separated by commas.

Restoring the default settings of a MergeTree table

SQL
  1. Connect to the database in the cluster.

  2. To restore a default setting value of an existing table, run the following query:

    ALTER TABLE <table_name> RESET SETTING <setting_name>;
    

    You can restore multiple default settings in a single query. To do this, list the names of the settings separated by commas.

ClickHouse® is a registered trademark of ClickHouse, Inc.

Was the article helpful?

Previous
Updating cluster settings
Next
Query level
© 2025 Direct Cursus Technology L.L.C.