2020-04-03 13:23:32 +00:00
---
2022-03-30 02:38:50 +00:00
sidebar_label: Settings
sidebar_position: 52
2022-03-29 23:43:34 +00:00
slug: index
2020-04-03 13:23:32 +00:00
---
2022-03-30 02:38:50 +00:00
# Settings
2020-05-06 06:13:29 +00:00
There are multiple ways to make all the settings described in this section of documentation.
2017-12-28 15:13:23 +00:00
Settings are configured in layers, so each subsequent layer redefines the previous settings.
Ways to configure settings, in order of priority:
2020-03-21 04:11:51 +00:00
- Settings in the `users.xml` server configuration file.
2017-12-28 15:13:23 +00:00
2020-03-21 04:11:51 +00:00
Set in the element `<profiles>` .
2017-12-28 15:13:23 +00:00
2020-03-21 04:11:51 +00:00
- Session settings.
2017-12-28 15:13:23 +00:00
2020-03-21 04:11:51 +00:00
Send `SET setting=value` from the ClickHouse console client in interactive mode.
Similarly, you can use ClickHouse sessions in the HTTP protocol. To do this, you need to specify the `session_id` HTTP parameter.
2017-12-28 15:13:23 +00:00
2020-03-21 04:11:51 +00:00
- Query settings.
2017-12-28 15:13:23 +00:00
2020-03-21 04:11:51 +00:00
- When starting the ClickHouse console client in non-interactive mode, set the startup parameter `--setting=value` .
- When using the HTTP API, pass CGI parameters (`URL?setting_1=value& setting_2=value...`).
2021-01-16 19:34:13 +00:00
- Make settings in the [SETTINGS ](../../sql-reference/statements/select/index.md#settings-in-select ) clause of the SELECT query. The setting value is applied only to that query and is reset to default or previous value after the query is executed.
2018-09-04 11:18:59 +00:00
2020-03-20 10:10:48 +00:00
Settings that can only be made in the server config file are not covered in this section.
2018-10-16 10:47:17 +00:00
2020-09-28 02:59:01 +00:00
## Custom Settings {#custom_settings}
2021-07-29 15:20:55 +00:00
In addition to the common [settings ](../../operations/settings/settings.md ), users can define custom settings.
2020-09-28 02:59:01 +00:00
A custom setting name must begin with one of predefined prefixes. The list of these prefixes must be declared in the [custom_settings_prefixes ](../../operations/server-configuration-parameters/settings.md#custom_settings_prefixes ) parameter in the server configuration file.
```xml
< custom_settings_prefixes > custom_< / custom_settings_prefixes >
```
To define a custom setting use `SET` command:
```sql
SET custom_a = 123;
```
To get the current value of a custom setting use `getSetting()` function:
```sql
2021-07-29 15:27:50 +00:00
SELECT getSetting('custom_a');
2020-09-28 02:59:01 +00:00
```
**See Also**
- [Server Configuration Settings ](../../operations/server-configuration-parameters/settings.md )
2021-09-19 20:05:54 +00:00
[Original article ](https://clickhouse.com/docs/en/operations/settings/ ) <!--hide-->