PARTITIONS
PARTITIONS 表提供了关于分区表的信息。
USE INFORMATION_SCHEMA;
DESC PARTITIONS;
结果如下:
+-------------------------------+----------+------+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+-------------------------------+----------+------+------+---------+---------------+
| table_catalog | String | | NO | | FIELD |
| table_schema | String | | NO | | FIELD |
| table_name | String | | NO | | FIELD |
| partition_name | String | | NO | | FIELD |
| subpartition_name | String | | YES | | FIELD |
| partition_ordinal_position | Int64 | | YES | | FIELD |
| subpartition_ordinal_position | Int64 | | YES | | FIELD |
| partition_method | String | | YES | | FIELD |
| subpartition_method | String | | YES | | FIELD |
| partition_expression | String | | YES | | FIELD |
| subpartition_expression | String | | YES | | FIELD |
| partition_description | String | | YES | | FIELD |
| table_rows | Int64 | | YES | | FIELD |
| avg_row_length | Int64 | | YES | | FIELD |
| data_length | Int64 | | YES | | FIELD |
| max_data_length | Int64 | | YES | | FIELD |
| index_length | Int64 | | YES | | FIELD |
| data_free | Int64 | | YES | | FIELD |
| create_time | TimestampSecond | | YES | | FIELD |
| update_time | TimestampSecond | | YES | | FIELD |
| check_time | TimestampSecond | | YES | | FIELD |
| checksum | Int64 | | YES | | FIELD |
| partition_comment | String | | YES | | FIELD |
| nodegroup | String | | YES | | FIELD |
| tablespace_name | String | | YES | | FIELD |
| greptime_partition_id | UInt64 | | YES | | FIELD |
+-------------------------------+----------+------+------+---------+---------------+
26 rows in set (0.01 sec)
主要列包括:
table_catalog:表所属 catalog 的名称,通常为greptime。table_schema:表所属的 schema(数据库)的名称。table_name:包含分区(region)的表的名称。partition_name:分区(region)的名称。partition_ordinal_position:所有分区按照定义的顺序进行索引,1 是分配给第一个分区的编号。partition_method:该值始终为RANGE,GreptimeDB 仅支持范围分区。partition_expression:该分区的表达式。create_time:分区创建的时间。greptime_partition_id:GreptimeDB 扩展字段,也就是 Region Id。