Skip to main content
The SET CLUSTER SETTING modifies a .

Required privileges

To use the SET CLUSTER SETTING statement, a user must have one of the following attributes:
  • Be a member of the admin role. (By default, the root user belongs to the admin role.)
  • Have the MODIFYCLUSTERSETTING granted. root and users have this system-level privilege by default and are capable of granting it to other users and roles using the statement. For example to grant this system-level privilege to user maxroach:
    GRANT SYSTEM MODIFYCLUSTERSETTING TO maxroach;
    
  • Have the MODIFYSQLCLUSTERSETTING granted. Users with this privilege are allowed to modify only , not all cluster settings.

Synopsis

set_cluster_setting syntax diagram

Parameters

ParameterDescription
var_nameThe name of the (case-insensitive).
var_valueThe value for the .
DEFAULTReset the to its default value.

The 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:
> SET CLUSTER SETTING sql.defaults.distsql = 1;
To disable distributed execution for all new sessions:
> SET CLUSTER SETTING sql.defaults.distsql = 0;
Use instead of the sql.defaults.* . This allows you to set a default value for all users for any that applies during login, making the sql.defaults.* cluster settings redundant.

Disable automatic diagnostic reporting

To opt out of of usage data to Cockroach Labs:
> SET CLUSTER SETTING diagnostics.reporting.enabled = false;
> SHOW CLUSTER SETTING diagnostics.reporting.enabled;
  diagnostics.reporting.enabled
---------------------------------
              false
(1 row)

Reset a setting to its default value

> SET CLUSTER SETTING sql.metrics.statement_details.enabled = false;
> SHOW CLUSTER SETTING sql.metrics.statement_details.enabled;
  sql.metrics.statement_details.enabled
-----------------------------------------
                  false
(1 row)
> SET CLUSTER SETTING sql.metrics.statement_details.enabled = DEFAULT;
> SHOW CLUSTER SETTING sql.metrics.statement_details.enabled;
  sql.metrics.statement_details.enabled
-----------------------------------------
                  true
(1 row)

See also