System Variables¶
System variables control the behavior of a session or the entire instance engine. Use SET to change them, subject to privileges and whether a variable can be changed dynamically, and use SHOW VARIABLES to inspect them.
Global and session scopes¶
Scope |
Meaning |
|---|---|
Global (GLOBAL) |
Affects the default behavior of new sessions. Some values persist for the instance lifecycle. |
Session (SESSION) |
Applies only to the current connection and expires when it disconnects. |
Both |
Has both a global default and a session override. |
SHOW VARIABLES;
SHOW VARIABLES LIKE 'sql_mode';
SHOW GLOBAL VARIABLES;
SHOW SESSION VARIABLES LIKE '%timeout%';
SET SESSION autocommit = 0;
SET GLOBAL max_allowed_packet = 33554432; -- Requires sufficient privileges, and the variable must support dynamic modification
Custom user variables such as @var differ from system variables. They temporarily store scalar values within a session. Refer to client usage and statements such as SET @a = ....
Common variables¶
The following table lists variables commonly encountered in the documentation and product. Refer to SHOW VARIABLES for the complete list.
Variable |
Typical purpose |
Notes |
|---|---|---|
|
Enables automatic commits |
Transaction scripts commonly disable it temporarily. |
|
SQL mode set |
Affects strictness, GROUP BY behavior, and more. |
|
Character sets and collations |
A common default is |
|
Session time zone |
Affects |
|
Table-name case behavior |
Commonly 1 (case-insensitive) and usually should not be changed arbitrarily. |
|
Maximum packet size in bytes |
Increase it for large results or statements. |
|
Idle and write timeouts |
Relevant to long-lived connections and slow networks. |
|
Auto-increment step and offset |
|
|
Enables foreign-key checks |
Can be disabled temporarily during bulk loading after consistency risks are assessed. |
|
Query-result persistence |
MatrixOne extension capabilities |
|
Safe updates |
Restricts updates and deletes without a key or WHERE clause. |
Password / login policy variables |
Complexity, failure limits, allowlists, and more |
Related to instance security policies |
Query-result extensions¶
If query-result persistence is enabled for the instance:
save_query_result: Whether to save results.query_result_maxsize/query_result_timeout: Size and retention-time limits.
Whether these capabilities are available to your tenant depends on the console and SHOW VARIABLES.