Skip to content

Commit 02a2282

Browse files
authored
chore: add doc about information_schema (#2471)
* chore: add doc about information_schema * chore: add doc about information_schema
1 parent 769418a commit 02a2282

File tree

11 files changed

+238
-61
lines changed

11 files changed

+238
-61
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"label": "Information Schema"
3+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Information_Schema Tables
3+
---
4+
5+
## Information Schema
6+
7+
| Table | Description |
8+
|----------------------------------------------|------------------------------------------------|
9+
| [tables](information-schema-tables.md) | ANSI SQL standard metadata view for tables. |
10+
| [schemata](information-schema-schemata.md) | ANSI SQL standard metadata view for databases. |
11+
| [views](information-schema-views.md) | ANSI SQL standard metadata view for views. |
12+
| [keywords](information-schema-keywords.md) | ANSI SQL standard metadata view for keywords. |
13+
| [columns](information-schema-columns.md) | ANSI SQL standard metadata view for columns. |
14+
15+
16+
```sql
17+
SHOW VIEWS FROM INFORMATION_SCHEMA;
18+
╭─────────────────────────────╮
19+
│ Views_in_information_schema │
20+
│ String │
21+
├─────────────────────────────┤
22+
│ columns │
23+
│ key_column_usage │
24+
│ keywords │
25+
│ schemata │
26+
│ statistics │
27+
│ tables │
28+
│ views │
29+
╰─────────────────────────────╯
30+
31+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: information_schema.columns
3+
---
4+
5+
Contains information about columns of tables.
6+
7+
```sql
8+
desc information_schema.columns
9+
10+
╭─────────────────────────────────────────────────────────────────────────╮
11+
│ Field │ Type │ Null │ Default │ Extra │
12+
│ String │ String │ String │ String │ String │
13+
├──────────────────────────┼──────────────────┼────────┼─────────┼────────┤
14+
│ table_catalog │ VARCHAR │ NO │ '' │ │
15+
│ table_schema │ VARCHAR │ NO │ '' │ │
16+
│ table_name │ VARCHAR │ NO │ '' │ │
17+
│ column_name │ VARCHAR │ NO │ '' │ │
18+
│ ordinal_position │ TINYINT UNSIGNED │ NO │ 0 │ │
19+
│ column_default │ NULL │ NO │ NULL │ │
20+
│ column_comment │ VARCHAR │ NO │ '' │ │
21+
│ column_key │ NULL │ NO │ NULL │ │
22+
│ nullable │ TINYINT UNSIGNED │ YES │ NULL │ │
23+
│ is_nullable │ VARCHAR │ NO │ '' │ │
24+
│ data_type │ VARCHAR │ NO │ '' │ │
25+
│ column_type │ VARCHAR │ NO │ '' │ │
26+
│ character_maximum_length │ NULL │ NO │ NULL │ │
27+
│ character_octet_length │ NULL │ NO │ NULL │ │
28+
│ numeric_precision │ NULL │ NO │ NULL │ │
29+
│ numeric_precision_radix │ NULL │ NO │ NULL │ │
30+
│ numeric_scale │ NULL │ NO │ NULL │ │
31+
│ datetime_precision │ NULL │ NO │ NULL │ │
32+
│ character_set_catalog │ NULL │ NO │ NULL │ │
33+
│ character_set_schema │ NULL │ NO │ NULL │ │
34+
│ character_set_name │ NULL │ NO │ NULL │ │
35+
│ collation_catalog │ NULL │ NO │ NULL │ │
36+
│ collation_schema │ NULL │ NO │ NULL │ │
37+
│ collation_name │ NULL │ NO │ NULL │ │
38+
│ domain_catalog │ NULL │ NO │ NULL │ │
39+
│ domain_schema │ NULL │ NO │ NULL │ │
40+
│ domain_name │ NULL │ NO │ NULL │ │
41+
│ privileges │ NULL │ NO │ NULL │ │
42+
│ default │ VARCHAR │ NO │ '' │ │
43+
│ extra │ NULL │ NO │ NULL │ │
44+
╰─────────────────────────────────────────────────────────────────────────╯
45+
46+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: information_schema.keywords
3+
---
4+
5+
The `information_schema.keywords` system table is a view that provides all keywords in Databend
6+
7+
```sql
8+
DESCRIBE information_schema.keywords
9+
10+
╭─────────────────────────────────────────────────────────╮
11+
│ Field │ Type │ Null │ Default │ Extra │
12+
│ String │ String │ String │ String │ String │
13+
├──────────┼──────────────────┼────────┼─────────┼────────┤
14+
│ keywords │ VARCHAR │ NO │ '' │ │
15+
│ reserved │ TINYINT UNSIGNED │ NO │ 0 │ │
16+
╰─────────────────────────────────────────────────────────╯
17+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: information_schema.schemata
3+
---
4+
5+
Provides metadata about all databases in the system.
6+
7+
```sql
8+
desc information_schema.schemata
9+
10+
╭─────────────────────────────────────────────────────────────────────╮
11+
│ Field │ Type │ Null │ Default │ Extra │
12+
│ String │ String │ String │ String │ String │
13+
├───────────────────────────────┼─────────┼────────┼─────────┼────────┤
14+
│ catalog_name │ VARCHAR │ NO │ '' │ │
15+
│ schema_name │ VARCHAR │ NO │ '' │ │
16+
│ schema_owner │ VARCHAR │ NO │ '' │ │
17+
│ default_character_set_catalog │ NULL │ NO │ NULL │ │
18+
│ default_character_set_schema │ NULL │ NO │ NULL │ │
19+
│ default_character_set_name │ NULL │ NO │ NULL │ │
20+
│ default_collation_name │ NULL │ NO │ NULL │ │
21+
│ sql_path │ NULL │ NO │ NULL │ │
22+
╰─────────────────────────────────────────────────────────────────────╯
23+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: information_schema.tables
3+
---
4+
5+
The `information_schema.tables` system table is a view that provides metadata about all tables across all databases, including their schema, type, engine, and creation details. It also includes storage metrics such as data length, index length, and row count, offering insights into table structure and usage.
6+
7+
8+
```sql
9+
DESCRIBE information_schema.tables;
10+
11+
┌────────────────────────────────────────────────────────────────────────────────────┐
12+
│ Field │ Type │ Null │ Default │ Extra │
13+
├─────────────────┼─────────────────┼────────┼──────────────────────────────┼────────┤
14+
│ table_catalog │ VARCHAR │ NO │ '' │ │
15+
│ table_schema │ VARCHAR │ NO │ '' │ │
16+
│ table_name │ VARCHAR │ NO │ '' │ │
17+
│ table_type │ VARCHAR │ NO │ '' │ │
18+
│ engine │ VARCHAR │ NO │ '' │ │
19+
│ create_time │ TIMESTAMP │ NO │ '1970-01-01 00:00:00.000000' │ │
20+
│ drop_time │ TIMESTAMP │ YES │ NULL │ │
21+
│ data_length │ BIGINT UNSIGNED │ YES │ NULL │ │
22+
│ index_length │ BIGINT UNSIGNED │ YES │ NULL │ │
23+
│ table_rows │ BIGINT UNSIGNED │ YES │ NULL │ │
24+
│ auto_increment │ NULL │ NO │ NULL │ │
25+
│ table_collation │ NULL │ NO │ NULL │ │
26+
│ data_free │ NULL │ NO │ NULL │ │
27+
│ table_comment │ VARCHAR │ NO │ '' │ │
28+
└────────────────────────────────────────────────────────────────────────────────────┘
29+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: information_schema.views
3+
---
4+
5+
Provides metadata information for all views.
6+
7+
See also:
8+
9+
- [SHOW VIEWS](../../10-sql-commands/00-ddl/05-view/show-views.md)
10+
11+
```sql
12+
DESCRIBE information_schema.views;
13+
14+
╭───────────────────────────────────────────────────────────────────────────╮
15+
│ Field │ Type │ Null │ Default │ Extra │
16+
│ String │ String │ String │ String │ String │
17+
├────────────────────────────┼──────────────────┼────────┼─────────┼────────┤
18+
│ table_catalog │ VARCHAR │ NO │ '' │ │
19+
│ table_schema │ VARCHAR │ NO │ '' │ │
20+
│ table_name │ VARCHAR │ NO │ '' │ │
21+
│ view_definition │ VARCHAR │ NO │ '' │ │
22+
│ check_option │ VARCHAR │ NO │ '' │ │
23+
│ is_updatable │ TINYINT UNSIGNED │ NO │ 0 │ │
24+
│ is_insertable_into │ BOOLEAN │ NO │ false │ │
25+
│ is_trigger_updatable │ TINYINT UNSIGNED │ NO │ 0 │ │
26+
│ is_trigger_deletable │ TINYINT UNSIGNED │ NO │ 0 │ │
27+
│ is_trigger_insertable_into │ TINYINT UNSIGNED │ NO │ 0 │ │
28+
╰───────────────────────────────────────────────────────────────────────────╯
29+
```

docs/en/sql-reference/00-sql-reference/31-system-tables/index.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ System tables are organized in the `system` schema and can be queried using stan
1212

1313
### Database & Table Metadata
1414

15-
| Table | Description |
16-
|-------|-------------|
17-
| [system.tables](system-tables.md) | Provides metadata information for all tables including properties, creation time, size, and more. |
18-
| [system.tables_with_history](system-tables-with-history.md) | Provides historical metadata information for tables, including dropped tables. |
19-
| [system.databases](system-databases.md) | Contains information about all databases in the system. |
20-
| [system.databases_with_history](system-databases-with-history.md) | Contains historical information about databases, including dropped databases. |
21-
| [system.columns](system-columns.md) | Provides information about columns in all tables. |
22-
| [system.indexes](system-indexes.md) | Contains information about table indexes. |
23-
| [system.virtual_columns](system-virtual-columns.md) | Lists virtual columns available in the system. |
15+
| Table | Description |
16+
|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
17+
| [system.tables](system-tables.md) | Provides metadata information for all tables including properties, creation time, size, and more. |
18+
| [system.tables_with_history](system-tables-with-history.md) | Provides historical metadata information for tables, including dropped tables. |
19+
| [system.databases](system-databases.md) | Contains information about all databases in the system. |
20+
| [system.views](system-views.md) | Contains information about all views in the system. |
21+
| [system.databases_with_history](system-databases-with-history.md) | Contains historical information about databases, including dropped databases. |
22+
| [system.columns](system-columns.md) | Provides information about columns in all tables. |
23+
| [system.indexes](system-indexes.md) | Contains information about table indexes. |
24+
| [system.virtual_columns](system-virtual-columns.md) | Lists virtual columns available in the system. |
2425

2526
### Query & Performance
2627

@@ -59,10 +60,3 @@ System tables are organized in the `system` schema and can be queried using stan
5960
| [system.streams](system-streams.md) | Contains information about streams in the system. |
6061
| [system.temp_tables](system-temp-tables.md) | Contains information about temporary tables. |
6162
| [system.temp_files](system-temp-files.md) | Contains information about temporary files. |
62-
63-
### Information Schema
64-
65-
| Table | Description |
66-
|-------|-------------|
67-
| [information_schema.tables](information-schema-tables.md) | ANSI SQL standard metadata view for tables. |
68-

0 commit comments

Comments
 (0)