You can use the SHOW VARIABLES syntax to display system attributes or the attributes of the specified table. After you use the CREATE TABLE
syntax to configure attributes for a table or use the ALTER TABLE
syntax to modify the attributes of a table, you can use the SHOW VARIABLES
syntax to check whether the attributes are configured or modified successfully. You can also use the SHOW VARIABLES
syntax to check whether system attributes are properly configured. For example, you can check whether the slow query view or authentication is enabled. This topic describes how to use the SHOW VARIABLE syntax.
Applicable engines and versions
The SHOW VARIBALES syntax is applicable to LindormTable and LindormTSDB.
The SHOW VARIABLES syntax is supported by LindormTable 2.6.2 and later versions. For more information about how to view or upgrade the version of LindormTable, see Release notes of LindormTable and Upgrade the minor engine version of a Lindorm instance.
The SHOW VARIABLES syntax is supported by LindormTSDB 3.4.35 and later versions. For more information about how to view and upgrade the LindormTSDB version of the Lindorm instance, see Release notes of LindormTSDB and Upgrade the minor engine version of a Lindorm instance.
The version of Lindorm SQL must be 2.6.3.2 or later. For more information about how to view the Lindorm SQL version, see SQL versions.
Syntax
show_variables_statement ::= SHOW scope_expression VARIABLES
[ FROM table_identifier]
[ LIKE pattern_expression]
scop_expression ::= { SYSTEM | TABLE }
Parameters
Application scope (scope_expression)
The scope_expression parameter specifies the scope of attributes that you want to view. If you set this parameter to TABLE, the attributes of the specified table are displayed. If you set this parameter to SYSTEM, all system attributes are displayed.
The following table shows the values of this parameter supported by LindormTable and LindormTSDB.
Value | LindormTable | LindormTSDB |
TABLE | 〇 Important The TABLE value is supported by LindormTable 2.6.3 and later versions. The version of Lindorm SQL must be 2.6.6 or later. For more information about how view the LindormTable version, see Release notes of LindormTable. | ✖️ |
SYSTEM | 〇 | 〇 |
Query expression (LIKE pattern_expression)
The pattern_expression parameter specified after the LIKE
keyword is a string constant that is used for the fuzzy match of system attributes. Only the following wildcards are supported in the value of this parameter:
%
: This wildcard is used to indicate zero or multiple characters._
: This wildcard is used to indicate a single character.
FROM
The FROM keyword is supported only when the scope_expression parameter is set to TABLE.
Returned results
For more information about the system attributes returned when the scope_expression parameter is set to SYSTEM, see Supported configuration items.
NoteIf system attributes have not been modified, no results are returned.
The attributes returned when the scope_expression parameter is set to TABLE contain but are not limited to the table attributes that can be configured in the CREATE TABLE syntax. For more information about table attributes, see Table options.
Example
Display all system attributes
SHOW SYSTEM VARIABLES;
The following result is returned:
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| SLOW_QUERY_RECORD_ENABLE | true |
| FILE_FORMAT_VERSION | 5 |
+--------------------------+-------+
Display the attributes of the specified table
In this topic, a sample table named dt is created by executing the following statement:
CREATE TABLE dt (p1 VARCHAR, c1 INTEGER, PRIMARY KEY(p1)) WITH (COMPRESSION = 'LZ4');
Execute the following statement to display the algorithm used to compress data in the dt table:
SHOW TABLE VARIABLES FROM dt LIKE 'COMPRESSION';
The following result is returned:
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| COMPRESSION | LZ4 |
+---------------+-------+
Specify fuzzy conditions to display specific system attributes
Use the
_
wildcard to display specific system attributes.SHOW SYSTEM VARIABLES LIKE 'FILE_FORMAT_VERSION';
The following result is returned:
+---------------------+-------+ | Variable_name | Value | +---------------------+-------+ | FILE_FORMAT_VERSION | 5 | +---------------------+-------+
Display all system attributes whose names start with
FILE
.SHOW SYSTEM VARIABLES LIKE 'FILE%';
The following result is returned:
+---------------------+-------+ | Variable_name | Value | +---------------------+-------+ | FILE_FORMAT_VERSION | 5 | +---------------------+-------+