morrySnow commented on code in PR #1901: URL: https://github.com/apache/doris-website/pull/1901#discussion_r1925307443
########## docs/sql-manual/sql-statements/session/queries/CLEAN-ALL-QUERY-STATS.md: ########## @@ -24,46 +24,64 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used to clear query statistics -grammar: +## Syntax ```sql -CLEAN [ALL| DATABASE | TABLE] QUERY STATS [[FOR db_name]|[FROM|IN] table_name]]; +CLEAN [ { ALL| DATABASE | TABLE } ] QUERY STATS [ { [ FOR <db_name>] | [ { FROM | IN } ] <table_name>]]; ``` -Remarks: +## Required Parameters + +**1. `ALL`** + +> Use ALL to clear all query statistics + +**2. `DATABASE`** + +> DATABASE clears statistics of a database Review Comment: database 和 table 也按照 ALL 的方式改一下~ ########## docs/sql-manual/sql-statements/session/queries/CLEAN-ALL-QUERY-STATS.md: ########## @@ -24,46 +24,64 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used to clear query statistics -grammar: +## Syntax ```sql -CLEAN [ALL| DATABASE | TABLE] QUERY STATS [[FOR db_name]|[FROM|IN] table_name]]; +CLEAN [ { ALL| DATABASE | TABLE } ] QUERY STATS [ { [ FOR <db_name>] | [ { FROM | IN } ] <table_name>]]; ``` -Remarks: +## Required Parameters + +**1. `ALL`** + +> Use ALL to clear all query statistics + +**2. `DATABASE`** + +> DATABASE clears statistics of a database + +**3. `TABLE`** + +> TABLE Indicates that statistics of a table are cleared + +## Optional Parameters + +**1. `<db_name>`** -1. If ALL is specified, all query statistics are cleared, including database and table, admin privilege is needed -2. If DATABASE is specified, the query statistics of the specified database are cleared, alter privilege for this database is needed -3. If TABLE is specified, the query statistics of the specified table are cleared, alter privilege for this table is needed +> If this parameter is set, the statistics of the corresponding database are cleared -## Example +**2. `<table_name>`** -1. Clear all statistics -2. - ```sql - clean all query stats; - ``` +> If this parameter is set, the statistics of the corresponding table are cleared -2. Clear the specified database statistics - ```sql - clean database query stats for test_query_db; - ``` -3. Clear the specified table statistics +## Access Control Requirements - ```sql - clean table query stats from test_query_db.baseall; - ``` +The user who executes this SQL command must have at least the following permissions: -## Keywords +| Privilege | Object | Notes | +|:-------------|:---------|:--------------------------| +| ADMIN | ALL | If ALL is specified, the ADMIN permission is required | Review Comment: ```suggestion | ADMIN_PRIV | ALL | If ALL is specified, the ADMIN permission is required | ``` ########## docs/sql-manual/sql-statements/session/queries/KILL-QUERY.md: ########## @@ -24,62 +24,74 @@ specific language governing permissions and limitations under the License. --> +## Description +Each Doris connection runs in a separate thread. Use this statement to terminate the thread. -In Doris, each connection runs in a separate thread. You can terminate a thread using the `KILL processlist_id`statement. +## Syntax -The `processlist_id` for the thread can be found in the Id column from the SHOW PROCESSLIST output. Or you can use the `SELECT CONNECTION_ID()` command to query the current connection id. +```SQL +KILL [CONNECTION] <processlist_id> +``` -Syntax: +## Varaint Syntax -```sql -KILL [CONNECTION] processlist_id +```SQL +KILL QUERY [ { <processlist_id> | <query_id> } ] ``` -## Kill query +## Required Parameters -You can also terminate the query command under execution based on the processlist_id or the query_id. +**1. `<processlist_id>`** -Syntax: +> Indicates the ID of the connection thread that needs to be killed -```sql -KILL QUERY processlist_id | query_id -``` +**2. `<query_id>`** + +> Indicates the ID of the query to be killed + +## Optional Parameters + +**1. `CONNECTION`** + +> Indicates whether the thread is currently connected + +## Usage Notes -## Example +- The thread process list identifier can be queried from the Id column output by the SHOW PROCESSLIST -1. Check the current connection id. Review Comment: kill query 不需要权限? ########## docs/sql-manual/sql-statements/session/queries/CLEAN-ALL-QUERY-STATS.md: ########## @@ -24,46 +24,64 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used to clear query statistics -grammar: +## Syntax ```sql -CLEAN [ALL| DATABASE | TABLE] QUERY STATS [[FOR db_name]|[FROM|IN] table_name]]; +CLEAN [ { ALL| DATABASE | TABLE } ] QUERY STATS [ { [ FOR <db_name>] | [ { FROM | IN } ] <table_name>]]; ``` -Remarks: +## Required Parameters + +**1. `ALL`** + +> Use ALL to clear all query statistics + +**2. `DATABASE`** + +> DATABASE clears statistics of a database + +**3. `TABLE`** + +> TABLE Indicates that statistics of a table are cleared + +## Optional Parameters + +**1. `<db_name>`** -1. If ALL is specified, all query statistics are cleared, including database and table, admin privilege is needed -2. If DATABASE is specified, the query statistics of the specified database are cleared, alter privilege for this database is needed -3. If TABLE is specified, the query statistics of the specified table are cleared, alter privilege for this table is needed +> If this parameter is set, the statistics of the corresponding database are cleared -## Example +**2. `<table_name>`** -1. Clear all statistics -2. - ```sql - clean all query stats; - ``` +> If this parameter is set, the statistics of the corresponding table are cleared -2. Clear the specified database statistics - ```sql - clean database query stats for test_query_db; - ``` -3. Clear the specified table statistics +## Access Control Requirements - ```sql - clean table query stats from test_query_db.baseall; - ``` +The user who executes this SQL command must have at least the following permissions: -## Keywords +| Privilege | Object | Notes | +|:-------------|:---------|:--------------------------| +| ADMIN | ALL | If ALL is specified, the ADMIN permission is required | +| ALTER | DATABASE | If the database is specified, the ALTER permission for the corresponding database is required | Review Comment: ```suggestion | ALTER_PRIV | DATABASE | If the database is specified, the ALTER permission for the corresponding database is required | ``` ########## docs/sql-manual/sql-statements/session/queries/CLEAN-ALL-QUERY-STATS.md: ########## @@ -24,46 +24,64 @@ specific language governing permissions and limitations under the License. --> - - ## Description This statement is used to clear query statistics -grammar: +## Syntax ```sql -CLEAN [ALL| DATABASE | TABLE] QUERY STATS [[FOR db_name]|[FROM|IN] table_name]]; +CLEAN [ { ALL| DATABASE | TABLE } ] QUERY STATS [ { [ FOR <db_name>] | [ { FROM | IN } ] <table_name>]]; ``` -Remarks: +## Required Parameters + +**1. `ALL`** + +> Use ALL to clear all query statistics + +**2. `DATABASE`** + +> DATABASE clears statistics of a database + +**3. `TABLE`** + +> TABLE Indicates that statistics of a table are cleared + +## Optional Parameters + +**1. `<db_name>`** -1. If ALL is specified, all query statistics are cleared, including database and table, admin privilege is needed -2. If DATABASE is specified, the query statistics of the specified database are cleared, alter privilege for this database is needed -3. If TABLE is specified, the query statistics of the specified table are cleared, alter privilege for this table is needed +> If this parameter is set, the statistics of the corresponding database are cleared -## Example +**2. `<table_name>`** -1. Clear all statistics -2. - ```sql - clean all query stats; - ``` +> If this parameter is set, the statistics of the corresponding table are cleared -2. Clear the specified database statistics - ```sql - clean database query stats for test_query_db; - ``` -3. Clear the specified table statistics +## Access Control Requirements - ```sql - clean table query stats from test_query_db.baseall; - ``` +The user who executes this SQL command must have at least the following permissions: -## Keywords +| Privilege | Object | Notes | +|:-------------|:---------|:--------------------------| +| ADMIN | ALL | If ALL is specified, the ADMIN permission is required | +| ALTER | DATABASE | If the database is specified, the ALTER permission for the corresponding database is required | +| ADMIN | TABLE | If you specify a table, you need alter permission for that table | Review Comment: ```suggestion | ADMIN_PRIV | TABLE | If you specify a table, you need alter permission for that table | ``` ########## docs/sql-manual/sql-statements/session/queries/SHOW-PROCESSLIST.md: ########## @@ -25,68 +25,69 @@ specific language governing permissions and limitations under the License. --> - - - ## Description -Display the running threads of the user. It should be noted that except the root user who can see all running threads, other users can only see their own running threads, and cannot see the running threads of other users. +Displays the thread that the user is running -Only display current connected FE's connection list by default, you can set session variable ```set show_all_fe_connection = true``` to show all FE's connection. - -grammar: +## Syntax ```sql SHOW [FULL] PROCESSLIST ``` -illustrate: - -- CurrentConnected: Indicates whether the connection is currently connected -- Id: It is the unique identifier of this thread. When we find that there is a problem with this thread, we can use the kill command to add this Id value to kill this thread. -- User: refers to the user who started this thread. -- Host: Records the IP and port number of the client sending the request. Through this information, when troubleshooting the problem, we can locate which client and which process sent the request. -- LoginTime: Timestamp when the connection is make. -- Catalog: Catalog name. -- Db: which database the currently executed command is on. If no database is specified, the value is NULL . -- Command: refers to the command that the thread is executing at the moment. -- Time: Indicates the time the thread is in the current state. -- State: The state of the thread, corresponding to Command. -- QueryId: The ID of the current query statement. -- Info: Generally recorded is the statement executed by the thread. By default, only the first 100 characters are displayed, that is, the statement you see may be truncated. To see all the information, you need to use show full processlist. +## Optional Parameters -Common Command types are as follows: +**1. `FULL`** -- Query: The thread is executing a statement -- Sleep: is waiting for a client to send it an execute statement -- Quit: the thread is exiting -- Kill : The kill statement is being executed to kill the specified thread +> 表示是否查看其他用户的连接信息 -Other types can refer to [MySQL official website for explanation](https://dev.mysql.com/doc/refman/5.6/en/thread-commands.html) +## Return Value -## Example +| column | Instructions | +|------------------|--------------------------------------| +| CurrentConnected | Whether the connection is current | +| Id | The unique identification of this thread | +| User | The user who started this thread | +| Host | The IP address and port number of the client sending the request are recorded | +| LoginTime | Time to establish a connection | +| Catalog | In which data directory is the command currently executed | +| Db | On which database is the command being executed? If no database is specified, the value is NULL | +| Command | The command that the thread is executing at this moment | +| Time | Time when the previous command is submitted to the current status, in seconds | +| State | State of thread | +| QueryId | ID of the current query statement | +| Info | Generally, the statement executed by the thread is recorded, and only the first 100 characters are displayed by default | -1. View the threads running by the current user +Common Command types are as follows: - ```SQL - SHOW PROCESSLIST - ``` +| column | Instructions | +| -- | -- | +| Query | The thread is executing a statement | +| Sleep | Waiting for the client to send it an execution statement | +| Quit | The thread is exiting | +| Kill | Executing the kill statement | - return +## Access Control Requirements - ``` - MySQL [test]> show full processlist; - +------------------+------+------+-----------------+---------------------+----------+------+---------+------+-------+-----------------------------------+-----------------------+ - | CurrentConnected | Id | User | Host | LoginTime | Catalog | Db | Command | Time | State | QueryId | Info | - +------------------+------+------+-----------------+---------------------+----------+------+---------+------+-------+-----------------------------------+-----------------------+ - | Yes | 0 | root | 127.0.0.1:34650 | 2023-09-06 12:01:02 | internal | test | Query | 0 | OK | c84e397193a54fe7-bbe9bc219318b75e | select 1 | - | | 1 | root | 127.0.0.1:34776 | 2023-09-06 12:01:07 | internal | | Sleep | 29 | EOF | 886ffe2894314f50-8dd73a6ca06699e4 | show full processlist | - +------------------+------+------+-----------------+---------------------+----------+------+---------+------+-------+-----------------------------------+-----------------------+ - ``` +The user who executes this SQL command must have at least the following permissions: -## Keywords +| Privilege | Object | Notes | +|:-------------|:----------|:---------------------------| +| ADMIN | DATABASE | If you want to view the connection information of other users, you need the ADMIN permission | Review Comment: ```suggestion | ADMIN_PRIV | DATABASE | If you want to view the connection information of other users, you need the ADMIN permission | ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org