Merge pull request #29017 from taosdata/enh/addDiskUsage

doc: update  db usage
This commit is contained in:
Shengliang Guan 2024-12-03 14:57:17 +08:00 committed by GitHub
commit 7a467df812
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 68 additions and 0 deletions

View File

@ -212,3 +212,18 @@ SHOW db_name.ALIVE;
```
Query the availability status of the database db_name, with return values of 0 (unavailable), 1 (fully available), or 2 (partially available, indicating that some VNODEs in the database are available while others are not).
## View DB Disk Usage
```sql
select * from INFORMATION_SCHEMA.INS_DISK_USAGE where db_name = 'db_name'
```
View the disk usage of each module in the DB.
```sql
SHOW db_name.disk_info;
```
View the compression ratio and disk usage of the database db_name
This command is essentially equivalent to `select sum(data1 + data2 + data3)/sum(raw_data), sum(data1 + data2 + data3) from information_schema.ins_disk_usage where db_name="dbname"`

View File

@ -325,3 +325,21 @@ Note: Users with SYSINFO set to 0 cannot view this table.
| 3 | db_name | VARCHAR(65) | Database name |
| 4 | table_name | VARCHAR(193) | Table name |
| 5 | condition | VARCHAR(49152) | Subtable permission filter condition |
## INS_DISK_USAGE
| # | **Column Name** | **Data type** | **Description**|
| --- | :----------: | ------------ | ------------------------|
| 1 | db_name | VARCHAR(32) | Database name
| 2 | vgroup_id | INT | vgroup ID
| 3 | wal | BIGINT | WAL file size, in KB
| 4 | data1 | BIGINT | Data file size on primary storage, in KB
| 5 | data2 | BIGINT | Data file size on secondary storage, in KB
| 6 | data3 | BIGINT | Data file size on tertiary storage, in KB
| 7 | cache_rdb | BIGINT | Size of last/last_row files, in KB
| 8 | table_meta | BIGINT | Size of meta files, in KB
| 9 | s3 | BIGINT | Size occupied on S3, in KB
| 10 | raw_data | BIGINT | Estimated size of raw data, in KB
note:

View File

@ -217,3 +217,21 @@ SHOW db_name.ALIVE;
```
查询数据库 db_name 的可用状态,返回值 0不可用 1完全可用 2部分可用即数据库包含的 VNODE 部分节点可用,部分节点不可用)
## 查看DB 的磁盘空间占用
```sql
select * from INFORMATION_SCHEMA.INS_DISK_USAGE where db_name = 'db_name'
```
查看DB各个模块所占用磁盘的大小
```sql
SHOW db_name.disk_info;
```
查看数据库 db_name 的数据压缩压缩率和数据在磁盘上所占用的大小
该命令本质上等同于 `select sum(data1 + data2 + data3)/sum(raw_data), sum(data1 + data2 + data3) from information_schema.ins_disk_usage where db_name="dbname"`

View File

@ -326,3 +326,20 @@ TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数
| 3 | db_name | VARCHAR(65) | 数据库名称
| 4 | table_name | VARCHAR(193) | 表名称
| 5 | condition | VARCHAR(49152) | 子表权限过滤条件
## INS_DISK_USAGE
| # | **列名** | **数据类型** | **说明** |
| --- | :----------: | ------------ | -------------------------------------------------------------------------------------------------------------------- |
| 1 | db_name | VARCHAR(32) | 数据库名称
| 2 | vgroup_id | INT | vgroup 的 ID
| 3 | wal | BIGINT | wal 文件大小, 单位为 K
| 4 | data1 | BIGINT | 一级存储上数据文件的大小,单位为KB
| 5 | data2 | BIGINT | 二级存储上数据文件的大小,单位为 KB
| 6 | data3 | BIGINT | 三级存储上数据文件的大小, 单位为KB
| 7 | cache_rdb | BIGINT | last/last_row 文件的大小,单位为KB
| 8 | table_meta | BIGINT | meta 文件的大小, 单位为KB
| 9 | s3 | BIGINT | s3 上占用的大小, 单位为KB
| 10 | raw_data | BIGINT | 预估的原始数据的大小, 单位为KB