[Refactor][Doc] add show help doc (#8912)

This commit is contained in:
jiafeng.zhang
2022-04-13 09:49:21 +08:00
committed by GitHub
parent d11698d2de
commit 4462da742f
95 changed files with 3225 additions and 27 deletions

View File

@ -26,10 +26,50 @@ under the License.
## SHOW-ALTER
### Name
SHOW ALTER
### Description
This statement is used to display the execution of various modification tasks currently in progress
```sql
SHOW ALTER [CLUSTER | TABLE [COLUMN | ROLLUP] [FROM db_name]];
````
TABLE COLUMN: show ALTER tasks that modify columns
Support syntax [WHERE TableName|CreateTime|FinishTime|State] [ORDER BY] [LIMIT]
TABLE ROLLUP: Shows the task of creating or deleting a ROLLUP index
If db_name is not specified, the current default db is used
CLUSTER: Displays tasks related to cluster operations (only for administrators! To be implemented...)
### Example
1. Display the task execution of all modified columns of the default db
```sql
SHOW ALTER TABLE COLUMN;
````
2. Display the task execution status of the last modified column of a table
```sql
SHOW ALTER TABLE COLUMN WHERE TableName = "table1" ORDER BY CreateTime DESC LIMIT 1;
````
3. Display the task execution of creating or deleting ROLLUP index for the specified db
```sql
SHOW ALTER TABLE ROLLUP FROM example_db;
````
4. Show tasks related to cluster operations (only for administrators! To be implemented...)
````
SHOW ALTER CLUSTER;
````
### Keywords
SHOW, ALTER

View File

@ -26,8 +26,33 @@ under the License.
## SHOW-BACKENDS
### Name
SHOW BACKENDS
### Description
This statement is used to view the BE nodes in the cluster
```sql
SHOW BACKENDS;
````
illustrate:
1. LastStartTime indicates the last BE start time.
2. LastHeartbeat indicates the last heartbeat.
3. Alive indicates whether the node is alive or not.
4. If SystemDecommissioned is true, it means that the node is being safely decommissioned.
5. If ClusterDecommissioned is true, it means that the node is going offline in the current cluster.
6. TabletNum represents the number of shards on the node.
7. DataUsedCapacity Indicates the space occupied by the actual user data.
8. AvailCapacity Indicates the available space on the disk.
9. TotalCapacity represents the total disk space. TotalCapacity = AvailCapacity + DataUsedCapacity + other non-user data files occupy space.
10. UsedPct Indicates the percentage of disk used.
11. ErrMsg is used to display the error message when the heartbeat fails.
12. Status is used to display some status information of BE in JSON format, including the time information of the last time BE reported its tablet.
### Example
### Keywords

View File

@ -26,10 +26,53 @@ under the License.
## SHOW-BACKUP
### Name
SHOW BACKUP
### Description
This statement is used to view BACKUP tasks
grammar:
```sql
SHOW BACKUP [FROM db_name]
````
illustrate:
1. Only the most recent BACKUP task is saved in Doris.
1. The meaning of each column is as follows:
JobId: Unique job id
SnapshotName: The name of the backup
DbName: belongs to the database
State: current stage
PENDING: The initial state after submitting the job
SNAPSHOTING: Executing snapshot
UPLOAD_SNAPSHOT: Snapshot completed, ready to upload
UPLOADING: Snapshot uploading
SAVE_META: Save job meta information to a local file
UPLOAD_INFO: Upload job meta information
FINISHED: The job was successful
CANCELLED: Job failed
BackupObjs: Backed up tables and partitions
CreateTime: task submission time
SnapshotFinishedTime: Snapshot completion time
UploadFinishedTime: Snapshot upload completion time
FinishedTime: Job finish time
UnfinishedTasks: Displays unfinished subtask ids during SNAPSHOTING and UPLOADING stages
Status: If the job fails, display the failure message
Timeout: Job timeout, in seconds
### Example
1. View the last BACKUP task under example_db.
```sql
SHOW BACKUP FROM example_db;
````
### Keywords
SHOW, BACKUP

View File

@ -26,8 +26,27 @@ under the License.
## SHOW-BROKER
### Name
SHOW BROKER
### Description
This statement is used to view the currently existing broker
grammar:
```sql
SHOW BROKER;
````
illustrate:
1. LastStartTime indicates the last BE start time.
2. LastHeartbeat indicates the last heartbeat.
3. Alive indicates whether the node is alive or not.
4. ErrMsg is used to display the error message when the heartbeat fails.
### Example
### Keywords

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-COLUMNS
### Name
SHOW FULL COLUMNS
### Description
This statement is used to specify the column information of the table
grammar:
```sql
SHOW FULL COLUMNS FROM tbl;
```
### Example
1. View the column information of the specified table
```sql
SHOW FULL COLUMNS FROM tbl;
````
### Keywords
SHOW, COLUMNS

View File

@ -26,10 +26,34 @@ under the License.
## SHOW-CREATE-FUNCTION
### Name
SHOW CREATE FUNTION
### Description
This statement is used to display the creation statement of the user-defined function
grammar:
```sql
SHOW CREATE FUNTION function_name(arg_type [, ...]) [FROM db_name]];
````
illustrate:
1. `function_name`: The name of the function to display
2. `arg_type`: The parameter list of the function to display
3. If db_name is not specified, the current default db is used
### Example
1. Show the creation statement of the specified function under the default db
```sql
SHOW CREATE FUNCTION my_add(INT, INT)
````
### Keywords
SHOW, CREATE, FUNCTION

View File

@ -26,10 +26,35 @@ under the License.
## SHOW-CREATE-ROUTINE-LOAD
### Name
SHOW CREATE ROUTINE LOAD
### Description
This statement is used to demonstrate the creation statement of a routine import job.
The kafka partition and offset in the result show the currently consumed partition and the corresponding offset to be consumed.
grammar:
```sql
SHOW [ALL] CREATE ROUTINE LOAD for load_name;
````
illustrate:
1. `ALL`: optional parameter, which means to get all jobs, including historical jobs
2. `load_name`: routine import job name
### Example
1. Show the creation statement of the specified routine import job under the default db
```sql
SHOW CREATE ROUTINE LOAD for test_load
````
### Keywords
SHOW, CREATE, ROUTINE, LOAD

View File

@ -26,10 +26,33 @@ under the License.
## SHOW-CREATE-TABLE
### Name
SHOW CREATE TABLE
### Description
This statement is used to display the creation statement of the data table.
grammar:
```sql
SHOW CREATE TABLE [DBNAME.]TABLE_NAME
````
illustrate:
1. `DBNAMNE` : database name
2. `TABLE_NAME` : table name
### Example
1. View the table creation statement of a table
```sql
SHOW CREATE TABLE demo.tb1
````
### Keywords
SHOW, CREATE, TABLE

View File

@ -26,10 +26,91 @@ under the License.
## SHOW-DATA
### Name
SHOW DATA
### Description
This statement is used to display the amount of data, the number of replicas, and the number of statistical rows.
grammar:
```sql
SHOW DATA [FROM db_name[.table_name]] [ORDER BY ...];
````
illustrate:
1. If the FROM clause is not specified, the data volume and number of replicas subdivided into each table under the current db will be displayed. The data volume is the total data volume of all replicas. The number of replicas is the number of replicas for all partitions of the table and all materialized views.
2. If the FROM clause is specified, the data volume, number of copies and number of statistical rows subdivided into each materialized view under the table will be displayed. The data volume is the total data volume of all replicas. The number of replicas is the number of replicas for all partitions of the corresponding materialized view. The number of statistical rows is the number of statistical rows for all partitions of the corresponding materialized view.
3. When counting the number of rows, the one with the largest number of rows among the multiple copies shall prevail.
4. The `Total` row in the result set represents the total row. The `Quota` line represents the quota set by the current database. The `Left` line indicates the remaining quota.
5. If you want to see the size of each Partition, see `help show partitions`.
6. You can use ORDER BY to sort on any combination of columns.
### Example
1. Display the data volume, replica number, aggregate data volume and aggregate replica number of each table in the default db.
```sql
SHOW DATA;
````
````
+-----------+-------------+--------------+
| TableName | Size | ReplicaCount |
+-----------+-------------+--------------+
| tbl1 | 900.000 B | 6 |
| tbl2 | 500.000 B | 3 |
| Total | 1.400 KB | 9 |
| Quota | 1024.000 GB | 1073741824 |
| Left | 1021.921 GB | 1073741815 |
+-----------+-------------+--------------+
````
2. Display the subdivided data volume, the number of replicas and the number of statistical rows of the specified table under the specified db
```sql
SHOW DATA FROM example_db.test;
````
````
+-----------+-----------+-----------+--------------+----------+
| TableName | IndexName | Size | ReplicaCount | RowCount |
+-----------+-----------+-----------+--------------+----------+
| test | r1 | 10.000MB | 30 | 10000 |
| | r2 | 20.000MB | 30 | 20000 |
| | test2 | 50.000MB | 30 | 50000 |
| | Total | 80.000 | 90 | |
+-----------+-----------+-----------+--------------+----------+
````
3. It can be combined and sorted according to the amount of data, the number of copies, the number of statistical rows, etc.
```sql
SHOW DATA ORDER BY ReplicaCount desc,Size asc;
````
````
+-----------+-------------+--------------+
| TableName | Size | ReplicaCount |
+-----------+-------------+--------------+
| table_c | 3.102 KB | 40 |
| table_d | .000 | 20 |
| table_b | 324.000 B | 20 |
| table_a | 1.266 KB | 10 |
| Total | 4.684 KB | 90 |
| Quota | 1024.000 GB | 1073741824 |
| Left | 1024.000 GB | 1073741734 |
+-----------+-------------+--------------+
````
### Keywords
SHOW, DATA

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-DATABASE-ID
### Name
SHOW DATABASE ID
### Description
This statement is used to find the corresponding database name according to the database id (only for administrators)
grammar:
```sql
SHOW DATABASE [database_id]
````
### Example
1. Find the corresponding database name according to the database id
```sql
SHOW DATABASE 1001;
````
### Keywords
SHOW, DATABASE, ID

View File

@ -26,8 +26,20 @@ under the License.
## SHOW-DATABASES
### Name
SHOW DATABASES
### Description
This statement is used to display the currently visible db
grammar:
```sql
SHOW DATABASES;
````
### Example
### Keywords

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-DELETE
### Name
SHOW DELETE
### Description
This statement is used to display the historical delete tasks that have been successfully executed
grammar:
```sql
SHOW DELETE [FROM db_name]
````
### Example
1. Display all historical delete tasks of database database
```sql
SHOW DELETE FROM database;
````
### Keywords
SHOW, DELETE

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-DYNAMIC-PARTITION
### Name
SHOW DYNAMIC
### Description
This statement is used to display the status of all dynamic partition tables under the current db
grammar:
```sql
SHOW DYNAMIC PARTITION TABLES [FROM db_name];
````
### Example
1. Display all dynamic partition table status of database database
```sql
SHOW DYNAMIC PARTITION TABLES FROM database;
````
### Keywords
SHOW, DYNAMIC, PARTITION

View File

@ -26,10 +26,47 @@ under the License.
## SHOW-ENCRYPT-KEY
### Name
SHOW ENCRYPTKEYS
### Description
View all custom keys under the database. If the user specifies a database, check the corresponding database, otherwise directly query the database where the current session is located.
Requires `ADMIN` privilege on this database
grammar:
```sql
SHOW ENCRYPTKEYS [IN|FROM db] [LIKE 'key_pattern']
````
parameter
>`db`: database name to query
>`key_pattern`: parameter used to filter key names
### Example
```sql
mysql> SHOW ENCRYPTKEYS;
+-------------------+-------------------+
| EncryptKey Name | EncryptKey String |
+-------------------+-------------------+
| example_db.my_key | ABCD123456789 |
+-------------------+-------------------+
1 row in set (0.00 sec)
mysql> SHOW ENCRYPTKEYS FROM example_db LIKE "%my%";
+-------------------+-------------------+
| EncryptKey Name | EncryptKey String |
+-------------------+-------------------+
| example_db.my_key | ABCD123456789 |
+-------------------+-------------------+
1 row in set (0.00 sec)
````
### Keywords
SHOW, ENCRYPT, KEY

View File

@ -26,10 +26,67 @@ under the License.
## SHOW-EXPORT
### Name
SHOW EXPORT
### Description
This statement is used to display the execution of the specified export task
grammar:
```sql
SHOW EXPORT
[FROM db_name]
[
WHERE
[ID=your_job_id]
[STATE = ["PENDING"|"EXPORTING"|"FINISHED"|"CANCELLED"]]
[LABEL=your_label]
]
[ORDER BY...]
[LIMIT limit];
````
illustrate:
1. If db_name is not specified, the current default db is used
2. If STATE is specified, matches EXPORT state
3. You can use ORDER BY to sort any combination of columns
4. If LIMIT is specified, limit matching records are displayed. Otherwise show all
### Example
1. Show all export tasks of default db
```sql
SHOW EXPORT;
````
2. Display the export tasks of the specified db, sorted by StartTime in descending order
```sql
SHOW EXPORT FROM example_db ORDER BY StartTime DESC;
````
3. Display the export tasks of the specified db, the state is "exporting", and sort by StartTime in descending order
```sql
SHOW EXPORT FROM example_db WHERE STATE = "exporting" ORDER BY StartTime DESC;
````
4. Display the export task of the specified db and specified job_id
```sql
SHOW EXPORT FROM example_db WHERE ID = job_id;
````
5. Display the specified db and specify the export task of the label
```sql
SHOW EXPORT FROM example_db WHERE LABEL = "mylabel";
````
### Keywords
SHOW, EXPORT

View File

@ -26,8 +26,30 @@ under the License.
## SHOW-FRONTENDS
### Name
SHOW FRONTENDS
### Description
This statement is used to view FE nodes
grammar:
```sql
SHOW FRONTENDS;
````
illustrate:
1. name indicates the name of the FE node in bdbje.
2. If Join is true, it means that the node has joined the cluster before. But it does not mean that it is still in the cluster (may have lost contact
3. Alive indicates whether the node is alive or not.
4. ReplayedJournalId indicates the maximum metadata journal id that has been replayed by the node.
5. LastHeartbeat is the last heartbeat.
6. IsHelper indicates whether the node is a helper node in bdbje.
7. ErrMsg is used to display the error message when the heartbeat fails.
### Example
### Keywords

View File

@ -26,10 +26,65 @@ under the License.
## SHOW-FUNCTIONS
### Name
SHOW FUNCTIONS
### Description
View all custom (system-provided) functions under the database. If the user specifies a database, then view the corresponding database, otherwise directly query the database where the current session is located
Requires `SHOW` permission on this database
grammar
```sql
SHOW [FULL] [BUILTIN] FUNCTIONS [IN|FROM db] [LIKE 'function_pattern']
````
Parameters
>`full`: Indicates the detailed information of the display function
>`builtin`: Indicates the functions provided by the display system
>`db`: database name to query
>`function_pattern`: parameter used to filter function names
### Example
````sql
mysql> show full functions in testDb\G
**************************** 1. row ******************** ******
Signature: my_add(INT,INT)
Return Type: INT
Function Type: Scalar
Intermediate Type: NULL
Properties: {"symbol":"_ZN9doris_udf6AddUdfEPNS_15FunctionContextERKNS_6IntValES4_","object_file":"http://host:port/libudfsample.so","md5":"cfe7a362d10f3aaf6c49974ee0f1f878"}
**************************** 2. row ******************** ******
Signature: my_count(BIGINT)
Return Type: BIGINT
Function Type: Aggregate
Intermediate Type: NULL
Properties: { "object_file": "http: // host: port / libudasample.so", "finalize_fn": "_ZN9doris_udf13CountFinalizeEPNS_15FunctionContextERKNS_9BigIntValE", "init_fn": "_ZN9doris_udf9CountInitEPNS_15FunctionContextEPNS_9BigIntValE", "merge_fn": "_ZN9doris_udf10CountMergeEPNS_15FunctionContextERKNS_9BigIntValEPS2_", "md5": " 37d185f80f95569e2676da3d5b5b9d2f","update_fn":"_ZN9doris_udf11CountUpdateEPNS_15FunctionContextERKNS_6IntValEPNS_9BigIntValE"}
**************************** 3. row ******************** ******
Signature: id_masking(BIGINT)
Return Type: VARCHAR
Function Type: Alias
Intermediate Type: NULL
Properties: {"parameter":"id","origin_function":"concat(left(`id`, 3), `****`, right(`id`, 4))"}
3 rows in set (0.00 sec)
mysql> show builtin functions in testDb like 'year%';
+---------------+
| Function Name |
+---------------+
| year |
| years_add |
| years_diff |
| years_sub |
+---------------+
2 rows in set (0.00 sec)
````
### Keywords
SHOW, FUNCTIONS

View File

@ -26,10 +26,46 @@ under the License.
## SHOW-GRANTS
### Name
SHOW GRANTS
### Description
This statement is used to view user permissions.
grammar:
```sql
SHOW [ALL] GRANTS [FOR user_identity];
```
illustrate:
1. SHOW ALL GRANTS can view the permissions of all users.
2. If user_identity is specified, view the permissions of the specified user. And the user_identity must be created by the CREATE USER command.
3. If user_identity is not specified, view the permissions of the current user.
### Example
1. View all user permission information
```sql
SHOW ALL GRANTS;
````
2. View the permissions of the specified user
```sql
SHOW GRANTS FOR jack@'%';
````
3. View the permissions of the current user
```sql
SHOW GRANTS;
````
### Keywords
SHOW, GRANTS

View File

@ -26,10 +26,30 @@ under the License.
## SHOW-INDEX
### Name
SHOW INDEX
### Description
This statement is used to display information about indexes in a table. Currently, only bitmap indexes are supported.
grammar:
````SQL
SHOW INDEX[ES] FROM [db_name.]table_name [FROM database];
or
SHOW KEY[S] FROM [db_name.]table_name [FROM database];
````
### Example
1. Display the lower index of the specified table_name
````SQL
SHOW INDEX FROM example_db.table_name;
````
### Keywords
SHOW, INDEX

View File

@ -0,0 +1,76 @@
---
{
"title": "SHOW-LAST-INSERT",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## SHOW-LAST-INSERT
### Name
SHOW LAST INSERT
### Description
This syntax is used to view the result of the latest insert operation in the current session connection
grammar:
```sql
SHOW LAST INSERT
````
Example of returned result:
````
TransactionId: 64067
Label: insert_ba8f33aea9544866-8ed77e2844d0cc9b
Database: default_cluster:db1
Table: t1
TransactionStatus: VISIBLE
LoadedRows: 2
FilteredRows: 0
````
illustrate:
* TransactionId: transaction id
* Label: the label corresponding to the insert task
* Database: the database corresponding to insert
* Table: the table corresponding to insert
* TransactionStatus: transaction status
* PREPARE: preparation stage
* PRECOMMITTED: Pre-commit stage
* COMMITTED: The transaction succeeded, but the data was not visible
* VISIBLE: The transaction succeeded and the data is visible
* ABORTED: Transaction failed
* LoadedRows: Number of imported rows
* FilteredRows: The number of rows being filtered
### Example
SHOW, LASR ,INSERT
### Best Practice

View File

@ -26,10 +26,89 @@ under the License.
## SHOW-LOAD
### Name
SHOW LOAD
### Description
This statement is used to display the execution of the specified import task
grammar:
```sql
SHOW LOAD
[FROM db_name]
[
WHERE
[LABEL [ = "your_label" | LIKE "label_matcher"]]
[STATE = ["PENDING"|"ETL"|"LOADING"|"FINISHED"|"CANCELLED"|]]
]
[ORDER BY...]
[LIMIT limit][OFFSET offset];
````
illustrate:
1. If db_name is not specified, the current default db is used
2. If LABEL LIKE is used, it will match import tasks whose label contains label_matcher
3. If LABEL = is used, it will match the specified label exactly
4. If STATE is specified, matches the LOAD state
5. You can use ORDER BY to sort on any combination of columns
6. If LIMIT is specified, limit matching records are displayed. Otherwise show all
7. If OFFSET is specified, the query results are displayed starting at offset offset. By default the offset is 0.
8. If you are using broker/mini load, the connections in the URL column can be viewed using the following command:
```sql
SHOW LOAD WARNINGS ON 'url'
````
### Example
1. Show all import tasks for default db
```sql
SHOW LOAD;
````
2. Display the import tasks of the specified db, the label contains the string "2014_01_02", and display the oldest 10
```sql
SHOW LOAD FROM example_db WHERE LABEL LIKE "2014_01_02" LIMIT 10;
````
3. Display the import tasks of the specified db, specify the label as "load_example_db_20140102" and sort by LoadStartTime in descending order
```sql
SHOW LOAD FROM example_db WHERE LABEL = "load_example_db_20140102" ORDER BY LoadStartTime DESC;
````
4. Display the import task of the specified db, specify the label as "load_example_db_20140102", the state as "loading", and sort by LoadStartTime in descending order
```sql
SHOW LOAD FROM example_db WHERE LABEL = "load_example_db_20140102" AND STATE = "loading" ORDER BY LoadStartTime DESC;
````
5. Display the import tasks of the specified db and sort them in descending order by LoadStartTime, and display 10 query results starting from offset 5
```sql
SHOW LOAD FROM example_db ORDER BY LoadStartTime DESC limit 5,10;
SHOW LOAD FROM example_db ORDER BY LoadStartTime DESC limit 10 offset 5;
````
6. Small batch import is a command to check the import status
````
curl --location-trusted -u {user}:{passwd} http://{hostname}:{port}/api/{database}/_load_info?label={labelname}
````
### Keywords
SHOW, LOAD

View File

@ -26,8 +26,20 @@ under the License.
## SHOW-MIGRATIONS
### Name
SHOW MIGRATIONS
### Description
This statement is used to view the progress of database migration
grammar:
```sql
SHOW MIGRATIONS
````
### Example
### Keywords

View File

@ -26,10 +26,27 @@ under the License.
## SHOW-PARTITION-ID
### Name
SHOW PARTITION ID
### Description
This statement is used to find the corresponding database name, table name, partition name according to the partition id (only for administrators)
grammar:
```sql
SHOW PARTITION [partition_id]
```
### Example
1. Find the corresponding database name, table name, partition name according to the partition id
```sql
SHOW PARTITION 10002;
````
### Keywords
SHOW, PARTITION, ID

View File

@ -26,10 +26,51 @@ under the License.
## SHOW-PARTITIONS
### Name
SHOW PARTITIONS
### Description
This statement is used to display partition information
grammar:
````SQL
SHOW [TEMPORARY] PARTITIONS FROM [db_name.]table_name [WHERE] [ORDER BY] [LIMIT];
````
illustrate:
1. Support the filtering of PartitionId, PartitionName, State, Buckets, ReplicationNum, LastConsistencyCheckTime and other columns
2. TEMPORARY specifies to list temporary partitions
### Example
1. Display all non-temporary partition information of the specified table under the specified db
````SQL
SHOW PARTITIONS FROM example_db.table_name;
````
2. Display all temporary partition information of the specified table under the specified db
````SQL
SHOW TEMPORARY PARTITIONS FROM example_db.table_name;
````
3. Display the information of the specified non-temporary partition of the specified table under the specified db
````SQL
SHOW PARTITIONS FROM example_db.table_name WHERE PartitionName = "p1";
````
4. Display the latest non-temporary partition information of the specified table under the specified db
````SQL
SHOW PARTITIONS FROM example_db.table_name ORDER BY PartitionId DESC LIMIT 1;
````
### Keywords
SHOW, PARTITIONS

View File

@ -26,10 +26,30 @@ under the License.
## SHOW-PLUGINS
### Name
SHOW PLUGINS
### Description
This statement is used to display installed plugins
grammar:
````SQL
SHOW PLUGINS
````
This command will display all user-installed and system built-in plugins
### Example
1. Show installed plugins:
````SQL
SHOW PLUGINS;
````
### Keywords
SHOW, PLUGINS

View File

@ -26,10 +26,40 @@ under the License.
## SHOW-PROCESSLIST
### Name
SHOW PROCESSLIST
### 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.
grammar:
```sql
SHOW [FULL] PROCESSLIST
````
illustrate:
- 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. Earlier we said that the information displayed by show processlist comes from the information_schema.processlist table, so this Id is the primary key of this table.
- 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.
- Cluster: Cluster 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. This is very complicated, and is explained separately below
- Time: Indicates the time the thread is in the current state.
- State: The state of the thread, corresponding to Command, explained separately below.
- 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.
### Example
1. View the threads running by the current user
````SQL
SHOW PROCESSLIST
````
### Keywords
SHOW, PROCESSLIST

View File

@ -47,9 +47,9 @@ Return result description:
```sql
mysql> show property like'%connection%';
+----------------------+-------+
| Key | Value |
| Key | Value |
+----------------------+-------+
| max_user_connections | 100 |
| max_user_connections | 100 |
+----------------------+-------+
1 row in set (0.01 sec)
```

View File

@ -26,10 +26,39 @@ under the License.
## SHOW-REPOSITORIES
### Name
SHOW REPOSITORIES
### Description
This statement is used to view the currently created warehouse
grammar:
```sql
SHOW REPOSITORIES;
````
illustrate:
1. The meanings of the columns are as follows:
RepoId: Unique repository ID
RepoName: repository name
CreateTime: The time when the repository was first created
IsReadOnly: Whether it is a read-only repository
Location: The root directory in the warehouse for backing up data
Broker: Dependent Broker
ErrMsg: Doris will regularly check the connectivity of the warehouse, if there is a problem, an error message will be displayed here
### Example
1. View the created repository:
```sql
SHOW REPOSITORIES;
````
### Keywords
SHOW, REPOSITORIES

View File

@ -26,10 +26,56 @@ under the License.
## SHOW-RESOURCES
### Name
SHOW RESOURCES
### Description
This statement is used to display resources that the user has permission to use. Ordinary users can only display resources with permission, and root or admin users will display all resources.
grammar:
```sql
SHOW RESOURCES
[
WHERE
[NAME [ = "your_resource_name" | LIKE "name_matcher"]]
[RESOURCETYPE = ["SPARK"]]
]
[ORDER BY...]
[LIMIT limit][OFFSET offset];
````
illustrate:
1. If NAME LIKE is used, it will match Resource whose Name contains name_matcher in RESOURCES
2. If NAME = is used, it will match the specified Name exactly
3. If RESOURCETYPE is specified, match the corresponding Resrouce type
4. You can use ORDER BY to sort on any combination of columns
5. If LIMIT is specified, limit matching records are displayed. Otherwise show all
6. If OFFSET is specified, the query results are displayed starting at offset offset. By default the offset is 0.
### Example
1. Display all resources that the current user has permissions to
```sql
SHOW RESOURCES;
````
1. Display the specified Resource, the name contains the string "20140102", and display 10 attributes
```sql
SHOW RESOURCES WHERE NAME LIKE "2014_01_02" LIMIT 10;
````
1. Display the specified Resource, specify the name as "20140102" and sort by KEY in descending order
```sql
SHOW RESOURCES WHERE NAME = "20140102" ORDER BY `KEY` DESC;
````
### Keywords
SHOW, RESOURCES

View File

@ -26,10 +26,56 @@ under the License.
## SHOW-RESTORE
### Name
SHOW RESTORE
### Description
This statement is used to view RESTORE tasks
grammar:
````SQL
SHOW RESTORE [FROM DB_NAME]
````
illustrate:
1. Only the most recent RESTORE task is saved in Doris.
2. The meaning of each column is as follows:
JobId: Unique job id
Label: The name of the backup to restore
Timestamp: The time version of the backup to restore
DbName: belongs to the database
State: current stage
PENDING: The initial state after submitting the job
SNAPSHOTING: Executing snapshot
DOWNLOAD: The snapshot is complete, ready to download the snapshot in the repository
DOWNLOADING: Snapshot downloading
COMMIT: Snapshot download is complete, ready to take effect
COMMITING: in effect
FINISHED: The job was successful
CANCELLED: Job failed
AllowLoad: Whether to allow import when restoring (currently not supported)
ReplicationNum: Specifies the number of replicas to restore
RestoreJobs: Tables and partitions to restore
CreateTime: task submission time
MetaPreparedTime: Metadata preparation completion time
SnapshotFinishedTime: Snapshot completion time
DownloadFinishedTime: Snapshot download completion time
FinishedTime: Job finish time
UnfinishedTasks: Displays unfinished subtask ids during SNAPSHOTING, DOWNLOADING and COMMITING stages
Status: If the job fails, display the failure message
Timeout: Job timeout, in seconds
### Example
1. View the latest RESTORE task under example_db.
```sql
SHOW RESTORE FROM example_db;
````
### Keywords
SHOW, RESTORE

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-ROLES
### Name
SHOW ROLES
### Description
This statement is used to display all created role information, including role name, included users and permissions.
grammar:
````SQL
SHOW ROLES
````
### Example
1. View created roles
````SQL
SHOW ROLES
````
### Keywords
SHOW, ROLES

View File

@ -26,13 +26,58 @@ under the License.
## SHOW-ROUTINE-LOAD-TASK
### Name
SHOW ROUTINE LOAD TASK
### Description
View the currently running subtasks of a specified Routine Load job.
```sql
SHOW ROUTINE LOAD TASK
WHERE JobName = "job_name";
````
The returned results are as follows:
````text
TaskId: d67ce537f1be4b86-abf47530b79ab8e6
TxnId: 4
TxnStatus: UNKNOWN
JobId: 10280
CreateTime: 2020-12-12 20:29:48
ExecuteStartTime: 2020-12-12 20:29:48
Timeout: 20
BeId: 10002
DataSourceProperties: {"0":19}
````
- `TaskId`: The unique ID of the subtask.
- `TxnId`: The import transaction ID corresponding to the subtask.
- `TxnStatus`: The import transaction status corresponding to the subtask. Usually UNKNOWN. No real meaning.
- `JobId`: The job ID corresponding to the subtask.
- `CreateTime`: The creation time of the subtask.
- `ExecuteStartTime`: The time when the subtask is scheduled to be executed, usually later than the creation time.
- `Timeout`: Subtask timeout, usually twice the `MaxIntervalS` set by the job.
- `BeId`: The ID of the BE node executing this subtask.
- `DataSourceProperties`: The starting offset of the Kafka Partition that the subtask is ready to consume. is a Json format string. Key is Partition Id. Value is the starting offset of consumption.
### Example
1. Display the subtask information of the routine import task named test1.
```sql
SHOW ROUTINE LOAD TASK WHERE JobName = "test1";
````
### Keywords
SHOW, ROUTINE, LOAD, TASK
### Best Practice
With this command, you can view how many subtasks are currently running in a Routine Load job, and which BE node is running on.

View File

@ -26,10 +26,101 @@ under the License.
## SHOW-ROUTINE-LOAD
### Name
SHOW ROUTINE LOAD
### Description
This statement is used to display the running status of the Routine Load job
grammar:
```sql
SHOW [ALL] ROUTINE LOAD [FOR jobName];
````
Result description:
````
Id: job ID
Name: job name
CreateTime: job creation time
PauseTime: The last job pause time
EndTime: Job end time
DbName: corresponding database name
TableName: corresponding table name
State: job running state
DataSourceType: Data source type: KAFKA
CurrentTaskNum: The current number of subtasks
JobProperties: Job configuration details
DataSourceProperties: Data source configuration details
CustomProperties: custom configuration
Statistic: Job running status statistics
Progress: job running progress
Lag: job delay status
ReasonOfStateChanged: The reason for the job state change
ErrorLogUrls: The viewing address of the filtered unqualified data
OtherMsg: other error messages
````
* State
There are the following 4 states:
* NEED_SCHEDULE: The job is waiting to be scheduled
* RUNNING: The job is running
* PAUSED: The job is paused
* STOPPED: The job has ended
* CANCELLED: The job was canceled
* Progress
For Kafka data sources, displays the currently consumed offset for each partition. For example, {"0":"2"} indicates that the consumption progress of Kafka partition 0 is 2.
*Lag
For Kafka data sources, shows the consumption latency of each partition. For example, {"0":10} means that the consumption delay of Kafka partition 0 is 10.
### Example
1. Show all routine import jobs named test1 (including stopped or canceled jobs). The result is one or more lines.
```sql
SHOW ALL ROUTINE LOAD FOR test1;
````
2. Show the currently running routine import job named test1
```sql
SHOW ROUTINE LOAD FOR test1;
````
3. Display all routine import jobs (including stopped or canceled jobs) under example_db. The result is one or more lines.
```sql
use example_db;
SHOW ALL ROUTINE LOAD;
````
4. Display all running routine import jobs under example_db
```sql
use example_db;
SHOW ROUTINE LOAD;
````
5. Display the currently running routine import job named test1 under example_db
```sql
SHOW ROUTINE LOAD FOR example_db.test1;
````
6. Displays all routine import jobs named test1 under example_db (including stopped or canceled jobs). The result is one or more lines.
```sql
SHOW ALL ROUTINE LOAD FOR example_db.test1;
````
### Keywords
SHOW, ROUTINE, LOAD

View File

@ -26,10 +26,35 @@ under the License.
## SHOW-SMALL-FILES
### Name
SHOW FILE
### Description
This statement is used to display files created by the CREATE FILE command within a database.
```sql
SHOW FILE [FROM database];
````
Return result description:
- FileId: file ID, globally unique
- DbName: the name of the database to which it belongs
- Catalog: Custom Category
- FileName: file name
- FileSize: file size in bytes
- MD5: MD5 of the file
### Example
1. View the uploaded files in the database my_database
```sql
SHOW FILE FROM my_database;
````
### Keywords
SHOW, SMALL, FILES

View File

@ -26,10 +26,52 @@ under the License.
## SHOW-SNAPSHOT
### Name
SHOW SNAPSHOT
### Description
This statement is used to view backups that already exist in the repository.
grammar:
```sql
SHOW SNAPSHOT ON `repo_name`
[WHERE SNAPSHOT = "snapshot" [AND TIMESTAMP = "backup_timestamp"]];
````
illustrate:
1. The meanings of the columns are as follows:
Snapshot: The name of the backup
Timestamp: corresponds to the time version of the backup
Status: If the backup is normal, it will display OK, otherwise it will display an error message
2. If TIMESTAMP is specified, the following additional information is displayed:
Database: The name of the database to which the backup data originally belonged
Details: In the form of Json, the data directory and file structure of the entire backup are displayed
### Example
1. View the existing backups in the repository example_repo
```sql
SHOW SNAPSHOT ON example_repo;
````
2. View only the backup named backup1 in the repository example_repo:
```sql
SHOW SNAPSHOT ON example_repo WHERE SNAPSHOT = "backup1";
````
3. View the details of the backup named backup1 in the warehouse example_repo with the time version "2018-05-05-15-34-26":
```sql
SHOW SNAPSHOT ON example_repo
WHERE SNAPSHOT = "backup1" AND TIMESTAMP = "2018-05-05-15-34-26";
````
### Keywords
SHOW, SNAPSHOT

View File

@ -1,6 +1,6 @@
---
{
"title": "SHOW-STATUS",
"title": "SHOW ALTER TABLE MATERIALIZED VIEW",
"language": "en"
}
---
@ -24,15 +24,97 @@ specific language governing permissions and limitations
under the License.
-->
## SHOW-STATUS
## SHOW ALTER TABLE MATERIALIZED VIEW
### Name
SHOW ALTER TABLE MATERIALIZED VIEW
### Description
This command is used to view the execution of the Create Materialized View job submitted through the [CREATE-MATERIALIZED-VIEW](../../sql-manual/sql-reference-v2/Data-Definition-Statements/Create/CREATE-MATERIALIZED-VIEW.html) statement.
> This statement is equivalent to `SHOW ALTER TABLE ROLLUP`;
```sql
SHOW ALTER TABLE MATERIALIZED VIEW
[FROM database]
[WHERE]
[ORDER BY]
[LIMIT OFFSET]
````
- database: View jobs under the specified database. If not specified, the current database is used.
- WHERE: You can filter the result column, currently only the following columns are supported:
- TableName: Only equal value filtering is supported.
- State: Only supports equivalent filtering.
- Createtime/FinishTime: Support =, >=, <=, >, <, !=
- ORDER BY: The result set can be sorted by any column.
- LIMIT: Use ORDER BY to perform page-turning query.
Return result description:
```sql
mysql> show alter table materialized view\G
**************************** 1. row ******************** ******
JobId: 11001
TableName: tbl1
CreateTime: 2020-12-23 10:41:00
FinishTime: NULL
BaseIndexName: tbl1
RollupIndexName: r1
RollupId: 11002
TransactionId: 5070
State: WAITING_TXN
Msg:
Progress: NULL
Timeout: 86400
1 row in set (0.00 sec)
````
- `JobId`: Job unique ID.
- `TableName`: base table name
- `CreateTime/FinishTime`: Job creation time and end time.
- `BaseIndexName/RollupIndexName`: Base table name and materialized view name.
- `RollupId`: The unique ID of the materialized view.
- `TransactionId`: See the description of the State field.
- `State`: job status.
- PENDING: The job is in preparation.
- WAITING_TXN:
Before officially starting to generate materialized view data, it will wait for the current running import transaction on this table to complete. And the `TransactionId` field is the current waiting transaction ID. When all previous imports for this ID are complete, the job will actually start.
- RUNNING: The job is running.
- FINISHED: The job ran successfully.
- CANCELLED: The job failed to run.
- `Msg`: error message
- `Progress`: job progress. The progress here means `completed tablets/total tablets`. Materialized views are created at tablet granularity.
- `Timeout`: Job timeout, in seconds.
### Example
1. View the materialized view jobs under the database example_db
```sql
SHOW ALTER TABLE MATERIALIZED VIEW FROM example_db;
````
### Keywords
SHOW, STATUS
SHOW, ALTER, TABLE, MATERIALIZED, VIEW
### Best Practice

View File

@ -26,10 +26,71 @@ under the License.
## SHOW-STREAM-LOAD
### Name
SHOW STREAM LOAD
### Description
This statement is used to display the execution of the specified Stream Load task
grammar:
```sql
SHOW STREAM LOAD
[FROM db_name]
[
WHERE
[LABEL [ = "your_label" | LIKE "label_matcher"]]
[STATUS = ["SUCCESS"|"FAIL"]]
]
[ORDER BY...]
[LIMIT limit][OFFSET offset];
````
illustrate:
1. If db_name is not specified, the current default db is used
2. If LABEL LIKE is used, it will match the tasks whose label of the Stream Load task contains label_matcher
3. If LABEL = is used, it will match the specified label exactly
4. If STATUS is specified, matches STREAM LOAD status
5. You can use ORDER BY to sort on any combination of columns
6. If LIMIT is specified, limit matching records are displayed. Otherwise show all
7. If OFFSET is specified, the query results are displayed starting at offset offset. By default the offset is 0.
### Example
1. Show all Stream Load tasks of the default db
```sql
SHOW STREAM LOAD;
````
2. Display the Stream Load task of the specified db, the label contains the string "2014_01_02", and display the oldest 10
```sql
SHOW STREAM LOAD FROM example_db WHERE LABEL LIKE "2014_01_02" LIMIT 10;
````
3. Display the Stream Load task of the specified db and specify the label as "load_example_db_20140102"
```sql
SHOW STREAM LOAD FROM example_db WHERE LABEL = "load_example_db_20140102";
````
4. Display the Stream Load task of the specified db, specify the status as "success", and sort by StartTime in descending order
```sql
SHOW STREAM LOAD FROM example_db WHERE STATUS = "success" ORDER BY StartTime DESC;
````
5. Display the import tasks of the specified db and sort them in descending order of StartTime, and display 10 query results starting from offset 5
```sql
SHOW STREAM LOAD FROM example_db ORDER BY StartTime DESC limit 5,10;
SHOW STREAM LOAD FROM example_db ORDER BY StartTime DESC limit 10 offset 5;
````
### Keywords
SHOW, STREAM, LOAD

View File

@ -28,10 +28,34 @@ under the License.
## SHOW-SYNC-JOB
### Name
SHOW SYNC JOB
### Description
This command is used to currently display the status of resident data synchronization jobs in all databases.
grammar:
```sql
SHOW SYNC JOB [FROM db_name]
````
### Example
1. Display the status of all data synchronization jobs in the current database.
```sql
SHOW SYNC JOB;
````
2. Display the status of all data synchronization jobs under the database `test_db`.
```sql
SHOW SYNC JOB FROM `test_db`;
````
### Keywords
SHOW, SYNC, JOB

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-TABLE-ID
### Name
SHOW TABLE ID
### Description
This statement is used to find the corresponding database name, table name according to the table id (only for administrators)
grammar:
```sql
SHOW TABLE [table_id]
````
### Example
1. Find the corresponding database name, table name according to the table id
```sql
SHOW TABLE 10001;
````
### Keywords
SHOW, TABLE, ID

View File

@ -26,10 +26,39 @@ under the License.
## SHOW-TABLE-STATUS
### Name
SHOW TABLE STATUS
### Description
This statement is used to view some information about the Table.
grammar:
```sql
SHOW TABLE STATUS
[FROM db] [LIKE "pattern"]
````
illustrate:
1. This statement is mainly used to be compatible with MySQL syntax, currently only a small amount of information such as Comment is displayed
### Example
1. View the information of all tables under the current database
```sql
SHOW TABLE STATUS;
````
2. View the information of the table whose name contains example under the specified database
```sql
SHOW TABLE STATUS FROM db LIKE "%example%";
````
### Keywords
SHOW, TABLE, STATUS

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-TABLET
### Name
SHOW TABLET
### Description
This statement is used to display the specified tablet id information (only for administrators)
grammar:
```sql
SHOW TABLET tablet_id
````
### Example
1. Display the parent-level id information of the tablet with the specified tablet id of 10000
```sql
SHOW TABLET 10000;
````
### Keywords
SHOW, TABLET

View File

@ -26,10 +26,78 @@ under the License.
## SHOW-TRANSACTION
### Name
SHOW TRANSACTION
### Description
This syntax is used to view transaction details for the specified transaction id or label.
grammar:
```sql
SHOW TRANSACTION
[FROM db_name]
WHERE
[id=transaction_id]
[label = label_name];
````
Example of returned result:
````
TransactionId: 4005
Label: insert_8d807d5d-bcdd-46eb-be6d-3fa87aa4952d
Coordinator: FE: 10.74.167.16
TransactionStatus: VISIBLE
LoadJobSourceType: INSERT_STREAMING
PrepareTime: 2020-01-09 14:59:07
CommitTime: 2020-01-09 14:59:09
FinishTime: 2020-01-09 14:59:09
Reason:
ErrorReplicasCount: 0
ListenerId: -1
TimeoutMs: 300000
````
* TransactionId: transaction id
* Label: the label corresponding to the import task
* Coordinator: The node responsible for transaction coordination
* TransactionStatus: transaction status
* PREPARE: preparation stage
* COMMITTED: The transaction succeeded, but the data was not visible
* VISIBLE: The transaction succeeded and the data is visible
* ABORTED: Transaction failed
* LoadJobSourceType: Type of import job.
* PrepareTime: transaction start time
* CommitTime: The time when the transaction was successfully committed
* FinishTime: The time when the data is visible
* Reason: error message
* ErrorReplicasCount: The number of replicas with errors
* ListenerId: The id of the related import job
* TimeoutMs: Transaction timeout, in milliseconds
### Example
1. View the transaction with id 4005:
```sql
SHOW TRANSACTION WHERE ID=4005;
````
2. In the specified db, view the transaction with id 4005:
```sql
SHOW TRANSACTION FROM db WHERE ID=4005;
````
3. View the transaction whose label is label_name:
```sql
SHOW TRANSACTION WHERE LABEL = 'label_name';
````
### Keywords
SHOW, TRANSACTION

View File

@ -26,10 +26,48 @@ under the License.
## SHOW-VARIABLES
### Name
SHOW VARIABLES
### Description
The modified statement is used to display Doris system variables, which can be queried by conditions
grammar:
````sql
SHOW [GLOBAL | SESSION] VARIABLES
[LIKE 'pattern' | WHERE expr]
````
illustrate:
- 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.
- Use the like statement to match with variable_name.
- The % percent wildcard can be used anywhere in the matching pattern
### Example
1. The default here is to match the Variable_name, here is the exact match
```sql
show variables like 'max_connections';
````
2. Matching through the percent sign (%) wildcard can match multiple items
```sql
show variables like '%connec%';
````
3. Use the Where clause for matching queries
```sql
show variables where variable_name = 'version';
````
### Keywords
SHOW, VARIABLES

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-VIEW
### Name
SHOW VIEW
### Description
This statement is used to display all views based on the given table
grammar:
```sql
SHOW VIEW { FROM | IN } table [ FROM db ]
````
### Example
1. Show all views created based on table testTbl
```sql
SHOW VIEW FROM testTbl;
````
### Keywords
SHOW, VIEW

View File

@ -0,0 +1,120 @@
---
{
"title": "SHOW ALTER TABLE MATERIALIZED VIEW",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## SHOW ALTER TABLE MATERIALIZED VIEW
### Name
SHOW ALTER TABLE MATERIALIZED VIEW
### Description
该命令用于查看通过 [CREATE-MATERIALIZED-VIEW](../../sql-manual/sql-reference-v2/Data-Definition-Statements/Create/CREATE-MATERIALIZED-VIEW.html) 语句提交的创建物化视图作业的执行情况。
> 该语句等同于 `SHOW ALTER TABLE ROLLUP`;
```sql
SHOW ALTER TABLE MATERIALIZED VIEW
[FROM database]
[WHERE]
[ORDER BY]
[LIMIT OFFSET]
```
- database:查看指定数据库下的作业。如不指定,使用当前数据库。
- WHERE:可以对结果列进行筛选,目前仅支持对以下列进行筛选:
- TableName:仅支持等值筛选。
- State:仅支持等值筛选。
- Createtime/FinishTime:支持 =,>=,<=,>,<,!=
- ORDER BY:可以对结果集按任意列进行排序。
- LIMIT:配合 ORDER BY 进行翻页查询。
返回结果说明:
```sql
mysql> show alter table materialized view\G
*************************** 1. row ***************************
JobId: 11001
TableName: tbl1
CreateTime: 2020-12-23 10:41:00
FinishTime: NULL
BaseIndexName: tbl1
RollupIndexName: r1
RollupId: 11002
TransactionId: 5070
State: WAITING_TXN
Msg:
Progress: NULL
Timeout: 86400
1 row in set (0.00 sec)
```
- `JobId`:作业唯一ID。
- `TableName`:基表名称
- `CreateTime/FinishTime`:作业创建时间和结束时间。
- `BaseIndexName/RollupIndexName`:基表名称和物化视图名称。
- `RollupId`:物化视图的唯一 ID。
- `TransactionId`:见 State 字段说明。
- `State`:作业状态。
- PENDING:作业准备中。
- WAITING_TXN:
在正式开始产生物化视图数据前,会等待当前这个表上的正在运行的导入事务完成。而 `TransactionId` 字段就是当前正在等待的事务ID。当这个ID之前的导入都完成后,就会实际开始作业。
- RUNNING:作业运行中。
- FINISHED:作业运行成功。
- CANCELLED:作业运行失败。
- `Msg`:错误信息
- `Progress`:作业进度。这里的进度表示 `已完成的tablet数量/总tablet数量`。创建物化视图是按 tablet 粒度进行的。
- `Timeout`:作业超时时间,单位秒。
### Example
1. 查看数据库 example_db 下的物化视图作业
```sql
SHOW ALTER TABLE MATERIALIZED VIEW FROM example_db;
```
### Keywords
SHOW, ALTER, TABLE, MATERIALIZED, VIEW
### Best Practice

View File

@ -3,6 +3,7 @@
"title": "SHOW-ALTER",
"language": "zh-CN"
}
---
<!--
@ -26,13 +27,54 @@ under the License.
## SHOW-ALTER
### Name
SHOW ALTER
### Description
该语句用于展示当前正在进行的各类修改任务的执行情况
```sql
SHOW ALTER [CLUSTER | TABLE [COLUMN | ROLLUP] [FROM db_name]];
```
说明:
1. TABLE COLUMN:展示修改列的 ALTER 任务
2. 支持语法[WHERE TableName|CreateTime|FinishTime|State] [ORDER BY] [LIMIT]
3. TABLE ROLLUP:展示创建或删除 ROLLUP index 的任务
4. 如果不指定 db_name,使用当前默认 db
5. CLUSTER: 展示集群操作相关任务情况(仅管理员使用!待实现...)
### Example
1. 展示默认 db 的所有修改列的任务执行情况
```sql
SHOW ALTER TABLE COLUMN;
```
2. 展示某个表最近一次修改列的任务执行情况
```sql
SHOW ALTER TABLE COLUMN WHERE TableName = "table1" ORDER BY CreateTime DESC LIMIT 1;
```
3. 展示指定 db 的创建或删除 ROLLUP index 的任务执行情况
```sql
SHOW ALTER TABLE ROLLUP FROM example_db;
```
4. 展示集群操作相关任务(仅管理员使用!待实现...)
```
SHOW ALTER CLUSTER;
```
### Keywords
SHOW, ALTER
### Best Practice

View File

@ -26,8 +26,33 @@ under the License.
## SHOW-BACKENDS
### Name
SHOW BACKENDS
### Description
该语句用于查看 cluster 内的 BE 节点
```sql
SHOW BACKENDS;
```
说明:
1. LastStartTime 表示最近一次 BE 启动时间。
2. LastHeartbeat 表示最近一次心跳。
3. Alive 表示节点是否存活。
4. SystemDecommissioned 为 true 表示节点正在安全下线中。
5. ClusterDecommissioned 为 true 表示节点正在冲当前cluster中下线。
6. TabletNum 表示该节点上分片数量。
7. DataUsedCapacity 表示实际用户数据所占用的空间。
8. AvailCapacity 表示磁盘的可使用空间。
9. TotalCapacity 表示总磁盘空间。TotalCapacity = AvailCapacity + DataUsedCapacity + 其他非用户数据文件占用空间。
10. UsedPct 表示磁盘已使用量百分比。
11. ErrMsg 用于显示心跳失败时的错误信息。
12. Status 用于以 JSON 格式显示BE的一些状态信息, 目前包括最后一次BE汇报其tablet的时间信息。
### Example
### Keywords

View File

@ -26,10 +26,53 @@ under the License.
## SHOW-BACKUP
### Name
SHOW BACKUP
### Description
该语句用于查看 BACKUP 任务
语法:
```sql
SHOW BACKUP [FROM db_name]
```
说明:
1. Doris 中仅保存最近一次 BACKUP 任务。
2. 各列含义如下:
JobId: 唯一作业id
SnapshotName: 备份的名称
DbName: 所属数据库
State: 当前阶段
PENDING: 提交作业后的初始状态
SNAPSHOTING: 执行快照中
UPLOAD_SNAPSHOT:快照完成,准备上传
UPLOADING: 快照上传中
SAVE_META: 将作业元信息保存为本地文件
UPLOAD_INFO: 上传作业元信息
FINISHED: 作业成功
CANCELLED: 作业失败
BackupObjs: 备份的表和分区
CreateTime: 任务提交时间
SnapshotFinishedTime: 快照完成时间
UploadFinishedTime: 快照上传完成时间
FinishedTime: 作业结束时间
UnfinishedTasks: 在 SNAPSHOTING 和 UPLOADING 阶段会显示还未完成的子任务id
Status: 如果作业失败,显示失败信息
Timeout: 作业超时时间,单位秒
### Example
1. 查看 example_db 下最后一次 BACKUP 任务。
```sql
SHOW BACKUP FROM example_db;
```
### Keywords
SHOW, BACKUP

View File

@ -26,8 +26,27 @@ under the License.
## SHOW-BROKER
### Name
SHOW BROKER
### Description
该语句用于查看当前存在的 broker
语法:
```sql
SHOW BROKER;
```
说明:
1. LastStartTime 表示最近一次 BE 启动时间。
2. LastHeartbeat 表示最近一次心跳。
3. Alive 表示节点是否存活。
4. ErrMsg 用于显示心跳失败时的错误信息。
### Example
### Keywords

View File

@ -26,13 +26,31 @@ under the License.
## SHOW-COLUMNS
### Name
SHOW FULL COLUMNS
### Description
该语句用于指定表的列信息
语法:
```sql
SHOW FULL COLUMNS FROM tbl;
```
### Example
1. 查看指定表的列信息
```sql
SHOW FULL COLUMNS FROM tbl;
```
### Keywords
SHOW, COLUMNS
SHOW, FULL, COLUMNS
### Best Practice

View File

@ -26,6 +26,10 @@ under the License.
## SHOW-CREATE-DATABASE
### Name
SHOW CREATE DATABASE
### Description
### Example

View File

@ -26,10 +26,33 @@ under the License.
## SHOW-CREATE-FUNCTION
### Name
SHOW CREATE FUNCTION
### Description
该语句用于展示用户自定义函数的创建语句
语法:
```sql
SHOW CREATE FUNTION function_name(arg_type [, ...]) [FROM db_name]];
```
说明:
1. `function_name`: 要展示的函数名称
2. `arg_type`: 要展示的函数的参数列表
3. 如果不指定 db_name,使用当前默认 db
### Example
1. 展示默认db下指定函数的创建语句
```sql
SHOW CREATE FUNCTION my_add(INT, INT)
```
### Keywords
SHOW, CREATE, FUNCTION

View File

@ -26,10 +26,34 @@ under the License.
## SHOW-CREATE-ROUTINE-LOAD
### Name
SHOW CREATE ROUTINE LOAD
### Description
该语句用于展示例行导入作业的创建语句.
结果中的 kafka partition 和 offset 展示的当前消费的 partition,以及对应的待消费的 offset。
语法:
```sql
SHOW [ALL] CREATE ROUTINE LOAD for load_name;
```
说明:
1. `ALL`: 可选参数,代表获取所有作业,包括历史作业
2. `load_name`: 例行导入作业名称
### Example
1. 展示默认db下指定例行导入作业的创建语句
```sql
SHOW CREATE ROUTINE LOAD for test_load
```
### Keywords
SHOW, CREATE, ROUTINE, LOAD

View File

@ -26,10 +26,33 @@ under the License.
## SHOW-CREATE-TABLE
### Name
SHOW CREATE TABLE
### Description
该语句用于展示数据表的创建语句.
语法:
```sql
SHOW CREATE TABLE [DBNAME.]TABLE_NAME
```
说明:
1. `DBNAMNE` : 数据库名称
2. `TABLE_NAME` : 表名
### Example
1. 查看某个表的建表语句
```sql
SHOW CREATE TABLE demo.tb1
```
### Keywords
SHOW, CREATE, TABLE

View File

@ -26,10 +26,91 @@ under the License.
## SHOW-DATA
### Name
SHOW DATA
### Description
该语句用于展示数据量、副本数量以及统计行数。
语法:
```sql
SHOW DATA [FROM db_name[.table_name]] [ORDER BY ...];
```
说明:
1. 如果不指定 FROM 子句,则展示当前 db 下细分到各个 table 的数据量和副本数量。其中数据量为所有副本的总数据量。而副本数量为表的所有分区以及所有物化视图的副本数量。
2. 如果指定 FROM 子句,则展示 table 下细分到各个物化视图的数据量、副本数量和统计行数。其中数据量为所有副本的总数据量。副本数量为对应物化视图的所有分区的副本数量。统计行数为对应物化视图的所有分区统计行数。
3. 统计行数时,以多个副本中,行数最大的那个副本为准。
4. 结果集中的 `Total` 行表示汇总行。`Quota` 行表示当前数据库设置的配额。`Left` 行表示剩余配额。
5. 如果想查看各个 Partition 的大小,请参阅 `help show partitions`
6. 可以使用 ORDER BY 对任意列组合进行排序。
### Example
1. 展示默认 db 的各个 table 的数据量,副本数量,汇总数据量和汇总副本数量。
```sql
SHOW DATA;
```
```
+-----------+-------------+--------------+
| TableName | Size | ReplicaCount |
+-----------+-------------+--------------+
| tbl1 | 900.000 B | 6 |
| tbl2 | 500.000 B | 3 |
| Total | 1.400 KB | 9 |
| Quota | 1024.000 GB | 1073741824 |
| Left | 1021.921 GB | 1073741815 |
+-----------+-------------+--------------+
```
2. 展示指定 db 的下指定表的细分数据量、副本数量和统计行数
```sql
SHOW DATA FROM example_db.test;
```
```
+-----------+-----------+-----------+--------------+----------+
| TableName | IndexName | Size | ReplicaCount | RowCount |
+-----------+-----------+-----------+--------------+----------+
| test | r1 | 10.000MB | 30 | 10000 |
| | r2 | 20.000MB | 30 | 20000 |
| | test2 | 50.000MB | 30 | 50000 |
| | Total | 80.000 | 90 | |
+-----------+-----------+-----------+--------------+----------+
```
3. 可以按照数据量、副本数量、统计行数等进行组合排序
```sql
SHOW DATA ORDER BY ReplicaCount desc,Size asc;
```
```
+-----------+-------------+--------------+
| TableName | Size | ReplicaCount |
+-----------+-------------+--------------+
| table_c | 3.102 KB | 40 |
| table_d | .000 | 20 |
| table_b | 324.000 B | 20 |
| table_a | 1.266 KB | 10 |
| Total | 4.684 KB | 90 |
| Quota | 1024.000 GB | 1073741824 |
| Left | 1024.000 GB | 1073741734 |
+-----------+-------------+--------------+
```
### Keywords
SHOW, DATA

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-DATABASE-ID
### Name
SHOW DATABASE ID
### Description
该语句用于根据 database id 查找对应的 database name(仅管理员使用)
语法:
```sql
SHOW DATABASE [database_id]
```
### Example
1. 根据 database id 查找对应的 database name
```sql
SHOW DATABASE 1001;
```
### Keywords
SHOW, DATABASE, ID

View File

@ -26,8 +26,20 @@ under the License.
## SHOW-DATABASES
### Name
SHOW DATABASES
### Description
该语句用于展示当前可见的 db
语法:
```sql
SHOW DATABASES;
```
### Example
### Keywords

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-DELETE
### Name
SHOW DELETE
### Description
该语句用于展示已执行成功的历史 delete 任务
语法:
```sql
SHOW DELETE [FROM db_name]
```
### Example
1. 展示数据库 database 的所有历史 delete 任务
```sql
SHOW DELETE FROM database;
```
### Keywords
SHOW, DELETE

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-DYNAMIC-PARTITION
### Name
SHOW DYNAMIC
### Description
该语句用于展示当前db下所有的动态分区表状态
语法:
```sql
SHOW DYNAMIC PARTITION TABLES [FROM db_name];
```
### Example
1. 展示数据库 database 的所有动态分区表状态
```sql
SHOW DYNAMIC PARTITION TABLES FROM database;
```
### Keywords
SHOW, DYNAMIC, PARTITION

View File

@ -26,10 +26,47 @@ under the License.
## SHOW-ENCRYPT-KEY
### Name
SHOW ENCRYPTKEYS
### Description
查看数据库下所有的自定义的密钥。如果用户指定了数据库,那么查看对应数据库的,否则直接查询当前会话所在数据库。
需要对这个数据库拥有 `ADMIN` 权限
语法:
```sql
SHOW ENCRYPTKEYS [IN|FROM db] [LIKE 'key_pattern']
```
参数
>`db`: 要查询的数据库名字
>`key_pattern`: 用来过滤密钥名称的参数
### Example
```sql
mysql> SHOW ENCRYPTKEYS;
+-------------------+-------------------+
| EncryptKey Name | EncryptKey String |
+-------------------+-------------------+
| example_db.my_key | ABCD123456789 |
+-------------------+-------------------+
1 row in set (0.00 sec)
mysql> SHOW ENCRYPTKEYS FROM example_db LIKE "%my%";
+-------------------+-------------------+
| EncryptKey Name | EncryptKey String |
+-------------------+-------------------+
| example_db.my_key | ABCD123456789 |
+-------------------+-------------------+
1 row in set (0.00 sec)
```
### Keywords
SHOW, ENCRYPT, KEY

View File

@ -26,6 +26,10 @@ under the License.
## SHOW-ENGINES
### Name
SHOW ENGINES
### Description
### Example

View File

@ -26,6 +26,10 @@ under the License.
## SHOW-EVENTS
### Name
SHOW EVENTS
### Description
### Example

View File

@ -1,9 +1,7 @@
---
{
"title": "SHOW-EXPORT",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
@ -26,10 +24,66 @@ under the License.
## SHOW-EXPORT
### Name
SHOW EXPORT
### Description
该语句用于展示指定的导出任务的执行情况
语法:
```sql
SHOW EXPORT
[FROM db_name]
[
WHERE
[ID = your_job_id]
[STATE = ["PENDING"|"EXPORTING"|"FINISHED"|"CANCELLED"]]
[LABEL = your_label]
]
[ORDER BY ...]
[LIMIT limit];
```
说明:
1. 如果不指定 db_name,使用当前默认db
2. 如果指定了 STATE,则匹配 EXPORT 状态
3. 可以使用 ORDER BY 对任意列组合进行排序
4. 如果指定了 LIMIT,则显示 limit 条匹配记录。否则全部显示
### Example
1. 展示默认 db 的所有导出任务
```sql
SHOW EXPORT;
```
2. 展示指定 db 的导出任务,按 StartTime 降序排序
```sql
SHOW EXPORT FROM example_db ORDER BY StartTime DESC;
```
3. 展示指定 db 的导出任务,state 为 "exporting", 并按 StartTime 降序排序
```sql
SHOW EXPORT FROM example_db WHERE STATE = "exporting" ORDER BY StartTime DESC;
```
4. 展示指定db,指定job_id的导出任务
```sql
SHOW EXPORT FROM example_db WHERE ID = job_id;
```
5. 展示指定db,指定label的导出任务
```sql
SHOW EXPORT FROM example_db WHERE LABEL = "mylabel";
```
### Keywords
SHOW, EXPORT

View File

@ -26,8 +26,29 @@ under the License.
## SHOW-FRONTENDS
### Name
SHOW FRONTENDS
### Description
该语句用于查看 FE 节点
语法:
```sql
SHOW FRONTENDS;
```
说明:
1. name 表示该 FE 节点在 bdbje 中的名称。
2. Join 为 true 表示该节点曾经加入过集群。但不代表当前还在集群内(可能已失联
3. Alive 表示节点是否存活。
4. ReplayedJournalId 表示该节点当前已经回放的最大元数据日志id。
5. LastHeartbeat 是最近一次心跳。
6. IsHelper 表示该节点是否是 bdbje 中的 helper 节点。
7. ErrMsg 用于显示心跳失败时的错误信息。
### Example
### Keywords

View File

@ -26,10 +26,65 @@ under the License.
## SHOW-FUNCTIONS
### Name
SHOW FUNCTIONS
### Description
查看数据库下所有的自定义(系统提供)的函数。如果用户指定了数据库,那么查看对应数据库的,否则直接查询当前会话所在数据库
需要对这个数据库拥有 `SHOW` 权限
语法
```sql
SHOW [FULL] [BUILTIN] FUNCTIONS [IN|FROM db] [LIKE 'function_pattern']
```
Parameters
>`full`:表示显示函数的详细信息
>`builtin`:表示显示系统提供的函数
>`db`: 要查询的数据库名字
>`function_pattern`: 用来过滤函数名称的参数
### Example
```sql
mysql> show full functions in testDb\G
*************************** 1. row ***************************
Signature: my_add(INT,INT)
Return Type: INT
Function Type: Scalar
Intermediate Type: NULL
Properties: {"symbol":"_ZN9doris_udf6AddUdfEPNS_15FunctionContextERKNS_6IntValES4_","object_file":"http://host:port/libudfsample.so","md5":"cfe7a362d10f3aaf6c49974ee0f1f878"}
*************************** 2. row ***************************
Signature: my_count(BIGINT)
Return Type: BIGINT
Function Type: Aggregate
Intermediate Type: NULL
Properties: {"object_file":"http://host:port/libudasample.so","finalize_fn":"_ZN9doris_udf13CountFinalizeEPNS_15FunctionContextERKNS_9BigIntValE","init_fn":"_ZN9doris_udf9CountInitEPNS_15FunctionContextEPNS_9BigIntValE","merge_fn":"_ZN9doris_udf10CountMergeEPNS_15FunctionContextERKNS_9BigIntValEPS2_","md5":"37d185f80f95569e2676da3d5b5b9d2f","update_fn":"_ZN9doris_udf11CountUpdateEPNS_15FunctionContextERKNS_6IntValEPNS_9BigIntValE"}
*************************** 3. row ***************************
Signature: id_masking(BIGINT)
Return Type: VARCHAR
Function Type: Alias
Intermediate Type: NULL
Properties: {"parameter":"id","origin_function":"concat(left(`id`, 3), `****`, right(`id`, 4))"}
3 rows in set (0.00 sec)
mysql> show builtin functions in testDb like 'year%';
+---------------+
| Function Name |
+---------------+
| year |
| years_add |
| years_diff |
| years_sub |
+---------------+
2 rows in set (0.00 sec)
```
### Keywords
SHOW, FUNCTIONS

View File

@ -26,10 +26,46 @@ under the License.
## SHOW-GRANTS
### Name
SHOW GRANTS
### Description
该语句用于查看用户权限。
语法:
```sql
SHOW [ALL] GRANTS [FOR user_identity];
```
说明:
1. SHOW ALL GRANTS 可以查看所有用户的权限。
2. 如果指定 user_identity,则查看该指定用户的权限。且该 user_identity 必须为通过 CREATE USER 命令创建的。
3. 如果不指定 user_identity,则查看当前用户的权限。
### Example
1. 查看所有用户权限信息
```sql
SHOW ALL GRANTS;
```
2. 查看指定 user 的权限
```sql
SHOW GRANTS FOR jack@'%';
```
3. 查看当前用户的权限
```sql
SHOW GRANTS;
```
### Keywords
SHOW, GRANTS

View File

@ -26,10 +26,30 @@ under the License.
## SHOW-INDEX
### Name
SHOW INDEX
### Description
该语句用于展示一个表中索引的相关信息,目前只支持bitmap 索引
语法:
```SQL
SHOW INDEX[ES] FROM [db_name.]table_name [FROM database];
或者
SHOW KEY[S] FROM [db_name.]table_name [FROM database];
```
### Example
1. 展示指定 table_name 的下索引
```SQL
SHOW INDEX FROM example_db.table_name;
```
### Keywords
SHOW, INDEX

View File

@ -0,0 +1,77 @@
---
{
"title": "SHOW-LAST-INSERT",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## SHOW-LAST-INSERT
### Name
SHOW LAST INSERT
### Description
该语法用于查看在当前session连接中,最近一次 insert 操作的结果
语法:
```sql
SHOW LAST INSERT
```
返回结果示例:
```
TransactionId: 64067
Label: insert_ba8f33aea9544866-8ed77e2844d0cc9b
Database: default_cluster:db1
Table: t1
TransactionStatus: VISIBLE
LoadedRows: 2
FilteredRows: 0
```
说明:
* TransactionId:事务id
* Label:insert任务对应的 label
* Database:insert对应的数据库
* Table:insert对应的表
* TransactionStatus:事务状态
* PREPARE:准备阶段
* PRECOMMITTED:预提交阶段
* COMMITTED:事务成功,但数据不可见
* VISIBLE:事务成功且数据可见
* ABORTED:事务失败
* LoadedRows:导入的行数
* FilteredRows:被过滤的行数
### Example
### Keywords
SHOW, LAST, INSERT
### Best Practice

View File

@ -26,10 +26,89 @@ under the License.
## SHOW-LOAD
### Name
SHOW LOAD
### Description
该语句用于展示指定的导入任务的执行情况
语法:
```sql
SHOW LOAD
[FROM db_name]
[
WHERE
[LABEL [ = "your_label" | LIKE "label_matcher"]]
[STATE = ["PENDING"|"ETL"|"LOADING"|"FINISHED"|"CANCELLED"|]]
]
[ORDER BY ...]
[LIMIT limit][OFFSET offset];
```
说明:
1) 如果不指定 db_name,使用当前默认db
1) 如果使用 LABEL LIKE,则会匹配导入任务的 label 包含 label_matcher 的导入任务
1) 如果使用 LABEL = ,则精确匹配指定的 label
1) 如果指定了 STATE,则匹配 LOAD 状态
1) 可以使用 ORDER BY 对任意列组合进行排序
1) 如果指定了 LIMIT,则显示 limit 条匹配记录。否则全部显示
1) 如果指定了 OFFSET,则从偏移量offset开始显示查询结果。默认情况下偏移量为0。
1) 如果是使用 broker/mini load,则 URL 列中的连接可以使用以下命令查看:
```sql
SHOW LOAD WARNINGS ON 'url'
```
### Example
1. 展示默认 db 的所有导入任务
```sql
SHOW LOAD;
```
1. 展示指定 db 的导入任务,label 中包含字符串 "2014_01_02",展示最老的10个
```sql
SHOW LOAD FROM example_db WHERE LABEL LIKE "2014_01_02" LIMIT 10;
```
1. 展示指定 db 的导入任务,指定 label 为 "load_example_db_20140102" 并按 LoadStartTime 降序排序
```sql
SHOW LOAD FROM example_db WHERE LABEL = "load_example_db_20140102" ORDER BY LoadStartTime DESC;
```
1. 展示指定 db 的导入任务,指定 label 为 "load_example_db_20140102" ,state 为 "loading", 并按 LoadStartTime 降序排序
```sql
SHOW LOAD FROM example_db WHERE LABEL = "load_example_db_20140102" AND STATE = "loading" ORDER BY LoadStartTime DESC;
```
1. 展示指定 db 的导入任务 并按 LoadStartTime 降序排序,并从偏移量5开始显示10条查询结果
```sql
SHOW LOAD FROM example_db ORDER BY LoadStartTime DESC limit 5,10;
SHOW LOAD FROM example_db ORDER BY LoadStartTime DESC limit 10 offset 5;
```
1. 小批量导入是查看导入状态的命令
```
curl --location-trusted -u {user}:{passwd} http://{hostname}:{port}/api/{database}/_load_info?label={labelname}
```
### Keywords
SHOW, LOAD

View File

@ -26,8 +26,20 @@ under the License.
## SHOW-MIGRATIONS
### Name
SHOW MIGRATIONS
### Description
该语句用于查看数据库迁移的进度
语法:
```sql
SHOW MIGRATIONS
```
### Example
### Keywords

View File

@ -26,8 +26,20 @@ under the License.
## SHOW-OPEN-TABLES
### Name
SHOW TABLES
### Description
该语句用于展示当前 db 下所有的 table
语法:
```SQL
SHOW TABLES
```
### Example
### Keywords

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-PARTITION-ID
### Name
SHOW PARTITION ID
### Description
该语句用于根据 partition id 查找对应的 database name, table name, partition name(仅管理员使用)
语法:
```SQL
SHOW PARTITION [partition_id]
```
### Example
1. 根据 partition id 查找对应的 database name, table name, partition name
```sql
SHOW PARTITION 10002;
```
### Keywords
SHOW, PARTITION, ID

View File

@ -26,10 +26,51 @@ under the License.
## SHOW-PARTITIONS
### Name
SHOW PARTITIONS
### Description
该语句用于展示分区信息
语法:
```SQL
SHOW [TEMPORARY] PARTITIONS FROM [db_name.]table_name [WHERE] [ORDER BY] [LIMIT];
```
说明:
1. 支持PartitionId,PartitionName,State,Buckets,ReplicationNum,LastConsistencyCheckTime等列的过滤
2. TEMPORARY指定列出临时分区
### Example
1.展示指定db下指定表的所有非临时分区信息
```SQL
SHOW PARTITIONS FROM example_db.table_name;
```
2. 展示指定db下指定表的所有临时分区信
```SQL
SHOW TEMPORARY PARTITIONS FROM example_db.table_name;
```
3. 展示指定db下指定表的指定非临时分区的信息
```SQL
SHOW PARTITIONS FROM example_db.table_name WHERE PartitionName = "p1";
```
4. 展示指定db下指定表的最新非临时分区的信息
```SQL
SHOW PARTITIONS FROM example_db.table_name ORDER BY PartitionId DESC LIMIT 1;
```
### Keywords
SHOW, PARTITIONS

View File

@ -26,10 +26,30 @@ under the License.
## SHOW-PLUGINS
### Name
SHOW PLUGINS
### Description
该语句用于展示已安装的插件
语法:
```SQL
SHOW PLUGINS
```
该命令会展示所有用户安装的和系统内置的插件
### Example
1. 展示已安装的插件:
```SQL
SHOW PLUGINS;
```
### Keywords
SHOW, PLUGINS

View File

@ -26,10 +26,40 @@ under the License.
## SHOW-PROCESSLIST
### Name
SHOW PROCESSLIST
### Description
显示用户正在运行的线程,需要注意的是,除了 root 用户能看到所有正在运行的线程外,其他用户都只能看到自己正在运行的线程,看不到其它用户正在运行的线程
语法:
```sql
SHOW [FULL] PROCESSLIST
```
说明:
- Id: 就是这个线程的唯一标识,当我们发现这个线程有问题的时候,可以通过 kill 命令,加上这个Id值将这个线程杀掉。前面我们说了show processlist 显示的信息时来自information_schema.processlist 表,所以这个Id就是这个表的主键。
- User: 就是指启动这个线程的用户。
- Host: 记录了发送请求的客户端的 IP 和 端口号。通过这些信息在排查问题的时候,我们可以定位到是哪个客户端的哪个进程发送的请求。
- Cluster:集群名称
- DB: 当前执行的命令是在哪一个数据库上。如果没有指定数据库,则该值为 NULL 。
- Command: 是指此刻该线程正在执行的命令。这个很复杂,下面单独解释
- Time: 表示该线程处于当前状态的时间。
- State: 线程的状态,和 Command 对应,下面单独解释。
- Info: 一般记录的是线程执行的语句。默认只显示前100个字符,也就是你看到的语句可能是截断了的,要看全部信息,需要使用 show full processlist。
### Example
1. 查看当前用户尽在运行的线程
```SQL
SHOW PROCESSLIST
```
### Keywords
SHOW, PROCESSLIST

View File

@ -26,26 +26,32 @@ under the License.
## SHOW-PROPERTY
### Name
SHOW PROPERTY
### Description
该语句用于查看用户的属性
```
SHOW PROPERTY [FOR user] [LIKE key];
语法:
```sql
SHOW PROPERTY [FOR user] [LIKE key]
```
* `user`
查看指定用户的属性。如不指定,查看当前用户的。
查看指定用户的属性。 如果未指定,请检查当前用户的。
* `LIKE`
可以通过属性名模糊匹配
模糊匹配可以通过属性名来完成
返回结果说明:
```sql
mysql> show property like '%connection%';
mysql> show property like'%connection%';
+----------------------+-------+
| Key | Value |
+----------------------+-------+
@ -56,25 +62,25 @@ mysql> show property like '%connection%';
* `Key`
属性名
属性名.
* `Value`
属性值
属性值.
### Example
1. 查看 jack 用户的属性
```sql
SHOW PROPERTY FOR 'jack';
```
2. 查看 jack 用户连接数限制属性
```sql
SHOW PROPERTY FOR 'jack'
```
```sql
SHOW PROPERTY FOR 'jack' LIKE '%connection%';
```
2. 查看 jack 用户导入cluster相关属性
```sql
SHOW PROPERTY FOR 'jack' LIKE '%load_cluster%'
```
### Keywords

View File

@ -26,10 +26,39 @@ under the License.
## SHOW-REPOSITORIES
### Name
SHOW REPOSITORIES
### Description
该语句用于查看当前已创建的仓库
语法:
```sql
SHOW REPOSITORIES;
```
说明:
1. 各列含义如下:
RepoId: 唯一的仓库ID
RepoName: 仓库名称
CreateTime: 第一次创建该仓库的时间
IsReadOnly: 是否为只读仓库
Location: 仓库中用于备份数据的根目录
Broker: 依赖的 Broker
ErrMsg: Doris 会定期检查仓库的连通性,如果出现问题,这里会显示错误信息
### Example
1. 查看已创建的仓库:
```sql
SHOW REPOSITORIES;
```
### Keywords
SHOW, REPOSITORIES

View File

@ -26,10 +26,56 @@ under the License.
## SHOW-RESOURCES
### Name
SHOW RESOURCES
### Description
该语句用于展示用户有使用权限的资源。普通用户仅能展示有使用权限的资源,root 或 admin 用户会展示所有的资源。
语法:
```sql
SHOW RESOURCES
[
WHERE
[NAME [ = "your_resource_name" | LIKE "name_matcher"]]
[RESOURCETYPE = ["SPARK"]]
]
[ORDER BY ...]
[LIMIT limit][OFFSET offset];
```
说明:
1. 如果使用 NAME LIKE,则会匹配 RESOURCES 的 Name 包含 name_matcher 的Resource
2. 如果使用 NAME = ,则精确匹配指定的 Name
3. 如果指定了 RESOURCETYPE,则匹配对应的 Resrouce 类型
4. 可以使用 ORDER BY 对任意列组合进行排序
5. 如果指定了 LIMIT,则显示 limit 条匹配记录。否则全部显示
6. 如果指定了 OFFSET,则从偏移量 offset 开始显示查询结果。默认情况下偏移量为0。
### Example
1. 展示当前用户拥有权限的所有 Resource
```sql
SHOW RESOURCES;
```
1. 展示指定 Resource ,NAME 中包含字符串 "20140102",展示10个属性
```sql
SHOW RESOURCES WHERE NAME LIKE "2014_01_02" LIMIT 10;
```
1. 展示指定 Resource ,指定 NAME 为 "20140102" 并按 KEY 降序排序
```sql
SHOW RESOURCES WHERE NAME = "20140102" ORDER BY `KEY` DESC;
```
### Keywords
SHOW, RESOURCES

View File

@ -26,10 +26,56 @@ under the License.
## SHOW-RESTORE
### Name
SHOW RESTORE
### Description
该语句用于查看 RESTORE 任务
语法:
```SQL
SHOW RESTORE [FROM DB_NAME]
```
说明:
1. Doris 中仅保存最近一次 RESTORE 任务。
2. 各列含义如下:
JobId: 唯一作业id
Label: 要恢复的备份的名称
Timestamp: 要恢复的备份的时间版本
DbName: 所属数据库
State: 当前阶段
PENDING: 提交作业后的初始状态
SNAPSHOTING: 执行快照中
DOWNLOAD: 快照完成,准备下载仓库中的快照
DOWNLOADING: 快照下载中
COMMIT: 快照下载完成,准备生效
COMMITING: 生效中
FINISHED: 作业成功
CANCELLED: 作业失败
AllowLoad: 恢复时是否允许导入(当前不支持)
ReplicationNum: 指定恢复的副本数
RestoreJobs: 要恢复的表和分区
CreateTime: 任务提交时间
MetaPreparedTime: 元数据准备完成时间
SnapshotFinishedTime: 快照完成时间
DownloadFinishedTime: 快照下载完成时间
FinishedTime: 作业结束时间
UnfinishedTasks: 在 SNAPSHOTING、DOWNLOADING 和 COMMITING 阶段会显示还未完成的子任务id
Status: 如果作业失败,显示失败信息
Timeout: 作业超时时间,单位秒
### Example
1. 查看 example_db 下最近一次 RESTORE 任务。
```sql
SHOW RESTORE FROM example_db;
```
### Keywords
SHOW, RESTORE

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-ROLES
### Name
SHOW ROLES
### Description
该语句用于展示所有已创建的角色信息,包括角色名称,包含的用户以及权限。
语法:
```SQL
SHOW ROLES
```
### Example
1. 查看已创建的角色
```SQL
SHOW ROLES
```
### Keywords
SHOW, ROLES

View File

@ -26,13 +26,55 @@ under the License.
## SHOW-ROUTINE-LOAD-TASK
### Name
SHOW ROUTINE LOAD TASK
### Description
查看一个指定的 Routine Load 作业的当前正在运行的子任务情况。
```sql
SHOW ROUTINE LOAD TASK
WHERE JobName = "job_name";
```
返回结果如下:
```text
TaskId: d67ce537f1be4b86-abf47530b79ab8e6
TxnId: 4
TxnStatus: UNKNOWN
JobId: 10280
CreateTime: 2020-12-12 20:29:48
ExecuteStartTime: 2020-12-12 20:29:48
Timeout: 20
BeId: 10002
DataSourceProperties: {"0":19}
```
- `TaskId`:子任务的唯一 ID。
- `TxnId`:子任务对应的导入事务 ID。
- `TxnStatus`:子任务对应的导入事务状态。通常为 UNKNOWN。并无实际意思。
- `JobId`:子任务对应的作业 ID。
- `CreateTime`:子任务的创建时间。
- `ExecuteStartTime`:子任务被调度执行的时间,通常晚于创建时间。
- `Timeout`:子任务超时时间,通常是作业设置的 `MaxIntervalS` 的两倍。
- `BeId`:执行这个子任务的 BE 节点 ID。
- `DataSourceProperties`:子任务准备消费的 Kafka Partition 的起始 offset。是一个 Json 格式字符串。Key 为 Partition Id。Value 为消费的起始 offset。
### Example
1. 展示名为 test1 的例行导入任务的子任务信息。
```sql
SHOW ROUTINE LOAD TASK WHERE JobName = "test1";
```
### Keywords
SHOW, ROUTINE, LOAD, TASK
### Best Practice
通过这个命令,可以查看一个 Routine Load 作业当前有多少子任务在运行,具体运行在哪个 BE 节点上。

View File

@ -26,10 +26,101 @@ under the License.
## SHOW-ROUTINE-LOAD
### Name
SHOW ROUTINE LOAD
### Description
该语句用于展示 Routine Load 作业运行状态
语法:
```sql
SHOW [ALL] ROUTINE LOAD [FOR jobName];
```
结果说明:
```
Id: 作业ID
Name: 作业名称
CreateTime: 作业创建时间
PauseTime: 最近一次作业暂停时间
EndTime: 作业结束时间
DbName: 对应数据库名称
TableName: 对应表名称
State: 作业运行状态
DataSourceType: 数据源类型:KAFKA
CurrentTaskNum: 当前子任务数量
JobProperties: 作业配置详情
DataSourceProperties: 数据源配置详情
CustomProperties: 自定义配置
Statistic: 作业运行状态统计信息
Progress: 作业运行进度
Lag: 作业延迟状态
ReasonOfStateChanged: 作业状态变更的原因
ErrorLogUrls: 被过滤的质量不合格的数据的查看地址
OtherMsg: 其他错误信息
```
* State
有以下4种State:
* NEED_SCHEDULE:作业等待被调度
* RUNNING:作业运行中
* PAUSED:作业被暂停
* STOPPED:作业已结束
* CANCELLED:作业已取消
* Progress
对于Kafka数据源,显示每个分区当前已消费的offset。如 {"0":"2"} 表示Kafka分区0的消费进度为2。
* Lag
对于Kafka数据源,显示每个分区的消费延迟。如{"0":10} 表示Kafka分区0的消费延迟为10。
### Example
1. 展示名称为 test1 的所有例行导入作业(包括已停止或取消的作业)。结果为一行或多行。
```sql
SHOW ALL ROUTINE LOAD FOR test1;
```
2. 展示名称为 test1 的当前正在运行的例行导入作业
```sql
SHOW ROUTINE LOAD FOR test1;
```
3. 显示 example_db 下,所有的例行导入作业(包括已停止或取消的作业)。结果为一行或多行。
```sql
use example_db;
SHOW ALL ROUTINE LOAD;
```
4. 显示 example_db 下,所有正在运行的例行导入作业
```sql
use example_db;
SHOW ROUTINE LOAD;
```
5. 显示 example_db 下,名称为 test1 的当前正在运行的例行导入作业
```sql
SHOW ROUTINE LOAD FOR example_db.test1;
```
6. 显示 example_db 下,名称为 test1 的所有例行导入作业(包括已停止或取消的作业)。结果为一行或多行。
```sql
SHOW ALL ROUTINE LOAD FOR example_db.test1;
```
### Keywords
SHOW, ROUTINE, LOAD

View File

@ -26,10 +26,35 @@ under the License.
## SHOW-SMALL-FILES
### Name
SHOW FILE
### Description
该语句用于展示一个数据库内,由 CREATE FILE 命令创建的文件。
```sql
SHOW FILE [FROM database];
```
返回结果说明:
- FileId: 文件ID,全局唯一
- DbName: 所属数据库名称
- Catalog: 自定义分类
- FileName: 文件名
- FileSize: 文件大小,单位字节
- MD5: 文件的 MD5
### Example
1. 查看数据库 my_database 中已上传的文件
```sql
SHOW FILE FROM my_database;
```
### Keywords
SHOW, SMALL, FILES

View File

@ -26,10 +26,51 @@ under the License.
## SHOW-SNAPSHOT
### Name
SHOW SNAPSHOT
### Description
该语句用于查看仓库中已存在的备份。
语法:
```sql
SHOW SNAPSHOT ON `repo_name`
[WHERE SNAPSHOT = "snapshot" [AND TIMESTAMP = "backup_timestamp"]];
```
说明:
1. 各列含义如下:
Snapshot: 备份的名称
Timestamp: 对应备份的时间版本
Status: 如果备份正常,则显示 OK,否则显示错误信息
2. 如果指定了 TIMESTAMP,则会额外显示如下信息:
Database: 备份数据原属的数据库名称
Details: 以 Json 的形式,展示整个备份的数据目录及文件结构
### Example
1. 查看仓库 example_repo 中已有的备份
```sql
SHOW SNAPSHOT ON example_repo;
```
1. 仅查看仓库 example_repo 中名称为 backup1 的备份:
```sql
SHOW SNAPSHOT ON example_repo WHERE SNAPSHOT = "backup1";
```
1. 查看仓库 example_repo 中名称为 backup1 的备份,时间版本为 "2018-05-05-15-34-26" 的详细信息:
```sql
SHOW SNAPSHOT ON example_repo
WHERE SNAPSHOT = "backup1" AND TIMESTAMP = "2018-05-05-15-34-26";
```
### Keywords
SHOW, SNAPSHOT

View File

@ -26,6 +26,10 @@ under the License.
## SHOW-STATUS
### Name
SHOW STATUS
### Description
### Example

View File

@ -26,10 +26,71 @@ under the License.
## SHOW-STREAM-LOAD
### Name
SHOW STREAM LOAD
### Description
该语句用于展示指定的Stream Load任务的执行情况
语法:
```sql
SHOW STREAM LOAD
[FROM db_name]
[
WHERE
[LABEL [ = "your_label" | LIKE "label_matcher"]]
[STATUS = ["SUCCESS"|"FAIL"]]
]
[ORDER BY ...]
[LIMIT limit][OFFSET offset];
```
说明:
1. 如果不指定 db_name,使用当前默认db
2. 如果使用 LABEL LIKE,则会匹配Stream Load任务的 label 包含 label_matcher 的任务
3. 如果使用 LABEL = ,则精确匹配指定的 label
4. 如果指定了 STATUS,则匹配 STREAM LOAD 状态
5. 可以使用 ORDER BY 对任意列组合进行排序
6. 如果指定了 LIMIT,则显示 limit 条匹配记录。否则全部显示
7. 如果指定了 OFFSET,则从偏移量offset开始显示查询结果。默认情况下偏移量为0。
### Example
1. 展示默认 db 的所有Stream Load任务
```sql
SHOW STREAM LOAD;
```
2. 展示指定 db 的Stream Load任务,label 中包含字符串 "2014_01_02",展示最老的10个
```sql
SHOW STREAM LOAD FROM example_db WHERE LABEL LIKE "2014_01_02" LIMIT 10;
```
2. 展示指定 db 的Stream Load任务,指定 label 为 "load_example_db_20140102"
```sql
SHOW STREAM LOAD FROM example_db WHERE LABEL = "load_example_db_20140102";
```
2. 展示指定 db 的Stream Load任务,指定 status 为 "success", 并按 StartTime 降序排序
```sql
SHOW STREAM LOAD FROM example_db WHERE STATUS = "success" ORDER BY StartTime DESC;
```
2. 展示指定 db 的导入任务 并按 StartTime 降序排序,并从偏移量5开始显示10条查询结果
```sql
SHOW STREAM LOAD FROM example_db ORDER BY StartTime DESC limit 5,10;
SHOW STREAM LOAD FROM example_db ORDER BY StartTime DESC limit 10 offset 5;
```
### Keywords
SHOW, STREAM, LOAD

View File

@ -27,10 +27,34 @@ under the License.
## SHOW-SYNC-JOB
### Name
SHOW SYNC JOB
### Description
此命令用于当前显示所有数据库内的常驻数据同步作业状态。
语法:
```sql
SHOW SYNC JOB [FROM db_name]
```
### Example
1. 展示当前数据库的所有数据同步作业状态。
```sql
SHOW SYNC JOB;
```
2. 展示数据库 `test_db` 下的所有数据同步作业状态。
```sql
SHOW SYNC JOB FROM `test_db`;
```
### Keywords
SHOW, SYNC, JOB

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-TABLE-ID
### Name
SHOW TABLE ID
### Description
该语句用于根据 table id 查找对应的 database name, table name(仅管理员使用)
语法:
```sql
SHOW TABLE [table_id]
```
### Example
1. 根据 table id 查找对应的 database name, table name
```sql
SHOW TABLE 10001;
```
### Keywords
SHOW, TABLE, ID

View File

@ -26,10 +26,39 @@ under the License.
## SHOW-TABLE-STATUS
### Name
SHOW TABLE STATUS
### Description
该语句用于查看 Table 的一些信息。
语法:
```sql
SHOW TABLE STATUS
[FROM db] [LIKE "pattern"]
```
说明:
1. 该语句主要用于兼容 MySQL 语法,目前仅显示 Comment 等少量信息
### Example
1. 查看当前数据库下所有表的信息
```sql
SHOW TABLE STATUS;
```
1. 查看指定数据库下,名称包含 example 的表的信息
```sql
SHOW TABLE STATUS FROM db LIKE "%example%";
```
### Keywords
SHOW, TABLE, STATUS

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-TABLET
### Name
SHOW TABLET
### Description
该语句用于显示指定tablet id 信息(仅管理员使用)
语法:
```sql
SHOW TABLET tablet_id
```
### Example
1. 显示指定 tablet id 为 10000 的 tablet 的父层级 id 信息
```sql
SHOW TABLET 10000;
```
### Keywords
SHOW, TABLET

View File

@ -26,10 +26,78 @@ under the License.
## SHOW-TRANSACTION
### Name
SHOW TRANSACTION
### Description
该语法用于查看指定 transaction id 或 label 的事务详情。
语法:
```sql
SHOW TRANSACTION
[FROM db_name]
WHERE
[id = transaction_id]
[label = label_name];
```
返回结果示例:
```
TransactionId: 4005
Label: insert_8d807d5d-bcdd-46eb-be6d-3fa87aa4952d
Coordinator: FE: 10.74.167.16
TransactionStatus: VISIBLE
LoadJobSourceType: INSERT_STREAMING
PrepareTime: 2020-01-09 14:59:07
CommitTime: 2020-01-09 14:59:09
FinishTime: 2020-01-09 14:59:09
Reason:
ErrorReplicasCount: 0
ListenerId: -1
TimeoutMs: 300000
```
* TransactionId:事务id
* Label:导入任务对应的 label
* Coordinator:负责事务协调的节点
* TransactionStatus:事务状态
* PREPARE:准备阶段
* COMMITTED:事务成功,但数据不可见
* VISIBLE:事务成功且数据可见
* ABORTED:事务失败
* LoadJobSourceType:导入任务的类型。
* PrepareTime:事务开始时间
* CommitTime:事务提交成功的时间
* FinishTime:数据可见的时间
* Reason:错误信息
* ErrorReplicasCount:有错误的副本数
* ListenerId:相关的导入作业的id
* TimeoutMs:事务超时时间,单位毫秒
### Example
1. 查看 id 为 4005 的事务:
```sql
SHOW TRANSACTION WHERE ID=4005;
```
2. 指定 db 中,查看 id 为 4005 的事务:
```sql
SHOW TRANSACTION FROM db WHERE ID=4005;
```
3. 查看 label 为 label_name的事务:
```sql
SHOW TRANSACTION WHERE LABEL = 'label_name';
```
### Keywords
SHOW, TRANSACTION

View File

@ -26,6 +26,10 @@ under the License.
## SHOW-USER
### Name
SHOW USER
### Description
### Example

View File

@ -26,10 +26,48 @@ under the License.
## SHOW-VARIABLES
### Name
SHOW VARIABLES
### Description
改语句是用来显示Doris系统变量,可以通过条件查询
语法:
```sql
SHOW [GLOBAL | SESSION] VARIABLES
[LIKE 'pattern' | WHERE expr]
```
说明:
- show variables主要是用来查看系统变量的值.
- 执行SHOW VARIABLES命令不需要任何权限,只要求能够连接到服务器就可以.
- 使用like语句表示用variable_name进行匹配.
- %百分号通配符可以用在匹配模式中的任何位置
### Example
1. 这里默认的就是对Variable_name进行匹配,这里是准确匹配
```sql
show variables like 'max_connections';
```
2. 通过百分号(%)这个通配符进行匹配,可以匹配多项
```sql
show variables like '%connec%';
```
3. 使用 Where 子句进行匹配查询
```sql
show variables where variable_name = 'version';
```
### Keywords
SHOW, VARIABLES

View File

@ -26,10 +26,28 @@ under the License.
## SHOW-VIEW
### Name
SHOW VIEW
### Description
该语句用于展示基于给定表建立的所有视图
语法:
```sql
SHOW VIEW { FROM | IN } table [ FROM db ]
```
### Example
1. 展示基于表 testTbl 建立的所有视图 view
```sql
SHOW VIEW FROM testTbl;
```
### Keywords
SHOW, VIEW