SET CLUSTER SETTING

The SET CLUSTER SETTING statement modifies a cluster-wide setting.

Warning:
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.

Required privileges

Only members of the admin role can modify cluster settings. By default, the root user belongs to the admin role.

Synopsis

SETCLUSTERSETTINGvar_name=TOvar_valueDEFAULT

Note:
The SET CLUSTER SETTING statement is unrelated to the other SET TRANSACTION and SET (session variable) statements.

Parameters

ParameterDescription
var_nameThe name of the cluster setting (case-insensitive).
var_valueThe value for the cluster setting.
DEFAULTReset the cluster setting to its default value.The RESET CLUSTER SETTING resets a cluster setting as well.

Examples

Change the default distributed execution parameter

To configure a cluster so that new sessions automatically try to run queries in a distributed fashion:

  1. > SET CLUSTER SETTING sql.defaults.distsql = 1;

To disable distributed execution for all new sessions:

  1. > SET CLUSTER SETTING sql.defaults.distsql = 0;

Disable automatic diagnostic reporting

To opt out of automatic diagnostic reporting of usage data to Cockroach Labs:

  1. > SET CLUSTER SETTING diagnostics.reporting.enabled = false;
  1. > SHOW CLUSTER SETTING diagnostics.reporting.enabled;
  1. +-------------------------------+
  2. | diagnostics.reporting.enabled |
  3. +-------------------------------+
  4. | false |
  5. +-------------------------------+
  6. (1 row)

Reset a setting to its default value

Tip:
You can use RESET CLUSTER SETTING to reset a cluster setting as well.

  1. > SET CLUSTER SETTING sql.metrics.statement_details.enabled = false;
  1. > SHOW CLUSTER SETTING sql.metrics.statement_details.enabled;
  1. +---------------------------------------+
  2. | sql.metrics.statement_details.enabled |
  3. +---------------------------------------+
  4. | false |
  5. +---------------------------------------+
  6. (1 row)
  1. > SET CLUSTER SETTING sql.metrics.statement_details.enabled = DEFAULT;
  1. > SHOW CLUSTER SETTING sql.metrics.statement_details.enabled;
  1. +---------------------------------------+
  2. | sql.metrics.statement_details.enabled |
  3. +---------------------------------------+
  4. | true |
  5. +---------------------------------------+
  6. (1 row)

See also

Was this page helpful?
YesNo