Skip to main content

SET

Description

Sets the specified system variables or user-defined variables for StarRocks. You can view the system variables of StarRocks using SHOW VARIABLES. For details about system variables, see System Variables. For details about user-defined variables, see User-defined variables.

tip

This operation does not require privileges.

Syntax

SET [ GLOBAL | SESSION ] <variable_name> = <value> [, <variable_name> = <value>] ...

Parameters

ParameterDescription
Modifier:
  • GLOBAL
  • SESSION
  • With a GLOBAL modifier, the statement sets the variables globally.
  • With a SESSION modifier, the statement sets the variables within the session. LOCAL is a synonym for SESSION.
  • If no modifier is present, the default is SESSION.
For details about global and session variables, see System Variables.
NOTE
Only users with the ADMIN privilege can set the variables globally.
variable_nameThe name of the variable.
valueThe value of the variable.

Examples

Example 1: Set the time_zone to Asia/Shanghai within the session.

mysql> SET time_zone = "Asia/Shanghai";
Query OK, 0 rows affected (0.00 sec)

Example 2: Set the exec_mem_limit to 2147483648 globally.

mysql> SET GLOBAL exec_mem_limit = 2147483648;
Query OK, 0 rows affected (0.00 sec)

Example 3: Set multiple global variables. Add the GLOBAL keyword before each variable.

mysql> SET 
GLOBAL exec_mem_limit = 2147483648,
GLOBAL time_zone = "Asia/Shanghai";
Query OK, 0 rows affected (0.00 sec)