ClickHouse configuration

Configuring ClickHouse

If you don’t know about config.xml and users.xml files yet, see How to configure ClickHouse?ClickHouse configuration - 图1open in new window.

Server timezone

You can avoid a lot of confusion by configuringClickHouse configuration - 图2open in new window ClickHouse to use UTC timezoneClickHouse configuration - 图3open in new window by changing config.xml:

  1. <?xml version="1.0" ?>
  2. <clickhouse>
  3. <timezone>UTC</timezone>
  4. </clickhouse>

Compression

By default, ClickHouse uses LZ4 to compress data, but you can get a better compression ratio by using ZSTD. To use ZSTD-3, change ClickHouse config.xml:

  1. <?xml version="1.0" ?>
  2. <clickhouse>
  3. <compression incl="clickhouse_compression">
  4. <case>
  5. <min_part_size>104857600</min_part_size>
  6. <min_part_size_ratio>0.01</min_part_size_ratio>
  7. <method>zstd</method>
  8. <level>3</level>
  9. </case>
  10. </compression>
  11. </clickhouse>

prefer_column_name_to_alias

If you want to play with the queries generated by Uptrace, you should enable prefer_column_name_to_aliasClickHouse configuration - 图4open in new window setting in ClickHouse users.xml:

  1. <?xml version="1.0" ?>
  2. <clickhouse>
  3. <profiles>
  4. <default>
  5. <prefer_column_name_to_alias>1</prefer_column_name_to_alias>
  6. </default>
  7. </profiles>
  8. </clickhouse>