title | summary | toc |
---|---|---|
SET CLUSTER SETTING |
The SET CLUSTER SETTING statement configures one cluster setting. |
true |
The SET CLUSTER SETTING
statement modifies a cluster-wide setting.
{{site.data.alerts.callout_danger}}Many cluster settings are intended for tuning CockroachDB internals. Before changing these settings, we strongly encourage you to discuss your goals with CockroachDB; otherwise, you use them at your own risk.{{site.data.alerts.end}}
Only members of the admin
role can modify cluster settings. By default, the root
user belongs to the admin
role.
{{site.data.alerts.callout_info}}The SET CLUSTER SETTING
statement is unrelated to the other SET TRANSACTION
and SET (session variable)
statements.{{site.data.alerts.end}}
Parameter | Description |
---|---|
var_name |
The name of the cluster setting (case-insensitive). |
var_value |
The value for the cluster setting. |
DEFAULT |
Reset the cluster setting to its default value. The RESET CLUSTER SETTING resets a cluster setting as well. |
To configure a cluster so that new sessions automatically try to run queries in a distributed fashion:
{% include copy-clipboard.html %}
> SET CLUSTER SETTING sql.defaults.distsql = 1;
To disable distributed execution for all new sessions:
{% include copy-clipboard.html %}
> SET CLUSTER SETTING sql.defaults.distsql = 0;
To opt out of automatic diagnostic reporting of usage data to Cockroach Labs:
{% include copy-clipboard.html %}
> SET CLUSTER SETTING diagnostics.reporting.enabled = false;
{% include copy-clipboard.html %}
> SHOW CLUSTER SETTING diagnostics.reporting.enabled;
+-------------------------------+
| diagnostics.reporting.enabled |
+-------------------------------+
| false |
+-------------------------------+
(1 row)
{{site.data.alerts.callout_success}}You can use RESET CLUSTER SETTING
to reset a cluster setting as well.{{site.data.alerts.end}}
{% include copy-clipboard.html %}
> SET CLUSTER SETTING sql.metrics.statement_details.enabled = false;
{% include copy-clipboard.html %}
> SHOW CLUSTER SETTING sql.metrics.statement_details.enabled;
+---------------------------------------+
| sql.metrics.statement_details.enabled |
+---------------------------------------+
| false |
+---------------------------------------+
(1 row)
{% include copy-clipboard.html %}
> SET CLUSTER SETTING sql.metrics.statement_details.enabled = DEFAULT;
{% include copy-clipboard.html %}
> SHOW CLUSTER SETTING sql.metrics.statement_details.enabled;
+---------------------------------------+
| sql.metrics.statement_details.enabled |
+---------------------------------------+
| true |
+---------------------------------------+
(1 row)