GBase 8a 元数据表介绍,分区information_schema.Partitions

GBase 8a数据库集群从V95版本开始支持分区,并在数据库的information_schema.partitions里记录了元数据信息。

其它分区表介绍,请参考:
GBase 8a集群支持分区表功能使用样例
GBase 8a 元数据表介绍
GBase 8a分区表指定特定分区的查询方法

样例表

create table p1(id int)
partition by range(id)(
  partition p1 values less than (10), 
  partition po values less than MAXVALUE
);

元数据查询结果

gbase> select * from information_schema.partitions where table_name='p1';
+---------------+--------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+---------------------+------------+----------+-------------------+-----------+-----------------+
| TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | PARTITION_ORDINAL_POSITION | SUBPARTITION_ORDINAL_POSITION | PARTITION_METHOD | SUBPARTITION_METHOD | PARTITION_EXPRESSION | SUBPARTITION_EXPRESSION | PARTITION_DESCRIPTION | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | MAX_DATA_LENGTH | INDEX_LENGTH | DATA_FREE | CREATE_TIME         | UPDATE_TIME         | CHECK_TIME | CHECKSUM | PARTITION_COMMENT | NODEGROUP | TABLESPACE_NAME |
+---------------+--------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+---------------------+------------+----------+-------------------+-----------+-----------------+
| NULL          | testdb       | p1         | p1             | NULL              |                          1 |                          NULL | RANGE            | NULL                | id                   | NULL                    | 10                    |          0 |              0 |           0 |            NULL |            0 |         0 | 2020-09-05 02:50:09 | 2020-09-05 02:50:09 | NULL       |     NULL |                   | default   | NULL            |
| NULL          | testdb       | p1         | po             | NULL              |                          2 |                          NULL | RANGE            | NULL                | id                   | NULL                    | MAXVALUE              |          0 |              0 |           0 |            NULL |            0 |         0 | 2020-09-05 02:50:09 | 2020-09-05 02:50:09 | NULL       |     NULL |                   | default   | NULL            |
+---------------+--------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+---------------------+------------+----------+-------------------+-----------+-----------------+
2 rows in set (Elapsed: 00:00:00.01)

gbase> select * from partitions where table_name='p1'\G
*************************** 1. row ***************************
                TABLE_CATALOG: NULL
                 TABLE_SCHEMA: testdb
                   TABLE_NAME: p1
               PARTITION_NAME: p1
            SUBPARTITION_NAME: NULL
   PARTITION_ORDINAL_POSITION: 1
SUBPARTITION_ORDINAL_POSITION: NULL
             PARTITION_METHOD: RANGE
          SUBPARTITION_METHOD: NULL
         PARTITION_EXPRESSION: id
      SUBPARTITION_EXPRESSION: NULL
        PARTITION_DESCRIPTION: 10
                   TABLE_ROWS: 0
               AVG_ROW_LENGTH: 0
                  DATA_LENGTH: 0
              MAX_DATA_LENGTH: NULL
                 INDEX_LENGTH: 0
                    DATA_FREE: 0
                  CREATE_TIME: 2020-09-05 02:50:09
                  UPDATE_TIME: 2020-09-05 02:50:09
                   CHECK_TIME: NULL
                     CHECKSUM: NULL
            PARTITION_COMMENT:
                    NODEGROUP: default
              TABLESPACE_NAME: NULL
*************************** 2. row ***************************
                TABLE_CATALOG: NULL
                 TABLE_SCHEMA: testdb
                   TABLE_NAME: p1
               PARTITION_NAME: po
            SUBPARTITION_NAME: NULL
   PARTITION_ORDINAL_POSITION: 2
SUBPARTITION_ORDINAL_POSITION: NULL
             PARTITION_METHOD: RANGE
          SUBPARTITION_METHOD: NULL
         PARTITION_EXPRESSION: id
      SUBPARTITION_EXPRESSION: NULL
        PARTITION_DESCRIPTION: MAXVALUE
                   TABLE_ROWS: 0
               AVG_ROW_LENGTH: 0
                  DATA_LENGTH: 0
              MAX_DATA_LENGTH: NULL
                 INDEX_LENGTH: 0
                    DATA_FREE: 0
                  CREATE_TIME: 2020-09-05 02:50:09
                  UPDATE_TIME: 2020-09-05 02:50:09
                   CHECK_TIME: NULL
                     CHECKSUM: NULL
            PARTITION_COMMENT:
                    NODEGROUP: default
              TABLESPACE_NAME: NULL
2 rows in set (Elapsed: 00:00:00.00)

表结构描述

列名含义
TABLE_CATALOG                
TABLE_SCHEMA                 库名
TABLE_NAME                   表名
PARTITION_NAME               分区名字
SUBPARTITION_NAME            
PARTITION_ORDINAL_POSITION   位置
SUBPARTITION_ORDINAL_POSITION 
PARTITION_METHOD             分区类型,比如RANGE
SUBPARTITION_METHOD          
PARTITION_EXPRESSION         分区表达式或值
SUBPARTITION_EXPRESSION      
PARTITION_DESCRIPTION        描述
TABLE_ROWS                   分区里的行数(gnode分片才有)
AVG_ROW_LENGTH               平均行宽
DATA_LENGTH                  数据长度
MAX_DATA_LENGTH              
INDEX_LENGTH                 
DATA_FREE                    
CREATE_TIME                  创建时间
UPDATE_TIME                  更新时间
CHECK_TIME                   
CHECKSUM                     
PARTITION_COMMENT            备注
NODEGROUP                    default
TABLESPACE_NAME  表空间名字

参考

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注