24-show.md 7.7 KB
Newer Older
G
gccgdb1234 已提交
1
---
2
title: SHOW Statement for Metadata
D
danielclow 已提交
3 4
sidebar_label: SHOW Statement
description: This document describes how to use the SHOW statement in TDengine.
G
gccgdb1234 已提交
5 6
---

7
`SHOW` command can be used to get brief system information. To get details about metadata, information, and status in the system, please use `select` to query the tables in database `INFORMATION_SCHEMA`.
G
gccgdb1234 已提交
8 9 10 11 12 13 14

## SHOW APPS

```sql
SHOW APPS;
```

15
Shows all clients (such as applications) that connect to the cluster.
G
gccgdb1234 已提交
16 17 18 19 20 21 22

## SHOW CLUSTER

```sql
SHOW CLUSTER;
```

23
Shows information about the current cluster.
G
gccgdb1234 已提交
24 25 26 27 28 29 30

## SHOW CONNECTIONS

```sql
SHOW CONNECTIONS;
```

31
Shows information about connections to the system.
G
gccgdb1234 已提交
32 33 34 35 36 37 38

## SHOW CONSUMERS

```sql
SHOW CONSUMERS;
```

wmmhello's avatar
wmmhello 已提交
39
Shows information about all consumers in the system.
G
gccgdb1234 已提交
40 41 42 43 44 45 46

## SHOW CREATE DATABASE

```sql
SHOW CREATE DATABASE db_name;
```

47
Shows the SQL statement used to create the specified database.
G
gccgdb1234 已提交
48 49 50 51 52 53 54

## SHOW CREATE STABLE

```sql
SHOW CREATE STABLE [db_name.]stb_name;
```

55
Shows the SQL statement used to create the specified supertable.
G
gccgdb1234 已提交
56 57 58 59 60 61 62

## SHOW CREATE TABLE

```sql
SHOW CREATE TABLE [db_name.]tb_name
```

63
Shows the SQL statement used to create the specified table. This statement can be used on supertables, standard tables, and subtables.
G
gccgdb1234 已提交
64 65 66 67 68 69 70

## SHOW DATABASES

```sql
SHOW DATABASES;
```

71
Shows all user-created databases.
G
gccgdb1234 已提交
72 73 74 75 76 77 78

## SHOW DNODES

```sql
SHOW DNODES;
```

79
Shows all dnodes in the system.
G
gccgdb1234 已提交
80 81 82 83 84 85 86

## SHOW FUNCTIONS

```sql
SHOW FUNCTIONS;
```

87
Shows all user-defined functions in the system.
G
gccgdb1234 已提交
88

89
## SHOW LICENCES
G
gccgdb1234 已提交
90 91

```sql
92
SHOW LICENCES;
G
gccgdb1234 已提交
93 94 95
SHOW GRANTS;
```

96
Shows information about the TDengine Enterprise Edition license.
G
gccgdb1234 已提交
97

98
Note: TDengine Enterprise Edition only.
G
gccgdb1234 已提交
99 100 101 102 103 104 105

## SHOW INDEXES

```sql
SHOW INDEXES FROM tbl_name [FROM db_name];
```

106
Shows indices that have been created.
G
gccgdb1234 已提交
107 108 109 110 111 112 113

## SHOW LOCAL VARIABLES

```sql
SHOW LOCAL VARIABLES;
```

114
Shows the working configuration of the client.
G
gccgdb1234 已提交
115 116 117 118 119 120 121

## SHOW MNODES

```sql
SHOW MNODES;
```

122
Shows information about mnodes in the system.
G
gccgdb1234 已提交
123 124 125 126 127 128 129

## SHOW QNODES

```sql
SHOW QNODES;
```

130
Shows information about qnodes in the system.
G
gccgdb1234 已提交
131

W
wade zhang 已提交
132 133 134 135 136 137 138 139
## SHOW QUERIES

```sql
SHOW QUERIES;
```

Shows the queries in progress in the system.

G
gccgdb1234 已提交
140 141 142 143 144 145
## SHOW SCORES

```sql
SHOW SCORES;
```

146
Shows information about the storage space allowed by the license.
G
gccgdb1234 已提交
147

148
Note: TDengine Enterprise Edition only.
G
gccgdb1234 已提交
149 150 151 152 153 154 155

## SHOW STABLES

```sql
SHOW [db_name.]STABLES [LIKE 'pattern'];
```

156
Shows all supertables in the current database. You can use LIKE for fuzzy matching.
G
gccgdb1234 已提交
157 158 159 160 161 162 163

## SHOW STREAMS

```sql
SHOW STREAMS;
```

164
Shows information about streams in the system.
G
gccgdb1234 已提交
165 166 167 168 169 170 171

## SHOW SUBSCRIPTIONS

```sql
SHOW SUBSCRIPTIONS;
```

W
wade zhang 已提交
172
Shows all subscriptions in the system.
G
gccgdb1234 已提交
173 174 175 176 177 178 179

## SHOW TABLES

```sql
SHOW [db_name.]TABLES [LIKE 'pattern'];
```

180
Shows all standard tables and subtables in the current database. You can use LIKE for fuzzy matching.
G
gccgdb1234 已提交
181 182 183 184 185 186 187

## SHOW TABLE DISTRIBUTED

```sql
SHOW TABLE DISTRIBUTED table_name;
```

188
Shows how table data is distributed.
G
gccgdb1234 已提交
189

190
Examples: Below is an example of this command to display the block distribution of table `d0` in detailed format.
191

W
wade zhang 已提交
192
```sql
193
show table distributed d0\G;
W
wade zhang 已提交
194 195 196 197 198
```

<details>
 <summary> Show Example </summary>
 <pre><code>
199
*************************** 1.row ***************************
200
_block_dist: Total_Blocks=[5] Total_Size=[93.65 KB] Average_size=[18.73 KB] Compression_Ratio=[23.98 %]
201 202

Total_Blocks :  Table `d0` contains total 5 blocks
W
wade zhang 已提交
203

204
Total_Size:  The total size of all the data blocks in table `d0` is 93.65 KB
W
wade zhang 已提交
205

206
Average_size:  The average size of each block is 18.73 KB
W
wade zhang 已提交
207

208
Compression_Ratio: The data compression rate is 23.98%
209

210 211 212 213
*************************** 2.row ***************************
_block_dist: Total_Rows=[20000] Inmem_Rows=[0] MinRows=[3616] MaxRows=[4096] Average_Rows=[4000]

Total_Rows: Table `d0` contains 20,000 rows
W
wade zhang 已提交
214

215
Inmem_Rows: The rows still in memory, i.e. not committed in disk, is 0, i.e. none such rows
W
wade zhang 已提交
216

217
MinRows: The minimum number of rows in a block is 3,616
W
wade zhang 已提交
218

219
MaxRows: The maximum number of rows in a block is 4,096B
W
wade zhang 已提交
220

221
Average_Rows: The average number of rows in a block is 4,000
222 223 224 225

*************************** 3.row ***************************
_block_dist: Total_Tables=[1] Total_Files=[2]

226
Total_Tables: The number of child tables, 1 in this example
W
wade zhang 已提交
227

228
Total_Files: The number of files storing the table's data, 2 in this example
229 230

*************************** 4.row ***************************
W
wade zhang 已提交
231

232
_block_dist: --------------------------------------------------------------------------------
W
wade zhang 已提交
233

234
*************************** 5.row ***************************
W
wade zhang 已提交
235

236
_block_dist: 0100 |
W
wade zhang 已提交
237

238
*************************** 6.row ***************************
W
wade zhang 已提交
239

240
_block_dist: 0299 |
W
wade zhang 已提交
241

242
*************************** 7.row ***************************
W
wade zhang 已提交
243

244
_block_dist: 0498 |
W
wade zhang 已提交
245

246
*************************** 8.row ***************************
W
wade zhang 已提交
247

248
_block_dist: 0697 |
W
wade zhang 已提交
249

250
*************************** 9.row ***************************
W
wade zhang 已提交
251

252
_block_dist: 0896 |
W
wade zhang 已提交
253

254
*************************** 10.row ***************************
W
wade zhang 已提交
255

256
_block_dist: 1095 |
W
wade zhang 已提交
257

258
*************************** 11.row ***************************
W
wade zhang 已提交
259

260
_block_dist: 1294 |
W
wade zhang 已提交
261

262
*************************** 12.row ***************************
W
wade zhang 已提交
263

264
_block_dist: 1493 |
W
wade zhang 已提交
265

266
*************************** 13.row ***************************
W
wade zhang 已提交
267

268
_block_dist: 1692 |
W
wade zhang 已提交
269

270
*************************** 14.row ***************************
W
wade zhang 已提交
271

272
_block_dist: 1891 |
W
wade zhang 已提交
273

274
*************************** 15.row ***************************
W
wade zhang 已提交
275

276
_block_dist: 2090 |
W
wade zhang 已提交
277

278
*************************** 16.row ***************************
W
wade zhang 已提交
279

280
_block_dist: 2289 |
W
wade zhang 已提交
281

282
*************************** 17.row ***************************
W
wade zhang 已提交
283

284
_block_dist: 2488 |
W
wade zhang 已提交
285

286
*************************** 18.row ***************************
W
wade zhang 已提交
287

288
_block_dist: 2687 |
W
wade zhang 已提交
289

290
*************************** 19.row ***************************
W
wade zhang 已提交
291

292
_block_dist: 2886 |
W
wade zhang 已提交
293

294
*************************** 20.row ***************************
W
wade zhang 已提交
295

296
_block_dist: 3085 |
W
wade zhang 已提交
297

298
*************************** 21.row ***************************
W
wade zhang 已提交
299

300
_block_dist: 3284 |
W
wade zhang 已提交
301

302
*************************** 22.row ***************************
W
wade zhang 已提交
303

304
_block_dist: 3483 |||||||||||||||||  1 (20.00%)
W
wade zhang 已提交
305

306
*************************** 23.row ***************************
W
wade zhang 已提交
307

308
_block_dist: 3682 |
W
wade zhang 已提交
309

310
*************************** 24.row ***************************
W
wade zhang 已提交
311

312
_block_dist: 3881 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  4 (80.00%)
W
wade zhang 已提交
313

314 315
Query OK, 24 row(s) in set (0.002444s)

W
wade zhang 已提交
316 317 318
</code></pre>
</details>

X
Xiaoyu Wang 已提交
319 320 321 322 323
The above show the block distribution percentage according to the number of rows in each block. In the above example, we can get below information:
- `_block_dist: 3483 |||||||||||||||||  1 (20.00%)` means there is one block whose rows is between 3,483 and 3,681.
-  `_block_dist: 3881 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  4 (80.00%)` means there are 4 blocks whose rows is between 3,881 and 4,096.   -  The number of blocks whose rows fall in other range is zero.

Note that only the information about the data blocks in the data file will be displayed here, and the information about the data in the stt file will not be displayed.
324

G
gccgdb1234 已提交
325 326 327 328 329 330
## SHOW TAGS

```sql
SHOW TAGS FROM child_table_name [FROM db_name];
```

331
Shows all tag information in a subtable.
G
gccgdb1234 已提交
332 333 334 335 336 337 338

## SHOW TOPICS

```sql
SHOW TOPICS;
```

339
Shows all topics in the current database.
G
gccgdb1234 已提交
340 341 342 343 344 345 346

## SHOW TRANSACTIONS

```sql
SHOW TRANSACTIONS;
```

347
Shows all running transactions in the system.
G
gccgdb1234 已提交
348 349 350 351 352 353 354

## SHOW USERS

```sql
SHOW USERS;
```

355
Shows information about users on the system. This includes user-created users and system-defined users.
G
gccgdb1234 已提交
356 357 358 359 360 361 362 363

## SHOW VARIABLES

```sql
SHOW VARIABLES;
SHOW DNODE dnode_id VARIABLES;
```

364
Shows the working configuration of the parameters that must be the same on each node. You can also specify a dnode to show the working configuration for that node.
G
gccgdb1234 已提交
365 366 367 368 369 370 371

## SHOW VGROUPS

```sql
SHOW [db_name.]VGROUPS;
```

372
Shows information about all vgroups in the current database.
G
gccgdb1234 已提交
373 374 375 376

## SHOW VNODES

```sql
377
SHOW VNODES {dnode_id | dnode_endpoint};
G
gccgdb1234 已提交
378 379
```

380
Shows information about all vnodes in the system or about the vnodes for a specified dnode.