settings.md 50.3 KB
Newer Older
1 2 3 4 5
# Settings


## distributed_product_mode

I
Ivan Blinkov 已提交
6
Changes the behavior of [distributed subqueries](../../query_language/select.md).
7

8
ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table.
9 10 11 12

Restrictions:

- Only applied for IN and JOIN subqueries.
13
- Only if the FROM section uses a distributed table containing more than one shard.
14
- If the subquery concerns a distributed table containing more than one shard.
I
Ivan Blinkov 已提交
15
- Not used for a table-valued [remote](../../query_language/table_functions/remote.md) function.
16

17
Possible values:
18

19 20 21 22
- `deny` — Default value. Prohibits using these types of subqueries (returns the "Double-distributed in/JOIN subqueries is denied" exception).
- `local` — Replaces the database and table in the subquery with local ones for the destination server (shard), leaving the normal `IN`/`JOIN.`
- `global` — Replaces the `IN`/`JOIN` query with `GLOBAL IN`/`GLOBAL JOIN.`
- `allow` — Allows the use of these types of subqueries.
23

24 25
## enable_optimize_predicate_expression

26
Turns on predicate pushdown in `SELECT` queries.
27

28
Predicate pushdown may significantly reduce network traffic for distributed queries.
29 30 31

Possible values:

32 33
- 0 — Disabled.
- 1 — Enabled.
34

F
filimonov 已提交
35
Default value: 1.
36

S
Fixes  
Sergei Bocharov 已提交
37
Usage
38

39
Consider the following queries:
40 41 42 43

1. `SELECT count() FROM test_table WHERE date = '2018-10-10'`
2. `SELECT count() FROM (SELECT * FROM test_table) WHERE date = '2018-10-10'`

44
If `enable_optimize_predicate_expression = 1`, then the execution time of these queries is equal, because ClickHouse applies `WHERE` to the subquery when processing it.
45

46
If `enable_optimize_predicate_expression = 0`, then the execution time of the second query is much longer, because the `WHERE` clause applies to all the data after the subquery finishes.
47

48
## fallback_to_stale_replicas_for_distributed_queries {#settings-fallback_to_stale_replicas_for_distributed_queries}
49

S
Sergei Bocharov 已提交
50
Forces a query to an out-of-date replica if updated data is not available. See [Replication](../table_engines/replication.md).
51 52 53

ClickHouse selects the most relevant from the outdated replicas of the table.

54
Used when performing `SELECT` from a distributed table that points to replicated tables.
55 56 57

By default, 1 (enabled).

58
## force_index_by_date {#settings-force_index_by_date}
59 60 61 62 63

Disables query execution if the index can't be used by date.

Works with tables in the MergeTree family.

S
Sergei Bocharov 已提交
64
If `force_index_by_date=1`, ClickHouse checks whether the query has a date key condition that can be used for restricting data ranges. If there is no suitable condition, it throws an exception. However, it does not check whether the condition actually reduces the amount of data to read. For example, the condition `Date != ' 2000-01-01 '` is acceptable even when it matches all the data in the table (i.e., running the query requires a full scan). For more information about ranges of data in MergeTree tables, see [MergeTree](../table_engines/mergetree.md).
65 66 67 68 69 70 71 72


## force_primary_key

Disables query execution if indexing by the primary key is not possible.

Works with tables in the MergeTree family.

S
Sergei Bocharov 已提交
73
If `force_primary_key=1`, ClickHouse checks to see if the query has a primary key condition that can be used for restricting data ranges. If there is no suitable condition, it throws an exception. However, it does not check whether the condition actually reduces the amount of data to read. For more information about data ranges in MergeTree tables, see [MergeTree](../table_engines/mergetree.md).
74

A
Alexander Tokmakov 已提交
75 76
## format_schema

A
Alexander Tokmakov 已提交
77
This parameter is useful when you are using formats that require a schema definition, such as [Cap'n Proto](https://capnproto.org/) or [Protobuf](https://developers.google.com/protocol-buffers/). The value depends on the format.
78 79 80

## fsync_metadata

81
Enables or disables [fsync](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html) when writing `.sql` files. Enabled by default.
82

A
alexey-milovidov 已提交
83
It makes sense to disable it if the server has millions of tiny tables that are constantly being created and destroyed.
84

85 86
## enable_http_compression {#settings-enable_http_compression}

87
Enables or disables data compression in the response to an HTTP request.
88 89 90 91 92

For more information, read the [HTTP interface description](../../interfaces/http.md).

Possible values:

93 94
- 0 — Disabled.
- 1 — Enabled.
95 96 97 98 99

Default value: 0.

## http_zlib_compression_level {#settings-http_zlib_compression_level}

100
Sets the level of data compression in the response to an HTTP request if [enable_http_compression = 1](#settings-enable_http_compression).
101

102
Possible values: Numbers from 1 to 9.
103 104 105 106 107 108

Default value: 3.


## http_native_compression_disable_checksumming_on_decompress {#settings-http_native_compression_disable_checksumming_on_decompress}

109
Enables or disables checksum verification when decompressing the HTTP POST data from the client. Used only for ClickHouse native compression format (not used with `gzip` or `deflate`).
110 111 112 113 114

For more information, read the [HTTP interface description](../../interfaces/http.md).

Possible values:

115 116
- 0 — Disabled.
- 1 — Enabled.
117 118 119

Default value: 0.

120 121
## send_progress_in_http_headers {#settings-send_progress_in_http_headers}

122
Enables or disables `X-ClickHouse-Progress` HTTP response headers in `clickhouse-server` responses.
123 124 125 126 127 128 129 130 131 132

For more information, read the [HTTP interface description](../../interfaces/http.md).

Possible values:

- 0 — Disabled.
- 1 — Enabled.

Default value: 0.

133 134
## max_http_get_redirects {#setting-max_http_get_redirects}

135
Limits the maximum number of HTTP GET redirect hops for [URL](../table_engines/url.md)-engine tables. The setting applies to both types of tables: those created by the [CREATE TABLE](../../query_language/create/#create-table-query) query and by the [url](../../query_language/table_functions/url.md) table function.
136 137 138

Possible values:

139
- Any positive integer number of hops.
140
- 0 — No hops allowed.
141 142 143

Default value: 0.

A
Alexander Tokmakov 已提交
144
## input_format_allow_errors_num {#settings-input_format_allow_errors_num}
145 146 147 148 149

Sets the maximum number of acceptable errors when reading from text formats (CSV, TSV, etc.).

The default value is 0.

A
Alexander Tokmakov 已提交
150
Always pair it with `input_format_allow_errors_ratio`.
151 152 153

If an error occurred while reading rows but the error counter is still less than `input_format_allow_errors_num`, ClickHouse ignores the row and moves on to the next one.

A
Alexander Tokmakov 已提交
154
If both `input_format_allow_errors_num` and `input_format_allow_errors_ratio` are exceeded, ClickHouse throws an exception.
155

A
Alexander Tokmakov 已提交
156
## input_format_allow_errors_ratio {#settings-input_format_allow_errors_ratio}
157 158 159 160 161 162

Sets the maximum percentage of errors allowed when reading from text formats (CSV, TSV, etc.).
The percentage of errors is set as a floating-point number between 0 and 1.

The default value is 0.

A
Alexander Tokmakov 已提交
163
Always pair it with `input_format_allow_errors_num`.
164 165 166

If an error occurred while reading rows but the error counter is still less than `input_format_allow_errors_ratio`, ClickHouse ignores the row and moves on to the next one.

A
Alexander Tokmakov 已提交
167
If both `input_format_allow_errors_num` and `input_format_allow_errors_ratio` are exceeded, ClickHouse throws an exception.
168

169

170 171
## input_format_values_interpret_expressions {#settings-input_format_values_interpret_expressions}

172
Enables or disables the full SQL parser if the fast stream parser can't parse the data. This setting is used only for the [Values](../../interfaces/formats.md#data-format-values) format at the data insertion. For more information about syntax parsing, see the [Syntax](../../query_language/syntax.md) section.
173 174 175

Possible values:

176
- 0 — Disabled.
177 178 179

    In this case, you must provide formatted data. See the [Formats](../../interfaces/formats.md) section.

180
- 1 — Enabled.
181

182
    In this case, you can use an SQL expression as a value, but data insertion is much slower this way. If you insert only formatted data, then ClickHouse behaves as if the setting value is 0.
183 184 185

Default value: 1.

S
Fixes  
Sergei Bocharov 已提交
186
Example of Use
187

188
Insert the [DateTime](../../data_types/datetime.md) type value with the different settings.
189 190 191 192

```sql
SET input_format_values_interpret_expressions = 0;
INSERT INTO datetime_t VALUES (now())
193
```
S
Fixes  
Sergei Bocharov 已提交
194

195
```text
196 197 198 199 200 201 202
Exception on client:
Code: 27. DB::Exception: Cannot parse input: expected ) before: now()): (at row 1)
```

```sql
SET input_format_values_interpret_expressions = 1;
INSERT INTO datetime_t VALUES (now())
203
```
S
Fixes  
Sergei Bocharov 已提交
204

205
```text
206 207 208
Ok.
```

209
The last query is equivalent to the following:
210 211 212 213

```sql
SET input_format_values_interpret_expressions = 0;
INSERT INTO datetime_t SELECT now()
214
```
S
Fixes  
Sergei Bocharov 已提交
215

216
```text
217 218 219
Ok.
```

A
Alexander Tokmakov 已提交
220
## input_format_values_deduce_templates_of_expressions {#settings-input_format_values_deduce_templates_of_expressions}
S
Fixes  
Sergei Bocharov 已提交
221

A
Alexander Tokmakov 已提交
222
Enables or disables template deduction for an SQL expressions in [Values](../../interfaces/formats.md#data-format-values) format. It allows to parse and interpret expressions in `Values` much faster if expressions in consecutive rows have the same structure. ClickHouse will try to deduce template of an expression, parse the following rows using this template and evaluate the expression on batch of successfully parsed rows. For the following query:
S
Fixes  
Sergei Bocharov 已提交
223

A
Alexander Tokmakov 已提交
224 225
```sql
INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), (upper('Values')), ...
226
```
S
Fixes  
Sergei Bocharov 已提交
227 228 229 230

- if `input_format_values_interpret_expressions=1` and `format_values_deduce_templates_of_expressions=0` expressions will be interpreted separately for each row (this is very slow for large number of rows)
- if `input_format_values_interpret_expressions=0` and `format_values_deduce_templates_of_expressions=1` expressions in the first, second and third rows will be parsed using template `lower(String)` and interpreted together, expression is the forth row will be parsed with another template (`upper(String)`)
- if `input_format_values_interpret_expressions=1` and `format_values_deduce_templates_of_expressions=1` - the same as in previous case, but also allows fallback to interpreting expressions separately if it's not possible to deduce template.
231

A
Alexander Tokmakov 已提交
232
Enabled by default.
A
Alexander Tokmakov 已提交
233 234

## input_format_values_accurate_types_of_literals {#settings-input_format_values_accurate_types_of_literals}
S
Fixes  
Sergei Bocharov 已提交
235

A
Alexander Tokmakov 已提交
236
This setting is used only when `input_format_values_deduce_templates_of_expressions = 1`. It can happen, that expressions for some column have the same structure, but contain numeric literals of different types, e.g
A
Alexander Tokmakov 已提交
237 238 239 240 241
```sql
(..., abs(0), ...),             -- UInt64 literal
(..., abs(3.141592654), ...),   -- Float64 literal
(..., abs(-1), ...),            -- Int64 literal
```
S
Fixes  
Sergei Bocharov 已提交
242

243
When this setting is enabled, ClickHouse will check actual type of literal and will use expression template of the corresponding type. In some cases it may significantly slow down expression evaluation in `Values`.
A
Alexander Tokmakov 已提交
244 245 246
When disabled, ClickHouse may use more general type for some literals (e.g. `Float64` or `Int64` instead of `UInt64` for `42`), but it may cause overflow and precision issues.
Enabled by default.

247
## input_format_defaults_for_omitted_fields {#session_settings-input_format_defaults_for_omitted_fields}
248

249
When performing `INSERT` queries, replace omitted input column values with default values of the respective columns. This option only applies to [JSONEachRow](../../interfaces/formats.md#jsoneachrow), [CSV](../../interfaces/formats.md#csv) and [TabSeparated](../../interfaces/formats.md#tabseparated) formats.
250 251

!!! note "Note"
252
    When this option is enabled, extended table metadata are sent from server to client. It consumes additional computing resources on the server and can reduce performance.
253

254 255 256 257 258
Possible values:

- 0 — Disabled.
- 1 — Enabled.

259
Default value: 1.
260

A
fixes  
Alexander Tokmakov 已提交
261 262 263 264 265 266
## input_format_tsv_empty_as_default {#settings-input_format_tsv_empty_as_default}

When enabled, replace empty input fields in TSV with default values. For complex default expressions `input_format_defaults_for_omitted_fields` must be enabled too.

Disabled by default.

A
Alexander Tokmakov 已提交
267 268
## input_format_null_as_default {#settings-input_format_null_as_default}

269
Enables or disables using default values if input data contain `NULL`, but data type of corresponding column in not `Nullable(T)` (for text input formats).
A
Alexander Tokmakov 已提交
270

271 272 273

## input_format_skip_unknown_fields {#settings-input_format_skip_unknown_fields}

274
Enables or disables skipping insertion of extra data.
275 276 277

When writing data, ClickHouse throws an exception if input data contain columns that do not exist in the target table. If skipping is enabled, ClickHouse doesn't insert extra data and doesn't throw an exception.

278 279 280 281 282 283
Supported formats:

- [JSONEachRow](../../interfaces/formats.md#jsoneachrow)
- [CSVWithNames](../../interfaces/formats.md#csvwithnames)
- [TabSeparatedWithNames](../../interfaces/formats.md#tabseparatedwithnames)
- [TSKV](../../interfaces/formats.md#tskv)
284 285

Possible values:
286

287 288
- 0 — Disabled.
- 1 — Enabled.
289

290 291
Default value: 0.

292 293
## input_format_import_nested_json {#settings-input_format_import_nested_json}

294
Enables or disables the insertion of JSON data with nested objects.
295 296 297 298 299 300 301 302 303 304 305 306

Supported formats:

- [JSONEachRow](../../interfaces/formats.md#jsoneachrow)

Possible values:

- 0 — Disabled.
- 1 — Enabled.

Default value: 0.

S
Fixes  
Sergei Bocharov 已提交
307
See also:
308 309 310

- [Usage of Nested Structures](../../interfaces/formats.md#jsoneachrow-nested) with the `JSONEachRow` format.

311 312 313
## input_format_with_names_use_header {#settings-input_format_with_names_use_header}

Enables or disables checking the column order when inserting data.
B
BayoNet 已提交
314

315 316 317
To improve insert performance, we recommend disabling this check if you are sure that the column order of the input data is the same as in the target table.

Supported formats:
318

319 320
- [CSVWithNames](../../interfaces/formats.md#csvwithnames)
- [TabSeparatedWithNames](../../interfaces/formats.md#tabseparatedwithnames)
321 322 323 324 325 326 327

Possible values:

- 0 — Disabled.
- 1 — Enabled.

Default value: 1.
328

329 330
## date_time_input_format {#settings-date_time_input_format}

331
Allows to choose a parser of text representation of date and time.
332 333 334 335 336 337 338

The setting doesn't apply to [date and time functions](../../query_language/functions/date_time_functions.md).

Possible values:

- `'best_effort'` — Enables extended parsing.

339
    ClickHouse can parse the basic `YYYY-MM-DD HH:MM:SS` format and all [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time formats. For example, `'2018-06-08T01:02:03.000Z'`.
340 341 342

- `'basic'` — Use basic parser.

343 344 345
    ClickHouse can parse only the basic `YYYY-MM-DD HH:MM:SS` format. For example, `'2019-08-20 10:18:56'`.

Default value: `'basic'`.
346

S
Fixes  
Sergei Bocharov 已提交
347
See also:
348 349 350 351

- [DateTime data type.](../../data_types/datetime.md)
- [Functions for working with dates and times.](../../query_language/functions/date_time_functions.md)

352
## join_default_strictness {#settings-join_default_strictness}
B
BayoNet 已提交
353

354
Sets default strictness for [JOIN clauses](../../query_language/select.md#select-join).
B
BayoNet 已提交
355

356
Possible values:
B
BayoNet 已提交
357

358
- `ALL` — If the right table has several matching rows, ClickHouse creates a [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) from matching rows. This is the normal `JOIN` behavior from standard SQL.
B
BayoNet 已提交
359
- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of `ANY` and `ALL` are the same.
360
- `ASOF` — For joining sequences with an uncertain match.
361
- `Empty string` — If `ALL` or `ANY` is not specified in the query, ClickHouse throws an exception.
B
BayoNet 已提交
362

363
Default value: `ALL`.
B
BayoNet 已提交
364

365 366
## join_any_take_last_row {#settings-join_any_take_last_row}

B
BayoNet 已提交
367
Changes behavior of join operations with `ANY` strictness.
368

369 370
!!! warning "Attention"
    This setting applies only for `JOIN` operations with [Join](../table_engines/join.md) engine tables.
371 372 373

Possible values:

B
BayoNet 已提交
374 375
- 0 — If the right table has more than one matching row, only the first one found is joined.
- 1 — If the right table has more than one matching row, only the last one found is joined.
376

B
BayoNet 已提交
377
Default value: 0.
378

S
Fixes  
Sergei Bocharov 已提交
379
See also:
380 381 382 383

- [JOIN clause](../../query_language/select.md#select-join)
- [Join table engine](../table_engines/join.md)
- [join_default_strictness](#settings-join_default_strictness)
B
BayoNet 已提交
384

S
Fixes  
Sergei Bocharov 已提交
385
## join_use_nulls {#join_use_nulls}
386

387
Sets the type of [JOIN](../../query_language/select.md) behavior. When merging tables, empty cells may appear. ClickHouse fills them differently based on this setting.
388

389
Possible values:
390 391

- 0 — The empty cells are filled with the default value of the corresponding field type.
392
- 1 — `JOIN` behaves the same way as in standard SQL. The type of the corresponding field is converted to [Nullable](../../data_types/nullable.md#data_type-nullable), and empty cells are filled with [NULL](../../query_language/syntax.md).
393

394 395
Default value: 0.

396
## max_block_size {#setting-max_block_size}
397

398
In ClickHouse, data is processed by blocks (sets of column parts). The internal processing cycles for a single block are efficient enough, but there are noticeable expenditures on each block. The `max_block_size` setting is a recommendation for what size of block (in number of rows) to load from tables. The block size shouldn't be too small, so that the expenditures on each block are still noticeable, but not too large, so that the query with LIMIT that is completed after the first block is processed quickly. The goal is to avoid consuming too much memory when extracting a large number of columns in multiple threads, and to preserve at least some cache locality.
399

400
Default value: 65,536.
401 402 403 404 405 406 407

Blocks the size of `max_block_size` are not always loaded from the table. If it is obvious that less data needs to be retrieved, a smaller block is processed.

## preferred_block_size_bytes

Used for the same purpose as `max_block_size`, but it sets the recommended block size in bytes by adapting it to the number of rows in the block.
However, the block size cannot be more than `max_block_size` rows.
408
By default: 1,000,000. It only works when reading from MergeTree engines.
409

B
BayoNet 已提交
410 411
## merge_tree_min_rows_for_concurrent_read {#setting-merge_tree_min_rows_for_concurrent_read}

S
Sergei Bocharov 已提交
412
If the number of rows to be read from a file of a [MergeTree](../table_engines/mergetree.md) table exceeds `merge_tree_min_rows_for_concurrent_read` then ClickHouse tries to perform a concurrent reading from this file on several threads.
B
BayoNet 已提交
413

414
Possible values:
B
BayoNet 已提交
415

416 417 418 419 420 421
- Any positive integer.

Default value: 163840.

## merge_tree_min_bytes_for_concurrent_read {#setting-merge_tree_min_bytes_for_concurrent_read}

S
Sergei Bocharov 已提交
422
If the number of bytes to read from one file of a [MergeTree](../table_engines/mergetree.md)-engine table exceeds `merge_tree_min_bytes_for_concurrent_read`, then ClickHouse tries to concurrently read from this file in several threads.
423

424
Possible value:
425

S
Fixes  
Sergei Bocharov 已提交
426
- Any positive integer.
B
BayoNet 已提交
427

428
Default value: 251658240.
B
BayoNet 已提交
429 430 431

## merge_tree_min_rows_for_seek {#setting-merge_tree_min_rows_for_seek}

432
If the distance between two data blocks to be read in one file is less than `merge_tree_min_rows_for_seek` rows, then ClickHouse does not seek through the file, but reads the data sequentially.
B
BayoNet 已提交
433

434
Possible values:
B
BayoNet 已提交
435

436 437 438 439 440 441
- Any positive integer.

Default value: 0.

## merge_tree_min_bytes_for_seek {#setting-merge_tree_min_bytes_for_seek}

442
If the distance between two data blocks to be read in one file is less than `merge_tree_min_bytes_for_seek` bytes, then ClickHouse sequentially reads range of file that contains both blocks, thus avoiding extra seek.
443 444 445 446 447 448

Possible values:

- Any positive integer.

Default value: 0.
B
BayoNet 已提交
449 450 451 452


## merge_tree_coarse_index_granularity {#setting-merge_tree_coarse_index_granularity}

453
When searching data, ClickHouse checks the data marks in the index file. If ClickHouse finds that required keys are in some range, it divides this range into `merge_tree_coarse_index_granularity` subranges and searches the required keys there recursively.
B
BayoNet 已提交
454

455
Possible values:
B
BayoNet 已提交
456

457
- Any positive even integer.
B
BayoNet 已提交
458

459
Default value: 8.
B
BayoNet 已提交
460 461 462

## merge_tree_max_rows_to_use_cache {#setting-merge_tree_max_rows_to_use_cache}

463
If ClickHouse should read more than `merge_tree_max_rows_to_use_cache` rows in one query, it doesn't use the cache of uncompressed blocks.
B
BayoNet 已提交
464

465
The cache of uncompressed blocks stores data extracted for queries. ClickHouse uses this cache to speed up responses to repeated small queries. This setting protects the cache from trashing by queries that read a large amount of data. The [uncompressed_cache_size](../server_settings/settings.md#server-settings-uncompressed_cache_size) server setting defines the size of the cache of uncompressed blocks.
466 467 468 469 470 471

Possible values:

- Any positive integer.

Default value: 128 ✕ 8192.
B
BayoNet 已提交
472

473 474
## merge_tree_max_bytes_to_use_cache {#setting-merge_tree_max_bytes_to_use_cache}

475
If ClickHouse should read more than `merge_tree_max_bytes_to_use_cache` bytes in one query, it doesn't use the cache of uncompressed blocks.
476

477
The cache of uncompressed blocks stores data extracted for queries. ClickHouse uses this cache to speed up responses to repeated small queries. This setting protects the cache from trashing by queries that read a large amount of data. The [uncompressed_cache_size](../server_settings/settings.md#server-settings-uncompressed_cache_size) server setting defines the size of the cache of uncompressed blocks.
478

479
Possible value:
480 481

- Any positive integer.
B
BayoNet 已提交
482

483
Default value: 2013265920.
B
BayoNet 已提交
484

485 486
## min_bytes_to_use_direct_io {#settings-min_bytes_to_use_direct_io}

487
The minimum data volume required for using direct I/O access to the storage disk.
488

489
ClickHouse uses this setting when reading data from tables. If the total storage volume of all the data to be read exceeds `min_bytes_to_use_direct_io` bytes, then ClickHouse reads the data from the storage disk with the `O_DIRECT` option.
490

S
Fixes  
Sergei Bocharov 已提交
491
Possible values:
492

493 494
- 0 — Direct I/O is disabled.
- Positive integer.
495

S
Fixes  
Sergei Bocharov 已提交
496
Default value: 0.
497

498
## log_queries {#settings-log-queries}
499

500
Setting up query logging.
501

502
Queries sent to ClickHouse with this setup are logged according to the rules in the [query_log](../server_settings/settings.md#server_settings-query-log) server configuration parameter.
503

S
Fixes  
Sergei Bocharov 已提交
504
Example:
505

S
Fixes  
Sergei Bocharov 已提交
506 507 508
```text
log_queries=1
```
509

510 511 512 513
## log_query_threads {#settings-log-query-threads}

Setting up query threads logging.

A
alexey-milovidov 已提交
514
Queries' threads runned by ClickHouse with this setup are logged according to the rules in the [query_thread_log](../server_settings/settings.md#server_settings-query-thread-log) server configuration parameter.
515

S
Fixes  
Sergei Bocharov 已提交
516
Example:
517

S
Fixes  
Sergei Bocharov 已提交
518 519 520
```text
log_query_threads=1
```
521

522
## max_insert_block_size {#settings-max_insert_block_size}
523 524 525 526 527 528 529

The size of blocks to form for insertion into a table.
This setting only applies in cases when the server forms the blocks.
For example, for an INSERT via the HTTP interface, the server parses the data format and forms blocks of the specified size.
But when using clickhouse-client, the client parses the data itself, and the 'max_insert_block_size' setting on the server doesn't affect the size of the inserted blocks.
The setting also doesn't have a purpose when using INSERT SELECT, since data is inserted using the same blocks that are formed after SELECT.

530
Default value: 1,048,576.
531

532
The default is slightly more than `max_block_size`. The reason for this is because certain table engines (`*MergeTree`) form a data part on the disk for each inserted block, which is a fairly large entity. Similarly, `*MergeTree` tables sort data during insertion, and a large enough block size allows sorting more data in RAM.
533

534
## max_replica_delay_for_distributed_queries {#settings-max_replica_delay_for_distributed_queries}
535

S
Fixes  
Sergei Bocharov 已提交
536
Disables lagging replicas for distributed queries. See [Replication](../../operations/table_engines/replication.md).
537 538 539

Sets the time in seconds. If a replica lags more than the set value, this replica is not used.

540
Default value: 300.
541

542
Used when performing `SELECT` from a distributed table that points to replicated tables.
543

544
## max_threads {#settings-max_threads}
545

546
The maximum number of query processing threads, excluding threads for retrieving data from remote servers (see the 'max_distributed_connections' parameter).
547 548

This parameter applies to threads that perform the same stages of the query processing pipeline in parallel.
549
For example, when reading from a table, if it is possible to evaluate expressions with functions, filter with WHERE and pre-aggregate for GROUP BY in parallel using at least 'max_threads' number of threads, then 'max_threads' are used.
550

A
alexey-milovidov 已提交
551
Default value: the number of physical CPU cores.
552 553 554

If less than one SELECT query is normally run on a server at a time, set this parameter to a value slightly less than the actual number of processor cores.

555
For queries that are completed quickly because of a LIMIT, you can set a lower 'max_threads'. For example, if the necessary number of entries are located in every block and max_threads = 8, then 8 blocks are retrieved, although it would have been enough to read just one.
556 557 558

The smaller the `max_threads` value, the less memory is consumed.

D
Denis Zhuravlev 已提交
559 560 561 562 563 564 565 566 567 568 569
## max_insert_threads {#settings-max_insert_threads}

The maximum number of threads to execute the `INSERT SELECT` query.

Possible values:

- 0 (or 1) — `INSERT SELECT` no parallel execution.
- Positive integer. Bigger than 1.

Default value: 0.

D
Denis Zhuravlev 已提交
570
Parallel `INSERT SELECT` has effect only if the `SELECT` part is executed in parallel, see [max_threads](#settings-max_threads) setting.
D
Denis Zhuravlev 已提交
571 572
Higher values will lead to higher memory usage.

573 574 575 576
## max_compress_block_size

The maximum size of blocks of uncompressed data before compressing for writing to a table. By default, 1,048,576 (1 MiB). If the size is reduced, the compression rate is significantly reduced, the compression and decompression speed increases slightly due to cache locality, and memory consumption is reduced. There usually isn't any reason to change this setting.

577
Don't confuse blocks for compression (a chunk of memory consisting of bytes) with blocks for query processing (a set of rows from a table).
578 579 580

## min_compress_block_size

S
Sergei Bocharov 已提交
581
For [MergeTree](../table_engines/mergetree.md)" tables. In order to reduce latency when processing queries, a block is compressed when writing the next mark if its size is at least 'min_compress_block_size'. By default, 65,536.
582 583 584 585 586 587 588 589 590 591 592

The actual size of the block, if the uncompressed data is less than 'max_compress_block_size', is no less than this value and no less than the volume of data for one mark.

Let's look at an example. Assume that 'index_granularity' was set to 8192 during table creation.

We are writing a UInt32-type column (4 bytes per value). When writing 8192 rows, the total will be 32 KB of data. Since min_compress_block_size = 65,536, a compressed block will be formed for every two marks.

We are writing a URL column with the String type (average size of 60 bytes per value). When writing 8192 rows, the average will be slightly less than 500 KB of data. Since this is more than 65,536, a compressed block will be formed for each mark. In this case, when reading data from the disk in the range of a single mark, extra data won't be decompressed.

There usually isn't any reason to change this setting.

593
## max_query_size {#settings-max_query_size}
594 595 596 597

The maximum part of a query that can be taken to RAM for parsing with the SQL parser.
The INSERT query also contains data for INSERT that is processed by a separate stream parser (that consumes O(1) RAM), which is not included in this restriction.

598
Default value: 256 KiB.
599 600 601 602 603

## interactive_delay

The interval in microseconds for checking whether request execution has been canceled and sending the progress.

604
Default value: 100,000 (checks for canceling and sends the progress ten times per second).
605

606
## connect_timeout, receive_timeout, send_timeout
607 608 609

Timeouts in seconds on the socket used for communicating with the client.

610
Default value: 10, 300, 300.
611

612 613 614 615 616 617 618
## cancel_http_readonly_queries_on_client_close

Cancels HTTP readonly queries (e.g. SELECT) when a client closes the connection without waiting for response.

Default value: 0


619 620 621 622
## poll_interval

Lock in a wait loop for the specified number of seconds.

623
Default value: 10.
624 625 626 627 628

## max_distributed_connections

The maximum number of simultaneous connections with remote servers for distributed processing of a single query to a single Distributed table. We recommend setting a value no less than the number of servers in the cluster.

629
Default value: 1024.
630 631 632 633 634 635 636

The following parameters are only used when creating Distributed tables (and when launching a server), so there is no reason to change them at runtime.

## distributed_connections_pool_size

The maximum number of simultaneous connections with remote servers for distributed processing of all queries to a single Distributed table. We recommend setting a value no less than the number of servers in the cluster.

637
Default value: 1024.
638 639 640 641 642 643

## connect_timeout_with_failover_ms

The timeout in milliseconds for connecting to a remote server for a Distributed table engine, if the 'shard' and 'replica' sections are used in the cluster definition.
If unsuccessful, several attempts are made to connect to various replicas.

644
Default value: 50.
645 646 647

## connections_with_failover_max_tries

648
The maximum number of connection attempts with each replica for the Distributed table engine.
649

650
Default value: 3.
651 652 653 654 655 656

## extremes

Whether to count extreme values (the minimums and maximums in columns of a query result). Accepts 0 or 1. By default, 0 (disabled).
For more information, see the section "Extreme values".

B
BayoNet 已提交
657
## use_uncompressed_cache {#setting-use_uncompressed_cache}
658

659 660
Whether to use a cache of uncompressed blocks. Accepts 0 or 1. By default, 0 (disabled).
Using the uncompressed cache (only for tables in the MergeTree family) can significantly reduce latency and increase throughput when working with a large number of short queries. Enable this setting for users who send frequent short requests. Also pay attention to the [uncompressed_cache_size](../server_settings/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted.
661

662
For queries that read at least a somewhat large volume of data (one million rows or more), the uncompressed cache is disabled automatically in order to save space for truly small queries. This means that you can keep the 'use_uncompressed_cache' setting always set to 1.
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677

## replace_running_query

When using the HTTP interface, the 'query_id' parameter can be passed. This is any string that serves as the query identifier.
If a query from the same user with the same 'query_id' already exists at this time, the behavior depends on the 'replace_running_query' parameter.

`0` (default) – Throw an exception (don't allow the query to run if a query with the same 'query_id' is already running).

`1` – Cancel the old query and start running the new one.

Yandex.Metrica uses this parameter set to 1 for implementing suggestions for segmentation conditions. After entering the next character, if the old query hasn't finished yet, it should be canceled.


## stream_flush_interval_ms

678
Works for tables with streaming in the case of a timeout, or when a thread generates [max_insert_block_size](#settings-max_insert_block_size) rows.
679 680 681 682 683 684

The default value is 7500.

The smaller the value, the more often data is flushed into the table. Setting the value too low leads to poor performance.


685
## load_balancing {#settings-load_balancing}
686

687
Specifies the algorithm of replicas selection that is used for distributed query processing.
688

689
ClickHouse supports the following algorithms of choosing replicas:
690 691 692 693 694 695 696 697

- [Random](#load_balancing-random) (by default)
- [Nearest hostname](#load_balancing-nearest_hostname)
- [In order](#load_balancing-in_order)
- [First or random](#load_balancing-first_or_random)

### Random (by default) {#load_balancing-random}

698
```sql
699 700
load_balancing = random
```
701 702 703 704

The number of errors is counted for each replica. The query is sent to the replica with the fewest errors, and if there are several of these, to any one of them.
Disadvantages: Server proximity is not accounted for; if the replicas have different data, you will also get different data.

705 706
### Nearest Hostname {#load_balancing-nearest_hostname}

707
```sql
708 709
load_balancing = nearest_hostname
```
710 711 712 713

The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a host name that is most similar to the server's host name in the config file (for the number of different characters in identical positions, up to the minimum length of both host names).

For instance, example01-01-1 and example01-01-2.yandex.ru are different in one position, while example01-01-1 and example01-02-2 differ in two places.
714
This method might seem primitive, but it doesn't require external data about network topology, and it doesn't compare IP addresses, which would be complicated for our IPv6 addresses.
715 716 717 718

Thus, if there are equivalent replicas, the closest one by name is preferred.
We can also assume that when sending a query to the same server, in the absence of failures, a distributed query will also go to the same servers. So even if different data is placed on the replicas, the query will return mostly the same results.

719
### In Order {#load_balancing-in_order}
720

721
```sql
722 723
load_balancing = in_order
```
724

A
alexey-milovidov 已提交
725
Replicas with the same number of errors are accessed in the same order as they are specified in configuration.
726 727
This method is appropriate when you know exactly which replica is preferable.

728 729 730

### First or Random {#load_balancing-first_or_random}

731
```sql
732 733 734
load_balancing = first_or_random
```

735
This algorithm chooses the first replica in the set or a random replica if the first is unavailable. It's effective in cross-replication topology setups, but useless in other configurations.
736

737
The `first_or_random` algorithm solves the problem of the `in_order` algorithm. With `in_order`, if one replica goes down, the next one gets a double load while the remaining replicas handle the usual amount of traffic. When using the `first_or_random` algorithm, load is evenly distributed among replicas that are still available.
738

739 740 741 742 743 744 745 746 747 748 749
## prefer_localhost_replica {#settings-prefer_localhost_replica}

Enables/disables preferable using the localhost replica when processing distributed queries.

Possible values:

- 1 — ClickHouse always sends a query to the localhost replica if it exists.
- 0 — ClickHouse uses the balancing strategy specified by the [load_balancing](#settings-load_balancing) setting.

Default value: 1.

750 751 752
!!! warning "Warning"
    Disable this setting if you use [max_parallel_replicas](#settings-max_parallel_replicas).

753 754 755 756 757 758 759
## totals_mode

How to calculate TOTALS when HAVING is present, as well as when max_rows_to_group_by and group_by_overflow_mode = 'any' are present.
See the section "WITH TOTALS modifier".

## totals_auto_threshold

760
The threshold for `totals_mode = 'auto'`.
761 762
See the section "WITH TOTALS modifier".

763
## max_parallel_replicas {#settings-max_parallel_replicas}
764 765 766 767 768 769 770 771 772 773

The maximum number of replicas for each shard when executing a query.
For consistency (to get different parts of the same data split), this option only works when the sampling key is set.
Replica lag is not controlled.

## compile

Enable compilation of queries. By default, 0 (disabled).

Compilation is only used for part of the query-processing pipeline: for the first stage of aggregation (GROUP BY).
774
If this portion of the pipeline was compiled, the query may run faster due to deployment of short cycles and inlining aggregate function calls. The maximum performance improvement (up to four times faster in rare cases) is seen for queries with multiple simple aggregate functions. Typically, the performance gain is insignificant. In very rare cases, it may slow down query execution.
775 776 777 778

## min_count_to_compile

How many times to potentially use a compiled chunk of code before running compilation. By default, 3.
779 780
For testing, the value can be set to 0: compilation runs synchronously and the query waits for the end of the compilation process before continuing execution. For all other cases, use values ​​starting with 1. Compilation normally takes about 5-10 seconds.
If the value is 1 or more, compilation occurs asynchronously in a separate thread. The result will be used as soon as it is ready, including queries that are currently running.
781 782 783 784

Compiled code is required for each different combination of aggregate functions used in the query and the type of keys in the GROUP BY clause.
The results of compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results, since they don't use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted.

785
## output_format_json_quote_64bit_integers {#session_settings-output_format_json_quote_64bit_integers}
786

787
If the value is true, integers appear in quotes when using JSON\* Int64 and UInt64 formats (for compatibility with most JavaScript implementations); otherwise, integers are output without the quotes.
I
Ivan Zhukov 已提交
788

789
## format_csv_delimiter {#settings-format_csv_delimiter}
I
Ivan Zhukov 已提交
790

791 792
The character interpreted as a delimiter in the CSV data. By default, the delimiter is `,`.

793
## input_format_csv_unquoted_null_literal_as_null {#settings-input_format_csv_unquoted_null_literal_as_null}
A
Alexander Tokmakov 已提交
794 795 796

For CSV input format enables or disables parsing of unquoted `NULL` as literal (synonym for `\N`).

M
Mikhail Korotov 已提交
797 798
## output_format_csv_crlf_end_of_line {#settings-output_format_csv_crlf_end_of_line}

A
alexey-milovidov 已提交
799
Use DOS/Windows style line separator (CRLF) in CSV instead of Unix style (LF).
M
Mikhail Korotov 已提交
800

M
millb 已提交
801 802 803 804
## output_format_tsv_crlf_end_of_line {#settings-output_format_tsv_crlf_end_of_line}

Use DOC/Windows style line separator (CRLF) in TSV instead of Unix style (LF).

805
## insert_quorum {#settings-insert_quorum}
806 807 808

Enables quorum writes.

S
Fixes  
Sergei Bocharov 已提交
809 810
- If `insert_quorum < 2`, the quorum writes are disabled.
- If `insert_quorum >= 2`, the quorum writes are enabled.
811

812
Default value: 0.
813

S
Fixes  
Sergei Bocharov 已提交
814
Quorum writes
815 816 817 818 819

`INSERT` succeeds only when ClickHouse manages to correctly write data to the `insert_quorum` of replicas during the `insert_quorum_timeout`. If for any reason the number of replicas with successful writes does not reach the `insert_quorum`, the write is considered failed and ClickHouse will delete the inserted block from all the replicas where data has already been written.

All the replicas in the quorum are consistent, i.e., they contain data from all previous `INSERT` queries. The `INSERT` sequence is linearized.

820
When reading the data written from the `insert_quorum`, you can use the [select_sequential_consistency](#settings-select_sequential_consistency) option.
821

S
Fixes  
Sergei Bocharov 已提交
822
ClickHouse generates an exception
823 824 825 826

- If the number of available replicas at the time of the query is less than the `insert_quorum`.
- At an attempt to write data when the previous block has not yet been inserted in the `insert_quorum` of replicas. This situation may occur if the user tries to perform an `INSERT` before the previous one with the `insert_quorum` is completed.

S
Fixes  
Sergei Bocharov 已提交
827
See also:
828

829 830
- [insert_quorum_timeout](#settings-insert_quorum_timeout)
- [select_sequential_consistency](#settings-select_sequential_consistency)
831

832
## insert_quorum_timeout {#settings-insert_quorum_timeout}
833 834 835

Quorum write timeout in seconds. If the timeout has passed and no write has taken place yet, ClickHouse will generate an exception and the client must repeat the query to write the same block to the same or any other replica.

836
Default value: 60 seconds.
837

S
Fixes  
Sergei Bocharov 已提交
838
See also:
839

840 841
- [insert_quorum](#settings-insert_quorum)
- [select_sequential_consistency](#settings-select_sequential_consistency)
842 843


844
## select_sequential_consistency {#settings-select_sequential_consistency}
845

846 847 848
Enables or disables sequential consistency for `SELECT` queries:

Possible values:
849

850 851
- 0 — Disabled.
- 1 — Enabled.
852

853
Default value: 0.
854

S
Fixes  
Sergei Bocharov 已提交
855
Usage
856

857 858
When sequential consistency is enabled, ClickHouse allows the client to execute the `SELECT` query only for those replicas that contain data from all previous `INSERT` queries executed with `insert_quorum`. If the client refers to a partial replica, ClickHouse will generate an exception. The SELECT query will not include data that has not yet been written to the quorum of replicas.

S
Fixes  
Sergei Bocharov 已提交
859
See also:
860

861 862
- [insert_quorum](#settings-insert_quorum)
- [insert_quorum_timeout](#settings-insert_quorum_timeout)
863

864
## max_network_bytes {#settings-max_network_bytes}
865
Limits the data volume (in bytes) that is received or transmitted over the network when executing a query. This setting applies to every individual query.
866 867 868 869 870 871 872 873 874 875

Possible values:

- Positive integer.
- 0 — Data volume control is disabled.

Default value: 0.

## max_network_bandwidth {#settings-max_network_bandwidth}

876
Limits the speed of the data exchange over the network in bytes per second. This setting applies to every query.
877 878 879 880

Possible values:

- Positive integer.
B
BayoNet 已提交
881
- 0 — Bandwidth control is disabled.
882 883 884 885 886

Default value: 0.

## max_network_bandwidth_for_user {#settings-max_network_bandwidth_for_user}

887
Limits the speed of the data exchange over the network in bytes per second. This setting applies to all concurrently running queries performed by a single user.
888 889 890 891 892 893 894 895 896 897

Possible values:

- Positive integer.
- 0 — Control of the data speed is disabled.

Default value: 0.

## max_network_bandwidth_for_all_users {#settings-max_network_bandwidth_for_all_users}

898
Limits the speed that data is exchanged at over the network in bytes per second. This setting applies to all concurrently running queries on the server.
899 900 901 902 903 904 905 906

Possible values:

- Positive integer.
- 0 — Control of the data speed is disabled.

Default value: 0.

907 908
## count_distinct_implementation {#settings-count_distinct_implementation}

909
Specifies which of the `uniq*` functions should be used to perform the [COUNT(DISTINCT ...)](../../query_language/agg_functions/reference.md#agg_function-count) construction.
910 911 912 913 914

Possible values:

- [uniq](../../query_language/agg_functions/reference.md#agg_function-uniq)
- [uniqCombined](../../query_language/agg_functions/reference.md#agg_function-uniqcombined)
915
- [uniqCombined64](../../query_language/agg_functions/reference.md#agg_function-uniqcombined64)
916 917 918 919
- [uniqHLL12](../../query_language/agg_functions/reference.md#agg_function-uniqhll12)
- [uniqExact](../../query_language/agg_functions/reference.md#agg_function-uniqexact)

Default value: `uniqExact`.
I
Ivan Blinkov 已提交
920

921 922
## skip_unavailable_shards {#settings-skip_unavailable_shards}

923
Enables or disables silently skipping of unavailable shards.
924

925
Shard is considered unavailable if all its replicas are unavailable. A replica is unavailable in the following cases:
926

927
- ClickHouse can't connect to replica for any reason.
928

929
    When connecting to a replica, ClickHouse performs several attempts. If all these attempts fail, the replica is considered unavailable.
930

931
- Replica can't be resolved through DNS.
932

933
    If replica's hostname can't be resolved through DNS, it can indicate the following situations:
934

935 936 937
    - Replica's host has no DNS record. It can occur in systems with dynamic DNS, for example, [Kubernetes](https://kubernetes.io), where nodes can be unresolvable during downtime, and this is not an error.

    - Configuration error. ClickHouse configuration file contains a wrong hostname.
938 939 940 941

Possible values:

- 1 — skipping enabled.
942

943
    If a shard is unavailable, ClickHouse returns a result based on partial data and doesn't report node availability issues.
944

945 946
- 0 — skipping disabled.

947 948
    If a shard is unavailable, ClickHouse throws an exception.

949 950
Default value: 0.

951 952 953 954 955 956
## optimize_skip_unused_shards {#settings-optimize_skip_unused_shards}

Enables or disables skipping of unused shards for SELECT queries that has sharding key condition in PREWHERE/WHERE (assumes that the data is distributed by sharding key, otherwise do nothing).

Default value: 0

957 958 959 960 961 962 963 964 965 966 967 968
## force_optimize_skip_unused_shards {#settings-force_optimize_skip_unused_shards}

Enables or disables query execution if [`optimize_skip_unused_shards`](#settings-optimize_skip_unused_shards) enabled and skipping of unused shards is not possible. If the skipping is not possible and the setting is enabled exception will be thrown.

Possible values:

- 0 - Disabled (do not throws)
- 1 - Disable query execution only if the table has sharding key
- 2 - Disable query execution regardless sharding key is defined for the table

Default value: 0

969 970
## optimize_throw_if_noop {#setting-optimize_throw_if_noop}

971
Enables or disables throwing an exception if an [OPTIMIZE](../../query_language/misc.md#misc_operations-optimize) query didn't perform a merge.
972

973
By default, `OPTIMIZE` returns successfully even if it didn't do anything. This setting lets you differentiate these situations and get the reason in an exception message.
974 975 976 977 978 979 980

Possible values:

- 1 — Throwing an exception is enabled.
- 0 — Throwing an exception is disabled.

Default value: 0.
981 982


V
Vasily Nemkov 已提交
983 984 985 986 987
## distributed_replica_error_half_life {#settings-distributed_replica_error_half_life}

- Type: seconds
- Default value: 60 seconds

F
FeehanG 已提交
988
Controls how fast errors in distributed tables are zeroed. If a replica is unavailabe for some time, accumulates 5 errors, and distributed_replica_error_half_life is set to 1 second, then the replica is considered normal 3 seconds after last error.
V
Vasily Nemkov 已提交
989

S
Fixes  
Sergei Bocharov 已提交
990
See also:
V
Vasily Nemkov 已提交
991 992

- [Table engine Distributed](../../operations/table_engines/distributed.md)
S
Fixes  
Sergei Bocharov 已提交
993
- [distributed_replica_error_cap](#settings-distributed_replica_error_cap)
V
Vasily Nemkov 已提交
994 995 996 997 998 999

## distributed_replica_error_cap {#settings-distributed_replica_error_cap}

- Type: unsigned int
- Default value: 1000

F
FeehanG 已提交
1000
Error count of each replica is capped at this value, preventing a single replica from accumulating too many errors.
V
Vasily Nemkov 已提交
1001

S
Fixes  
Sergei Bocharov 已提交
1002
See also:
V
Vasily Nemkov 已提交
1003 1004

- [Table engine Distributed](../../operations/table_engines/distributed.md)
S
Fixes  
Sergei Bocharov 已提交
1005
- [distributed_replica_error_half_life](#settings-distributed_replica_error_half_life)
1006 1007 1008

## distributed_directory_monitor_sleep_time_ms {#distributed_directory_monitor_sleep_time_ms}

F
FeehanG 已提交
1009
Base interval for the [Distributed](../table_engines/distributed.md) table engine to send data. The actual interval grows exponentially in the event of errors.
1010 1011 1012 1013 1014 1015 1016 1017 1018

Possible values:

- Positive integer number of milliseconds.

Default value: 100 milliseconds.

## distributed_directory_monitor_max_sleep_time_ms {#distributed_directory_monitor_max_sleep_time_ms}

F
FeehanG 已提交
1019
Maximum interval for the [Distributed](../table_engines/distributed.md) table engine to send data. Limits exponential growth of the interval set in the [distributed_directory_monitor_sleep_time_ms](#distributed_directory_monitor_sleep_time_ms) setting.
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030

Possible values:

- Positive integer number of milliseconds.

Default value: 30000 milliseconds (30 seconds).

## distributed_directory_monitor_batch_inserts {#distributed_directory_monitor_batch_inserts}

Enables/disables sending of inserted data in batches.

F
FeehanG 已提交
1031
When batch sending is enabled, the [Distributed](../table_engines/distributed.md) table engine tries to send multiple files of inserted data in one operation instead of sending them separately. Batch sending improves cluster performance by better utilizing server and network resources.
1032 1033 1034 1035 1036 1037

Possible values:

- 1 — Enabled.
- 0 — Disabled.

1038
Default value: 0.
1039

1040 1041
## os_thread_priority {#setting-os_thread_priority}

1042
Sets the priority ([nice](https://en.wikipedia.org/wiki/Nice_(Unix))) for threads that execute queries. The OS scheduler considers this priority when choosing the next thread to run on each available CPU core.
1043 1044

!!! warning "Warning"
1045
    To use this setting, you need to set the `CAP_SYS_NICE` capability. The `clickhouse-server` package sets it up during installation. Some virtual environments don't allow you to set the `CAP_SYS_NICE` capability. In this case, `clickhouse-server` shows a message about it at the start.
1046 1047 1048

Possible values:

1049
- You can set values in the range `[-20, 19]`.
1050

1051
Lower values mean higher priority. Threads with low `nice` priority values are executed more frequently than threads with high values. High values are preferable for long running non-interactive queries because it allows them to quickly give up resources in favor of short interactive queries when they arrive.
1052 1053 1054

Default value: 0.

1055 1056
## query_profiler_real_time_period_ns {#query_profiler_real_time_period_ns}

I
Ivan Blinkov 已提交
1057
Sets the period for a real clock timer of the [query profiler](../../operations/performance/sampling_query_profiler.md). Real clock timer counts wall-clock time.
1058 1059 1060

Possible values:

1061
- Positive integer number, in nanoseconds.
1062 1063

    Recommended values:
1064

1065
        - 10000000 (100 times a second) nanoseconds and less for single queries.
1066 1067 1068 1069 1070 1071
        - 1000000000 (once a second) for cluster-wide profiling.

- 0 for turning off the timer.

Type: [UInt64](../../data_types/int_uint.md).

1072
Default value: 1000000000 nanoseconds (once a second).
1073

S
Fixes  
Sergei Bocharov 已提交
1074
See also:
B
BayoNet 已提交
1075

1076
- System table [trace_log](../system_tables.md#system_tables-trace_log)
1077 1078 1079

## query_profiler_cpu_time_period_ns {#query_profiler_cpu_time_period_ns}

I
Ivan Blinkov 已提交
1080
Sets the period for a CPU clock timer of the [query profiler](../../operations/performance/sampling_query_profiler.md). This timer counts only CPU time.
1081 1082 1083 1084 1085 1086

Possible values:

- Positive integer number of nanoseconds.

    Recommended values:
1087

1088 1089 1090 1091 1092 1093 1094 1095 1096
        - 10000000 (100 times a second) nanosecods and more for for single queries.
        - 1000000000 (once a second) for cluster-wide profiling.

- 0 for turning off the timer.

Type: [UInt64](../../data_types/int_uint.md).

Default value: 1000000000 nanoseconds.

S
Fixes  
Sergei Bocharov 已提交
1097
See also:
B
BayoNet 已提交
1098

1099
- System table [trace_log](../system_tables.md#system_tables-trace_log)
B
BayoNet 已提交
1100

1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111
## allow_introspection_functions {#settings-allow_introspection_functions}

Enables of disables [introspections functions](../../query_language/functions/introspection.md) for query profiling.

Possible values:

- 1 — Introspection functions enabled.
- 0 — Introspection functions disabled.

Default value: 0.

1112 1113 1114 1115 1116
**See Also**

- [Sampling Query Profiler](../performance/sampling_query_profiler.md)
- System table [trace_log](../system_tables.md#system_tables-trace_log)

N
docs  
Nikita Mikhaylov 已提交
1117 1118 1119 1120 1121
## input_format_parallel_parsing

- Type: bool
- Default value: True

N
Nikita Mikhaylov 已提交
1122
Enable order-preserving parallel parsing of data formats. Supported only for TSV, TKSV, CSV and JSONEachRow formats.
N
docs  
Nikita Mikhaylov 已提交
1123

A
Alexander Kuzmenkov 已提交
1124
## min_chunk_bytes_for_parallel_parsing
N
docs  
Nikita Mikhaylov 已提交
1125 1126

- Type: unsigned int
A
Alexander Kuzmenkov 已提交
1127
- Default value: 1 MiB
N
docs  
Nikita Mikhaylov 已提交
1128

A
Alexander Kuzmenkov 已提交
1129
The minimum chunk size in bytes, which each thread will parse in parallel.
1130

A
Andrew Onyshchuk 已提交
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154
## output_format_avro_codec {#settings-output_format_avro_codec}

Sets the compression codec used for output Avro file.

Type: string

Possible values:

- `null` — No compression
- `deflate` — Compress with Deflate (zlib)
- `snappy` — Compress with [Snappy](https://google.github.io/snappy/)

Default value: `snappy` (if available) or `deflate`.

## output_format_avro_sync_interval {#settings-output_format_avro_sync_interval}

Sets minimum data size (in bytes) between synchronization markers for output Avro file.

Type: unsigned int

Possible values: 32 (32 bytes) - 1073741824 (1 GiB)

Default value: 32768 (32 KiB)

A
Andrew Onyshchuk 已提交
1155 1156 1157 1158 1159 1160 1161 1162 1163
## format_avro_schema_registry_url {#settings-format_avro_schema_registry_url}

Sets Confluent Schema Registry URL to use with [AvroConfluent](../../interfaces/formats.md#data-format-avro-confluent) format

Type: URL

Default value: Empty


I
Ivan Blinkov 已提交
1164
[Original article](https://clickhouse.tech/docs/en/operations/settings/settings/) <!-- hide -->