24-show.md 7.5 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
---

W
wade zhang 已提交
7
`SHOW` command can be used to get brief system information. To get details about metatadata, 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;
```

39
Shows information about all active 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 90 91 92 93 94 95

## SHOW LICENSE

```sql
SHOW LICENSE;
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 132 133 134 135 136 137

## SHOW SCORES

```sql
SHOW SCORES;
```

138
Shows information about the storage space allowed by the license.
G
gccgdb1234 已提交
139

140
Note: TDengine Enterprise Edition only.
G
gccgdb1234 已提交
141 142 143 144 145 146 147

## SHOW STABLES

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

148
Shows all supertables in the current database. You can use LIKE for fuzzy matching.
G
gccgdb1234 已提交
149 150 151 152 153 154 155

## SHOW STREAMS

```sql
SHOW STREAMS;
```

156
Shows information about streams in the system.
G
gccgdb1234 已提交
157 158 159 160 161 162 163

## SHOW SUBSCRIPTIONS

```sql
SHOW SUBSCRIPTIONS;
```

W
wade zhang 已提交
164
Shows all subscriptions in the system.
G
gccgdb1234 已提交
165 166 167 168 169 170 171

## SHOW TABLES

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

172
Shows all standard tables and subtables in the current database. You can use LIKE for fuzzy matching.
G
gccgdb1234 已提交
173 174 175 176 177 178 179

## SHOW TABLE DISTRIBUTED

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

180
Shows how table data is distributed.
G
gccgdb1234 已提交
181

W
wade zhang 已提交
182
Examples: Below is an example of this command to display the block distribution of table `d0` in detailed format.
183

W
wade zhang 已提交
184 185 186 187 188 189 190
```sql
show table distributed d0\G;   
```

<details>
 <summary> Show Example </summary>
 <pre><code>
191 192 193 194
*************************** 1.row ***************************
_block_dist: Total_Blocks=[5] Total_Size=[93.65 Kb] Average_size=[18.73 Kb] Compression_Ratio=[23.98 %]

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

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

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

200 201 202 203 204 205
Compression_Ratio: The data compression rate is 23.98%
 
*************************** 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 已提交
206

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

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

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

213 214 215 216 217 218
Average_Rows: The average number of rows in a block is 4,000

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

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

220 221 222
Total_Files:   The number of files storing the table's data, 2 in this example

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

224
_block_dist: --------------------------------------------------------------------------------
W
wade zhang 已提交
225

226
*************************** 5.row ***************************
W
wade zhang 已提交
227

228
_block_dist: 0100 |
W
wade zhang 已提交
229

230
*************************** 6.row ***************************
W
wade zhang 已提交
231

232
_block_dist: 0299 |
W
wade zhang 已提交
233

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

296
_block_dist: 3483 |||||||||||||||||  1 (20.00%)
W
wade zhang 已提交
297

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

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

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

304
_block_dist: 3881 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  4 (80.00%)
W
wade zhang 已提交
305

306 307
Query OK, 24 row(s) in set (0.002444s)

W
wade zhang 已提交
308 309 310
</code></pre>
</details>

W
wade zhang 已提交
311 312
  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.
W
wade zhang 已提交
313
  -  `_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.
314

G
gccgdb1234 已提交
315 316 317 318 319 320
## SHOW TAGS

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

321
Shows all tag information in a subtable.
G
gccgdb1234 已提交
322 323 324 325 326 327 328

## SHOW TOPICS

```sql
SHOW TOPICS;
```

329
Shows all topics in the current database.
G
gccgdb1234 已提交
330 331 332 333 334 335 336

## SHOW TRANSACTIONS

```sql
SHOW TRANSACTIONS;
```

337
Shows all running transactions in the system.
G
gccgdb1234 已提交
338 339 340 341 342 343 344

## SHOW USERS

```sql
SHOW USERS;
```

345
Shows information about users on the system. This includes user-created users and system-defined users.
G
gccgdb1234 已提交
346 347 348 349 350 351 352 353

## SHOW VARIABLES

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

354
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 已提交
355 356 357 358 359 360 361

## SHOW VGROUPS

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

362
Shows information about all vgroups in the system or about the vgroups for a specified database.
G
gccgdb1234 已提交
363 364 365 366

## SHOW VNODES

```sql
367
SHOW VNODES {dnode_id | dnode_endpoint};
G
gccgdb1234 已提交
368 369
```

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