2020-04-03 13:23:32 +00:00
---
2020-10-26 10:29:30 +00:00
toc_priority: 37
2020-04-03 13:23:32 +00:00
toc_title: SHOW
---
2020-07-11 11:05:49 +00:00
# SHOW Statements {#show-queries}
2019-09-27 15:44:36 +00:00
2020-03-20 10:10:48 +00:00
## SHOW CREATE TABLE {#show-create-table}
2019-09-27 15:44:36 +00:00
2020-03-20 10:10:48 +00:00
``` sql
2019-11-13 15:50:09 +00:00
SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format]
2019-09-27 15:44:36 +00:00
```
2020-03-20 10:10:48 +00:00
Returns a single `String` -type ‘ statement’ column, which contains a single value – the `CREATE` query used for creating the specified object.
2019-09-27 15:44:36 +00:00
2020-03-18 18:43:51 +00:00
## SHOW DATABASES {#show-databases}
2019-09-27 15:44:36 +00:00
2020-10-23 15:11:02 +00:00
Prints a list of all databases.
```sql
SHOW DATABASES [LIKE | ILIKE | NOT LIKE '< pattern > '] [LIMIT < N > ] [INTO OUTFILE filename] [FORMAT format]
```
This statement is identical to the query:
```sql
SELECT name FROM system.databases [WHERE name LIKE | ILIKE | NOT LIKE '< pattern > '] [LIMIT < N > ] [INTO OUTFILE filename] [FORMAT format]
```
### Examples {#examples}
Getting database names, containing the symbols sequence 'de' in their names:
2020-03-20 10:10:48 +00:00
``` sql
2020-10-23 15:11:02 +00:00
SHOW DATABASES LIKE '%de%'
2019-09-27 15:44:36 +00:00
```
2020-10-23 15:11:02 +00:00
Result:
``` text
┌─name────┐
│ default │
└─────────┘
```
Getting database names, containing symbols sequence 'de' in their names, in the case insensitive manner:
``` sql
SHOW DATABASES ILIKE '%DE%'
```
Result:
``` text
┌─name────┐
│ default │
└─────────┘
```
Getting database names, not containing the symbols sequence 'de' in their names:
``` sql
SHOW DATABASES NOT LIKE '%de%'
```
Result:
``` text
┌─name───────────────────────────┐
│ _temporary_and_external_tables │
│ system │
│ test │
│ tutorial │
└────────────────────────────────┘
```
Getting the first two rows from database names:
``` sql
SHOW DATABASES LIMIT 2
```
Result:
``` text
┌─name───────────────────────────┐
│ _temporary_and_external_tables │
│ default │
└────────────────────────────────┘
```
### See Also {#see-also}
- [CREATE DATABASE ](https://clickhouse.tech/docs/en/sql-reference/statements/create/database/#query-language-create-database )
2019-09-27 15:44:36 +00:00
2020-03-20 10:10:48 +00:00
## SHOW PROCESSLIST {#show-processlist}
2019-09-27 15:44:36 +00:00
2020-03-20 10:10:48 +00:00
``` sql
2019-09-27 15:44:36 +00:00
SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format]
```
2020-06-18 08:24:31 +00:00
Outputs the content of the [system.processes ](../../operations/system-tables/processes.md#system_tables-processes ) table, that contains a list of queries that is being processed at the moment, excepting `SHOW PROCESSLIST` queries.
2019-09-27 15:44:36 +00:00
2019-11-01 14:20:28 +00:00
The `SELECT * FROM system.processes` query returns data about all the current queries.
2019-09-27 15:44:36 +00:00
Tip (execute in the console):
2020-03-20 10:10:48 +00:00
``` bash
2019-09-27 15:44:36 +00:00
$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'"
```
2020-03-20 10:10:48 +00:00
## SHOW TABLES {#show-tables}
2019-09-27 15:44:36 +00:00
Displays a list of tables.
2020-10-23 15:11:02 +00:00
```sql
SHOW [TEMPORARY] TABLES [{FROM | IN} < db > ] [LIKE | ILIKE | NOT LIKE '< pattern > '] [LIMIT < N > ] [INTO OUTFILE < filename > ] [FORMAT < format > ]
2019-09-27 15:44:36 +00:00
```
If the `FROM` clause is not specified, the query returns the list of tables from the current database.
2020-10-23 15:11:02 +00:00
This statement is identical to the query:
```sql
SELECT name FROM system.tables [WHERE name LIKE | ILIKE | NOT LIKE '< pattern > '] [LIMIT < N > ] [INTO OUTFILE < filename > ] [FORMAT < format > ]
```
### Examples {#examples}
Getting table names, containing the symbols sequence 'user' in their names:
2019-09-27 15:44:36 +00:00
2020-03-20 10:10:48 +00:00
``` sql
2020-10-23 15:11:02 +00:00
SHOW TABLES FROM system LIKE '%user%'
2019-09-27 15:44:36 +00:00
```
2020-10-23 15:11:02 +00:00
Result:
2019-09-27 15:44:36 +00:00
2020-10-23 15:11:02 +00:00
``` text
┌─name─────────────┐
│ user_directories │
│ users │
└──────────────────┘
```
Getting table names, containing sequence 'user' in their names, in the case insensitive manner:
2019-09-27 15:44:36 +00:00
2020-03-20 10:10:48 +00:00
``` sql
2020-10-23 15:11:02 +00:00
SHOW TABLES FROM system ILIKE '%USER%'
2019-09-27 15:44:36 +00:00
```
2020-03-20 10:10:48 +00:00
2020-10-23 15:11:02 +00:00
Result:
``` text
┌─name─────────────┐
│ user_directories │
│ users │
└──────────────────┘
```
Getting table names, not containing the symbol sequence 's' in their names:
``` sql
SHOW TABLES FROM system NOT LIKE '%s%'
```
Result:
``` text
┌─name─────────┐
│ metric_log │
│ metric_log_0 │
│ metric_log_1 │
└──────────────┘
```
Getting the first two rows from table names:
``` sql
SHOW TABLES FROM system LIMIT 2
```
Result:
2020-03-20 10:10:48 +00:00
``` text
2019-09-27 15:44:36 +00:00
┌─name───────────────────────────┐
│ aggregate_function_combinators │
2020-10-23 15:11:02 +00:00
│ asynchronous_metric_log │
2019-09-27 15:44:36 +00:00
└────────────────────────────────┘
```
2019-11-13 15:50:09 +00:00
2020-10-23 15:11:02 +00:00
### See Also {#see-also}
- [Create Tables ](https://clickhouse.tech/docs/en/getting-started/tutorial/#create-tables )
- [SHOW CREATE TABLE ](https://clickhouse.tech/docs/en/sql-reference/statements/show/#show-create-table )
2020-03-20 10:10:48 +00:00
## SHOW DICTIONARIES {#show-dictionaries}
2019-11-13 15:50:09 +00:00
2020-04-30 18:19:18 +00:00
Displays a list of [external dictionaries ](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md ).
2019-11-13 15:50:09 +00:00
2020-03-20 10:10:48 +00:00
``` sql
2019-11-13 15:50:09 +00:00
SHOW DICTIONARIES [FROM < db > ] [LIKE '< pattern > '] [LIMIT < N > ] [INTO OUTFILE < filename > ] [FORMAT < format > ]
```
If the `FROM` clause is not specified, the query returns the list of dictionaries from the current database.
You can get the same results as the `SHOW DICTIONARIES` query in the following way:
2020-03-20 10:10:48 +00:00
``` sql
2019-11-13 15:50:09 +00:00
SELECT name FROM system.dictionaries WHERE database = < db > [AND name LIKE < pattern > ] [LIMIT < N > ] [INTO OUTFILE < filename > ] [FORMAT < format > ]
```
**Example**
2020-02-20 06:31:06 +00:00
The following query selects the first two rows from the list of tables in the `system` database, whose names contain `reg` .
2019-11-13 15:50:09 +00:00
2020-03-20 10:10:48 +00:00
``` sql
2019-11-13 15:50:09 +00:00
SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2
```
2020-03-20 10:10:48 +00:00
``` text
2019-11-13 15:50:09 +00:00
┌─name─────────┐
│ regions │
│ region_names │
└──────────────┘
```
2020-02-20 06:31:06 +00:00
2020-05-01 14:48:16 +00:00
## SHOW GRANTS {#show-grants-statement}
Shows privileges for a user.
### Syntax {#show-grants-syntax}
``` sql
2021-01-23 13:35:26 +00:00
SHOW GRANTS [FOR user1 [, user2 ...]]
2020-05-01 14:48:16 +00:00
```
If user is not specified, the query returns privileges for the current user.
## SHOW CREATE USER {#show-create-user-statement}
2020-07-09 15:10:35 +00:00
Shows parameters that were used at a [user creation ](../../sql-reference/statements/create/user.md ).
2020-05-01 14:48:16 +00:00
2021-05-27 19:44:11 +00:00
`SHOW CREATE USER` does not output user passwords.
2020-05-01 14:48:16 +00:00
### Syntax {#show-create-user-syntax}
``` sql
2021-01-26 22:40:14 +00:00
SHOW CREATE USER [name1 [, name2 ...] | CURRENT_USER]
2020-05-01 14:48:16 +00:00
```
## SHOW CREATE ROLE {#show-create-role-statement}
2020-07-09 15:10:35 +00:00
Shows parameters that were used at a [role creation ](../../sql-reference/statements/create/role.md ).
2020-05-01 14:48:16 +00:00
### Syntax {#show-create-role-syntax}
``` sql
2021-01-26 22:40:14 +00:00
SHOW CREATE ROLE name1 [, name2 ...]
2020-05-01 14:48:16 +00:00
```
## SHOW CREATE ROW POLICY {#show-create-row-policy-statement}
2020-07-09 15:10:35 +00:00
Shows parameters that were used at a [row policy creation ](../../sql-reference/statements/create/row-policy.md ).
2020-05-01 14:48:16 +00:00
### Syntax {#show-create-row-policy-syntax}
2020-06-18 08:24:31 +00:00
``` sql
2021-01-26 22:40:14 +00:00
SHOW CREATE [ROW] POLICY name ON [database1.]table1 [, [database2.]table2 ...]
2020-05-01 14:48:16 +00:00
```
## SHOW CREATE QUOTA {#show-create-quota-statement}
2020-07-09 15:10:35 +00:00
Shows parameters that were used at a [quota creation ](../../sql-reference/statements/create/quota.md ).
2020-05-01 14:48:16 +00:00
2020-09-08 07:35:24 +00:00
### Syntax {#show-create-quota-syntax}
2020-05-01 14:48:16 +00:00
2020-06-18 08:24:31 +00:00
``` sql
2021-01-26 22:40:14 +00:00
SHOW CREATE QUOTA [name1 [, name2 ...] | CURRENT]
2020-05-01 14:48:16 +00:00
```
## SHOW CREATE SETTINGS PROFILE {#show-create-settings-profile-statement}
2020-07-09 15:10:35 +00:00
Shows parameters that were used at a [settings profile creation ](../../sql-reference/statements/create/settings-profile.md ).
2020-05-01 14:48:16 +00:00
2020-09-08 07:35:24 +00:00
### Syntax {#show-create-settings-profile-syntax}
2020-05-01 14:48:16 +00:00
2020-06-18 08:24:31 +00:00
``` sql
2021-01-26 22:40:14 +00:00
SHOW CREATE [SETTINGS] PROFILE name1 [, name2 ...]
2020-05-01 14:48:16 +00:00
```
2020-09-08 07:35:24 +00:00
## SHOW USERS {#show-users-statement}
Returns a list of [user account ](../../operations/access-rights.md#user-account-management ) names. To view user accounts parameters, see the system table [system.users ](../../operations/system-tables/users.md#system_tables-users ).
### Syntax {#show-users-syntax}
``` sql
SHOW USERS
```
2021-07-29 15:20:55 +00:00
2020-09-08 07:35:24 +00:00
## SHOW ROLES {#show-roles-statement}
Returns a list of [roles ](../../operations/access-rights.md#role-management ). To view another parameters, see system tables [system.roles ](../../operations/system-tables/roles.md#system_tables-roles ) and [system.role-grants ](../../operations/system-tables/role-grants.md#system_tables-role_grants ).
### Syntax {#show-roles-syntax}
``` sql
SHOW [CURRENT|ENABLED] ROLES
```
## SHOW PROFILES {#show-profiles-statement}
Returns a list of [setting profiles ](../../operations/access-rights.md#settings-profiles-management ). To view user accounts parameters, see the system table [settings_profiles ](../../operations/system-tables/settings_profiles.md#system_tables-settings_profiles ).
### Syntax {#show-profiles-syntax}
``` sql
SHOW [SETTINGS] PROFILES
```
## SHOW POLICIES {#show-policies-statement}
Returns a list of [row policies ](../../operations/access-rights.md#row-policy-management ) for the specified table. To view user accounts parameters, see the system table [system.row_policies ](../../operations/system-tables/row_policies.md#system_tables-row_policies ).
### Syntax {#show-policies-syntax}
``` sql
SHOW [ROW] POLICIES [ON [db.]table]
```
## SHOW QUOTAS {#show-quotas-statement}
Returns a list of [quotas ](../../operations/access-rights.md#quotas-management ). To view quotas parameters, see the system table [system.quotas ](../../operations/system-tables/quotas.md#system_tables-quotas ).
### Syntax {#show-quotas-syntax}
``` sql
SHOW QUOTAS
2021-07-29 15:27:50 +00:00
```
2020-09-08 07:35:24 +00:00
## SHOW QUOTA {#show-quota-statement}
Returns a [quota ](../../operations/quotas.md ) consumption for all users or for current user. To view another parameters, see system tables [system.quotas_usage ](../../operations/system-tables/quotas_usage.md#system_tables-quotas_usage ) and [system.quota_usage ](../../operations/system-tables/quota_usage.md#system_tables-quota_usage ).
### Syntax {#show-quota-syntax}
``` sql
SHOW [CURRENT] QUOTA
```
2021-01-23 05:33:05 +00:00
## SHOW ACCESS {#show-access-statement}
Shows all [users ](../../operations/access-rights.md#user-account-management ), [roles ](../../operations/access-rights.md#role-management ), [profiles ](../../operations/access-rights.md#settings-profiles-management ), etc. and all their [grants ](../../sql-reference/statements/grant.md#grant-privileges ).
### Syntax {#show-access-syntax}
2020-09-08 07:35:24 +00:00
2021-01-23 05:33:05 +00:00
``` sql
SHOW ACCESS
```
2020-12-27 21:45:07 +00:00
## SHOW CLUSTER(s) {#show-cluster-statement}
Returns a list of clusters. All available clusters are listed in the [system.clusters ](../../operations/system-tables/clusters.md ) table.
2021-01-17 13:24:58 +00:00
!!! info "Note"
`SHOW CLUSTER name` query displays the contents of system.clusters table for this cluster.
2020-12-27 21:45:07 +00:00
### Syntax {#show-cluster-syntax}
``` sql
2021-01-19 17:45:56 +00:00
SHOW CLUSTER '< name > '
2021-06-15 12:21:44 +00:00
SHOW CLUSTERS [LIKE|NOT LIKE '< pattern > '] [LIMIT < N > ]
2020-12-27 21:45:07 +00:00
```
2021-06-15 12:21:44 +00:00
### Examples {#show-cluster-examples}
2020-12-27 21:45:07 +00:00
2021-01-17 13:24:58 +00:00
Query:
2020-12-27 21:45:07 +00:00
``` sql
SHOW CLUSTERS;
2021-01-17 13:24:58 +00:00
```
Result:
```text
┌─cluster──────────────────────────────────────┐
│ test_cluster_two_shards │
│ test_cluster_two_shards_internal_replication │
│ test_cluster_two_shards_localhost │
│ test_shard_localhost │
│ test_shard_localhost_secure │
│ test_unavailable_shard │
└──────────────────────────────────────────────┘
```
Query:
``` sql
SHOW CLUSTERS LIKE 'test%' LIMIT 1;
```
Result:
```text
┌─cluster─────────────────┐
│ test_cluster_two_shards │
└─────────────────────────┘
```
Query:
``` sql
SHOW CLUSTER 'test_shard_localhost' FORMAT Vertical;
```
Result:
```text
Row 1:
──────
cluster: test_shard_localhost
shard_num: 1
shard_weight: 1
replica_num: 1
host_name: localhost
host_address: 127.0.0.1
port: 9000
is_local: 1
user: default
default_database:
errors_count: 0
estimated_recovery_time: 0
2020-12-27 21:45:07 +00:00
```
2021-03-06 08:59:50 +00:00
## SHOW SETTINGS {#show-settings}
Returns a list of system settings and their values. Selects data from the [system.settings ](../../operations/system-tables/settings.md ) table.
**Syntax**
```sql
2021-03-06 09:26:55 +00:00
SHOW [CHANGED] SETTINGS LIKE|ILIKE < name >
2021-03-06 08:59:50 +00:00
```
**Clauses**
2021-03-10 07:03:03 +00:00
`LIKE|ILIKE` allow to specify a matching pattern for the setting name. It can contain globs such as `%` or `_` . `LIKE` clause is case-sensitive, `ILIKE` — case insensitive.
2021-03-06 08:59:50 +00:00
When the `CHANGED` clause is used, the query returns only settings changed from their default values.
**Examples**
Query with the `LIKE` clause:
```sql
SHOW SETTINGS LIKE 'send_timeout';
```
Result:
```text
┌─name─────────┬─type────┬─value─┐
│ send_timeout │ Seconds │ 300 │
└──────────────┴─────────┴───────┘
```
Query with the `ILIKE` clause:
```sql
SHOW SETTINGS ILIKE '%CONNECT_timeout%'
```
Result:
```text
┌─name────────────────────────────────────┬─type─────────┬─value─┐
│ connect_timeout │ Seconds │ 10 │
│ connect_timeout_with_failover_ms │ Milliseconds │ 50 │
│ connect_timeout_with_failover_secure_ms │ Milliseconds │ 100 │
└─────────────────────────────────────────┴──────────────┴───────┘
```
Query with the `CHANGED` clause:
```sql
SHOW CHANGED SETTINGS ILIKE '%MEMORY%'
```
Result:
```text
┌─name─────────────┬─type───┬─value───────┐
│ max_memory_usage │ UInt64 │ 10000000000 │
└──────────────────┴────────┴─────────────┘
```
**See Also**
- [system.settings ](../../operations/system-tables/settings.md ) table
[Original article ](https://clickhouse.tech/docs/en/sql-reference/statements/show/ ) <!--hide-->