You are viewing an older version of this section. View current production version.
SHOW VARIABLES
Shows a list of variable bindings.
Syntax
SHOW [CLUSTER] [LOCAL|GLOBAL] VARIABLES [EXTENDED]
[LIKE 'pattern' | WHERE expression]
Arguments
pattern- Can contain the%wildcard which represents zero or more characters. Can also contain the_wildcard which represents one character.expression- A SQLWHEREclause.
Remarks
CLUSTER- Displays the list of variables that can sync to all nodes._SYNCandCLUSTERare synonymous. Use either of the options in the command.LOCAL- Displays the list of variable bindings in the current connection to the node. This includes the values of global variables that have been set. Values of session variables that can be set globally are not included, when these variables are set globally.SESSIONandLOCALare synonymous. Use either of the options in the command.GLOBAL- Displays the list of global variable bindings. Values of session variables that can be set globally are also included, when these variables are set globally.- If the
_SYNC|CLUSTERoption is specified,GLOBALvariables are shown by default. - If the
_SYNC|CLUSTERoption is not specified,LOCALvariables are shown by default. EXTENDED- Displays additional information about the variables in the output:Variable_type- Displays the type of sync variable. For non-sync variables and session variables that can also be set globally, the value isLocal.Cluster_type- If the variable is global, has the same value asVariable_type. If the variable is a session variable that can also be set globally, displays the type of sync variable. If the variable is not a sync variable, the value isLocal.
- This command can be run on any SingleStore node (see Node Requirements for SingleStore DB Commands).
Examples
Using SHOW VARIABLES with a Wildcard
SHOW VARIABLES LIKE 'auto%';
****
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_attach | ON |
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| auto_replicate | OFF |
| autocommit | ON |
+--------------------------+-------+
Behavior of SHOW LOCAL VARIABLES When a Global Variable is Set
When a global variable is set, its value becomes effective in the current connection to the node. For this reason, after setting the global variable connect_timeout to 20, this value is shown in the SHOW LOCAL VARIABLES output:
SET GLOBAL connect_timeout = 20;
SHOW LOCAL VARIABLES LIKE 'connect_timeout';
****
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| connect_timeout | 20 |
+-----------------+-------+
Behavior of SHOW LOCAL VARIABLES When a Session Variable that can be Set Globally is Set
When a session variable that can also be set globally is set globally, its value is not effective in the current connection to the node. For this reason, after setting the variable enable_broadcast_left_join to OFF, the value is not shown in the SHOW LOCAL VARIABLES output:
SET GLOBAL enable_broadcast_left_join = OFF;
SHOW LOCAL VARIABLES LIKE 'enable_broadcast_left_join';
****
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| enable_broadcast_left_join | ON |
+----------------------------+-------+
Using the EXTENDED Clause
In this example, the value of Variable_type is Local because character_set_server is a session variable that can be set globally. The value of Cluster_type is not Local because character_set_server is a sync variable.
SHOW VARIABLES EXTENDED LIKE 'character_set_server';
****
+----------------------+-------+---------------+----------------------------+
| Variable_name | Value | Variable_type | Cluster_type |
+----------------------+-------+---------------+----------------------------+
| character_set_server | utf8 | Local | Cluster-wide for all nodes |
+----------------------+-------+---------------+----------------------------+