SHOW VARIABLES
Descriptionβ
This statement is used to display Doris system variables, which can be queried by conditions
Syntaxβ
SHOW [<effective_scope>] VARIABLES [<like_pattern> | <where>]
Optional Parametersβ
1. <effective_scope>
Effective scope is one of
GLOBAL
orSESSION
orLOCAL
. If there is no effective scope, default value isSESSION
.LOCAL
is an alias ofSESSION
.
2. <like_pattern>
Use like statement to match and filter result
3. <where>
Use where statement to match and filter result
Access Control Requirementsβ
Users executing this SQL command must have at least the following privileges:
Privilege | Object | Notes |
---|---|---|
Any_PRIV | Session | Any privilege can show variables |
Return Valueβ
Variable_name | Value | Default_Value | Changed |
---|---|---|---|
variable name1 | value1 | default value1 | 0/1 |
variable name2 | value2 | default value2 | 0/1 |
Usage Notesβ
- Show variables is mainly used to view the values of system variables.
- Executing the SHOW VARIABLES command does not require any privileges, it only requires being able to connect to the server.
- The column
Changed
fromReturn Value
, 0 means no changed and 1 means changed. - There are some restrictions when using the
SHOW
statement:- Can not use
or
in where clause - Column names are on the left
- Only supports equivalent comparisons in where clause
- Use the like statement to match with variable_name.
- The % percent wildcard can be used anywhere in the matching pattern
- Can not use
Exampleβ
-
The default here is to match the Variable_name, here is the exact match
show variables like 'max_connections';
-
Matching through the percent sign (%) wildcard can match multiple items
show variables like '%connec%';
-
Use the Where clause for matching queries
show variables where variable_name = 'version';