> For the complete documentation index, see [llms.txt](https://docs.starrocks.io/llms.txt). This page is also available as Markdown at its `.md` URL.

# SET

Sets the specified system variables or user-defined variables for StarRocks. You can view the system variables of StarRocks using [SHOW VARIABLES](https://docs.starrocks.io/docs/sql-reference/sql-statements/cluster-management/config_vars/SHOW_VARIABLES.md). For details about system variables, see [System Variables](https://docs.starrocks.io/docs/sql-reference/System_variable.md). For details about user-defined variables, see [User-defined variables](https://docs.starrocks.io/docs/sql-reference/user_defined_variables.md).

tip

This operation does not require privileges.

## Syntax[​](#syntax "Direct link to Syntax")

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

```

## Parameters[​](#parameters "Direct link to Parameters")

| **Parameter**                    | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Modifier:- GLOBAL<br />- SESSION | - With a `GLOBAL` modifier, the statement sets the variables globally.<br />- With a `SESSION` modifier, the statement sets the variables within the session. `LOCAL` is a synonym for `SESSION`.<br />- If no modifier is present, the default is `SESSION`.For details about global and session variables, see [System Variables](https://docs.starrocks.io/docs/sql-reference/System_variable.md).<br />**NOTE**<br />Only users with the ADMIN privilege can set the variables globally. |
| variable_name                   | The name of the variable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| value                            | The value of the variable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

## Examples[​](#examples "Direct link to Examples")

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

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

```

Example 2: Set the `exec_mem_limit` to `2147483648` globally.

```plain
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.

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

```
