SET CLUSTER SETTING statement modifies a cluster-wide setting.
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
To use theSET CLUSTER SETTING statement, a user must have one of the following attributes:
-
Be a member of the
adminrole. (By default, therootuser belongs to theadminrole.) -
Have the
MODIFYCLUSTERSETTINGsystem-level privilege granted.rootandadminusers have this system-level privilege by default and are capable of granting it to other users and roles using theGRANTstatement. For example to grant this system-level privilege to usermaxroach: -
Have the
MODIFYSQLCLUSTERSETTINGsystem-level privilege granted. Users with this privilege are allowed to modify onlysql.defaults.*cluster settings, not all cluster settings.
Synopsis
The
SET CLUSTER SETTING statement is unrelated to the other SET TRANSACTION and SET session variable statements.Parameters
Examples
Change the default distributed execution parameter
To configure a cluster so that new sessions automatically try to run queries in a distributed fashion:Use
ALTER ROLE ALL SET {sessionvar} = {val} instead of the sql.defaults.* cluster settings. This allows you to set a default value for all users for any session variable that applies during login, making the sql.defaults.* cluster settings redundant.
