ClickHouse/docs/en/sql-reference/statements/alter/setting.md

62 lines
1.4 KiB
Markdown
Raw Normal View History

2021-07-25 15:11:19 +00:00
---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/statements/alter/setting
sidebar_position: 38
sidebar_label: SETTING
2021-07-25 15:11:19 +00:00
---
2022-06-02 10:55:18 +00:00
# Table Settings Manipulations
2021-07-25 15:11:19 +00:00
2021-07-29 15:20:55 +00:00
There is a set of queries to change table settings. You can modify settings or reset them to default values. A single query can change several settings at once.
If a setting with the specified name does not exist, then the query raises an exception.
2021-07-25 15:11:19 +00:00
**Syntax**
``` sql
ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY|RESET SETTING ...
```
:::note
These queries can be applied to [MergeTree](../../../engines/table-engines/mergetree-family/mergetree.md) tables only.
:::
2021-07-25 15:11:19 +00:00
2022-06-02 10:55:18 +00:00
## MODIFY SETTING
2021-07-25 15:11:19 +00:00
Changes table settings.
**Syntax**
```sql
MODIFY SETTING setting_name=value [, ...]
2021-07-25 15:11:19 +00:00
```
**Example**
```sql
CREATE TABLE example_table (id UInt32, data String) ENGINE=MergeTree() ORDER BY id;
ALTER TABLE example_table MODIFY SETTING max_part_loading_threads=8, max_parts_in_total=50000;
```
2022-06-02 10:55:18 +00:00
## RESET SETTING
2021-07-25 15:11:19 +00:00
2021-07-29 15:20:55 +00:00
Resets table settings to their default values. If a setting is in a default state, then no action is taken.
2021-07-25 15:11:19 +00:00
**Syntax**
```sql
RESET SETTING setting_name [, ...]
2021-07-25 15:11:19 +00:00
```
**Example**
```sql
CREATE TABLE example_table (id UInt32, data String) ENGINE=MergeTree() ORDER BY id
SETTINGS max_part_loading_threads=8;
2021-07-29 15:27:50 +00:00
2021-07-25 15:11:19 +00:00
ALTER TABLE example_table RESET SETTING max_part_loading_threads;
```
2021-07-29 15:20:55 +00:00
**See Also**
2021-07-25 15:11:19 +00:00
- [MergeTree settings](../../../operations/settings/merge-tree-settings.md)