Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improved zh and en version of ddl/show_variables #2324

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 64 additions & 20 deletions docs/en/reference/sql/ddl/SHOW_VARIABLES_STATEMENT.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,95 @@
# SHOW VARIABLES
`SHOW VARIABLES` is used to view system variables.
- The `SHOW SESSION VARIABLES` or `SHOW VARIABLES` statement can display system variables of the **current session**.
- `SHOW GLOBAL VARIABLES` is used to display the **global** system variables

Currently, OpenMLDB only supports session system variables and global system variables but doesn't support user variables. Modifications to session variables will only affect the current session (that is, the current database connection). Therefore, when you close the connection (or exit the console), and then reconnect (or log in to the console again), the previous configuration and modification of session variables will be reset.

## Syntax
```sql
ShowVariablesStmt ::=
ShowSessionVariablesStmt
ShowSessionVariablesStmt | ShowGlobalVariablesStmt

ShowSessionVariablesStmt ::=
'SHOW' 'VARIABLES'
|'SHOW' 'SESSION' 'VARIABLES'

'SHOW' 'VARIABLES'
|'SHOW' 'SESSION' 'VARIABLES'
ShowGlobalVariablesStmt ::=
'SHOW' 'GLOBAL' 'VARIABLES'
```

The `SHOW SESSION VARIABLES` or `SHOW VARIABLES` statement is used to display system variables for the current session.

Currently OpenMLDB only supports session system variables. Modifications to session variables will only affect the current session (that is, the current database connection). Therefore, when you close the database connection (or exit the console), and then reconnect (or log in to the console again), the previous configuration and modification of session variables will be reset.

## Example

```sql
> SHOW SESSION VARIABLES;
--------------- --------
--------------- ---------
Variable_name Value
--------------- --------
--------------- ---------
enable_trace false
execute_mode online
--------------- --------
execute_mode offline
job_timeout 20000
sync_job false
--------------- ---------

4 rows in set


> SET @@enable_trace = "true"

--SUCCEED
> SHOW VARIABLES;
--------------- --------
--------------- ---------
Variable_name Value
--------------- --------
--------------- ---------
enable_trace true
execute_mode online
--------------- --------
execute_mode offline
job_timeout 20000
sync_job false
--------------- ---------

4 rows in set


> SHOW GLOBAL VARIABLES;
--------------- ----------------
Variable_name Variable_value
--------------- ----------------
enable_trace false
sync_job false
job_timeout 20000
execute_mode offline
--------------- ----------------

4 rows in set
```

After exiting the console, log back into the console
After exiting the console, log back into the console and check the variables again.

```sql
> SHOW SESSION VARIABLES;
--------------- --------
--------------- ---------
Variable_name Value
--------------- --------
--------------- ---------
enable_trace false
execute_mode online
--------------- --------
execute_mode offline
job_timeout 20000
sync_job false
--------------- ---------

4 rows in set


> SHOW GLOBAL VARIABLES;
--------------- ----------------
Variable_name Variable_value
--------------- ----------------
enable_trace false
sync_job false
job_timeout 20000
execute_mode offline
--------------- ----------------

4 rows in set
```


Expand Down
10 changes: 7 additions & 3 deletions docs/zh/reference/sql/ddl/SHOW_VARIABLES_STATEMENT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# SHOW VARIABLES
SHOW VARIABLES 语句用于查看系统变量。其中:
- `SHOW SESSION VARIABLES`或`SHOW VARIABLES`语句用于显示当前会话的系统变量。
- `SHOW GLOBAL VARIABLES`可用于查看全局系统变量。
目前OpenMLDB只支持会话系统变量和全局系统变量,不支持用户变量。对会话变量的修改,只影响当前的会话(也就是当前的数据库连接)。因此,当关闭数据库连接(或者退出控制台)后,再重新连接(或者重新登陆控制台),先前对会话变量的配置和修改都将被重置。

## Syntax

```sql
ShowVariablesStmt ::=
Expand All @@ -11,10 +17,8 @@ ShowGlobalVariablesStmt ::=
'SHOW' 'GLOBAL' 'VARIABLES'
```

`SHOW SESSION VARIABLES`或`SHOW VARIABLES`语句用于显示当前会话的系统变量。
`SHOW GLOBAL VARIABLES`可用于查看全局系统变量。

目前OpenMLDB只支持会话系统变量和全局系统变量,不支持用户变量。对会话变量的修改,只影响当前的会话(也就是当前的数据库连接)。因此,当关闭数据库连接(或者退出控制台)后,再重新连接(或者重新登陆控制台),先前对会话变量的配置和修改都将被重置。


## Example

Expand Down