Skip to content

Commit 90fffb9

Browse files
committed
system.tables
1 parent b40aad3 commit 90fffb9

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: system.tables
3+
---
4+
5+
Provides metadata information for all tables. It includes details such as table properties, creation time, number of rows, data size, and more.
6+
7+
See also: [SHOW TABLES](../../10-sql-commands/00-ddl/01-table/show-tables.md)
8+
9+
```sql title='Examples:'
10+
SELECT * FROM system.tables LIMIT 3;
11+
12+
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
13+
│ catalog │ database │ name │ table_id │ total_columns │ engine │ engine_full │ cluster_by │ is_transient │ is_attach │ created_on │ dropped_on │ updated_on │ num_rows │ data_size │ data_compressed_size │ index_size │ number_of_segments │ number_of_blocks │ owner │ comment │ table_type │
14+
├─────────┼──────────┼────────────────────┼─────────────────────┼───────────────┼───────────────────────┼───────────────────────┼────────────┼──────────────┼───────────┼────────────────────────────┼─────────────────────┼────────────────────────────┼──────────────────┼──────────────────┼──────────────────────┼──────────────────┼────────────────────┼──────────────────┼──────────────────┼─────────┼────────────┤
15+
│ default │ system │ metrics │ 46116860184273879195 │ SystemMetrics │ SystemMetrics │ │ │ │ 2024-11-20 21:04:12.950815NULL2024-11-20 21:04:12.950815NULLNULLNULLNULLNULLNULLNULL │ │ BASE TABLE │
16+
│ default │ system │ clustering_history │ 46116860184273879256 │ SystemLogTable │ SystemLogTable │ │ │ │ 2024-11-20 21:04:12.952439NULL2024-11-20 21:04:12.952439NULLNULLNULLNULLNULLNULLNULL │ │ BASE TABLE │
17+
│ default │ system │ queries_profiling │ 46116860184273879417 │ QueriesProfilingTable │ QueriesProfilingTable │ │ │ │ 2024-11-20 21:04:12.952588NULL2024-11-20 21:04:12.952588NULLNULLNULLNULLNULLNULLNULL │ │ BASE TABLE │
18+
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
19+
```
20+
21+
To show the schema of `system.tables`, use `DESCRIBE system.tables`:
22+
23+
```sql
24+
DESCRIBE system.tables;
25+
26+
┌─────────────────────────────────────────────────────────────────────────────────────────┐
27+
│ Field │ Type │ Null │ Default │ Extra │
28+
├──────────────────────┼─────────────────┼────────┼──────────────────────────────┼────────┤
29+
│ catalog │ VARCHAR │ NO │ '' │ │
30+
│ database │ VARCHAR │ NO │ '' │ │
31+
│ name │ VARCHAR │ NO │ '' │ │
32+
│ table_id │ BIGINT UNSIGNED │ NO │ 0 │ │
33+
│ total_columns │ BIGINT UNSIGNED │ NO │ 0 │ │
34+
│ engine │ VARCHAR │ NO │ '' │ │
35+
│ engine_full │ VARCHAR │ NO │ '' │ │
36+
│ cluster_by │ VARCHAR │ NO │ '' │ │
37+
│ is_transient │ VARCHAR │ NO │ '' │ │
38+
│ is_attach │ VARCHAR │ NO │ '' │ │
39+
│ created_on │ TIMESTAMP │ NO │ '1970-01-01 00:00:00.000000' │ │
40+
│ dropped_on │ TIMESTAMP │ YES │ NULL │ │
41+
│ updated_on │ TIMESTAMP │ NO │ '1970-01-01 00:00:00.000000' │ │
42+
│ num_rows │ BIGINT UNSIGNED │ YES │ NULL │ │
43+
│ data_size │ BIGINT UNSIGNED │ YES │ NULL │ │
44+
│ data_compressed_size │ BIGINT UNSIGNED │ YES │ NULL │ │
45+
│ index_size │ BIGINT UNSIGNED │ YES │ NULL │ │
46+
│ number_of_segments │ BIGINT UNSIGNED │ YES │ NULL │ │
47+
│ number_of_blocks │ BIGINT UNSIGNED │ YES │ NULL │ │
48+
│ owner │ VARCHAR │ YES │ NULL │ │
49+
│ comment │ VARCHAR │ NO │ '' │ │
50+
│ table_type │ VARCHAR │ NO │ '' │ │
51+
└─────────────────────────────────────────────────────────────────────────────────────────┘
52+
```

docs/en/sql-reference/10-sql-commands/00-ddl/01-table/show-tables.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Lists the tables in the current or a specified database.
1212
Starting from version 1.2.415, the SHOW TABLES command no longer includes views in its results. To display views, use [SHOW VIEWS](../05-view/show-views.md) instead.
1313
:::
1414

15+
See also: [system.tables](../../../00-sql-reference/20-system-tables/system-tables.md)
16+
1517
## Syntax
1618

1719
```sql

0 commit comments

Comments
 (0)