Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 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
  • Pricing policy
  • 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 settings of an existing MergeTree table
  • Resetting a MergeTree table setting to default
  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 December 17, 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 settings of an existing MergeTree table
    • Resetting a MergeTree table setting to default

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

  • Using the Yandex Cloud interfaces. This way you can only specify 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 interfacesSpecifying ClickHouse® settings using the Yandex Cloud interfaces

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

Note

You cannot directly change 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 change this setting, you need to change the ClickHouse® host class first. For more information, see Memory management.

Management console
CLI
Terraform
REST API
gRPC API

To configure ClickHouse®:

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

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To configure ClickHouse®:

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

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

    yc managed-clickhouse cluster update-config --help
    
  3. Provide the arguments as needed:

    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 describing your infrastructure.

    For information on how to create such a file, see Creating a cluster.

  2. In the Managed Service for ClickHouse® cluster description, under clickhouse.config, edit the parameters as follows:

    resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
      ...
      clickhouse {
        ...
    
        config {
          # General DBMS settings
          ...
    
          merge_tree {
            # MergeTree engine settings
            ...
          }
    
          kafka {
            # General settings for getting 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 data thinning, aggregation, and rollup in Graphite.
            ...
          }
        }
        ...
      }
      ...
    }
    

    Where:

    • method: Compression method, LZ4 or ZSTD.
    • min_part_size: Minimum size of a table data part, in bytes.
    • min_part_size_ratio: Ratio of the smallest data part size to the full table size.
  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 this Terraform provider guide.

Timeouts

The Terraform provider sets the following timeouts for Managed Service for ClickHouse® cluster operations:

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

Operations exceeding the timeout are aborted.

How do I change these limits?

Add a timeouts section to the cluster description, e.g.:

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 an environment variable:

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

    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: Comma-separated list of settings you want to update.
    • configSpec.clickhouse.config: ClickHouse® server-level settings. For the list of possible parameters and their values, see the method description.

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

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

  1. Get an IAM token for API authentication and put it into an 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. Call the ClusterService.Update method, e.g., via the following gRPCurl request:

    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 settings you want to update as an array of strings (paths[]).
    • config_spec.clickhouse.config: ClickHouse® server-level settings. For the list of possible parameters and their values, see the method description.

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

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

Checking MergeTree table settingsChecking 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 output.

Specifying settings for MergeTree tables using SQL queriesSpecifying settings for MergeTree tables using SQL queries

Changing settings when creating a MergeTree tableChanging settings when creating a MergeTree table

SQL
  1. Connect to the database in the cluster.

  2. Create a table. To configure it, list its settings under SETTINGS, 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>;
    

    Here is an example of the 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 this ClickHouse® guide.

Changing settings of an existing MergeTree tableChanging 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 with a single query. To do this, list <setting_name> = <new_setting_value> pairs separated by commas.

Resetting a MergeTree table setting to defaultResetting a MergeTree table setting to default

SQL
  1. Connect to the database in the cluster.

  2. To reset a setting of an existing table to its default, run this query:

    ALTER TABLE <table_name> RESET SETTING <setting_name>;
    

    You can reset multiple settings to default with 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.