spqplugin_v2系统表及视图说明
pg_dist_node
描述:系统表,存储集群中所有节点的信息
示例:
openGauss=# select * from pg_dist_node; nodeid | groupid | nodename | nodeport | noderack | hasmetadata | isactive | noderole | nodecluster | metadatasynced | shouldhaveshards --------+---------+-----------+----------+----------+-------------+----------+----------+-------------+----------------+------------------ 1 | 0 | 127.0.0.1 | 15432 | default | t | t | primary | default | t | f 2 | 1 | 127.0.0.1 | 15532 | default | f | t | primary | default | f | t 3 | 2 | 127.0.0.1 | 15632 | default | f | t | primary | default | f | t (3 rows)
pg_dist_partition
描述:系统表,存储分布式表的定义
分布式表表名 当前版本唯一值为'h',代表hash分区 分区列的信息 colocationid 当前版本不使用 repmodel 当前版本不使用 autoconverted 当前版本不使用 示例:
openGauss=# select * from pg_dist_partition; logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted --------------+------------+------------------------------------------------------------------------------------------------------------------------+--------------+----------+--------------- t1 | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1 | s | f (1 row)
pg_dist_shard
描述:系统表,存储分布式表每个分片的信息
分布式表表名 分片编号 存储类型,当前仅支持't',即普通表 shardminvalue 当前shard的hash分区的最小hash值 shardmaxvalue 当前shard的hash分区的最大hash值 示例:
openGauss=# select * from pg_dist_shard; logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue --------------+---------+--------------+---------------+--------------- t1 | 62025 | t | -2147483648 | -1073741825 t1 | 62026 | t | -1073741824 | -1 t1 | 62027 | t | 0 | 1073741823 t1 | 62028 | t | 1073741824 | 2147483647 (4 rows)
pg_dist_placement
描述:系统表,存储分布式表每个分片的位置信息
placementid 自增唯一标识 分片编号 分片状态 shardlength 对于hash分区,恒为0 groupid 唯一标识一组节点 示例:
openGauss=# select * from pg_dist_placement; placementid | shardid | shardstate | shardlength | groupid -------------+---------+------------+-------------+--------- 1 | 62025 | 1 | 0 | 1 2 | 62026 | 1 | 0 | 2 3 | 62027 | 1 | 0 | 1 4 | 62028 | 1 | 0 | 2 (4 rows)
spq_shards
描述:视图,查看所有的分片信息
table_name 表名 shardid 分片编号 分片名 表类型 nodename 节点IP或域名 nodeport 节点端口 shard_size 分片大小 示例:
openGauss=# select * from spq_shards; table_name | shardid | shard_name | table_type | nodename | nodeport | shard_size ------------+---------+------------+-------------+-----------+----------+------------ t1 | 62025 | t1_62025 | distributed | 127.0.0.1 | 15532 | 8192 t1 | 62026 | t1_62026 | distributed | 127.0.0.1 | 15632 | 8192 t1 | 62027 | t1_62027 | distributed | 127.0.0.1 | 15532 | 0 t1 | 62028 | t1_62028 | distributed | 127.0.0.1 | 15632 | 8192 (4 rows)
spq_tables
描述:视图,查看所有分布式表信息
table_name 表名 table_type 表类型 分片列 表大小 shard_count 分片数量 table_owner 属主 access_method 当前版本不使用 示例:
openGauss=# select * from spq_tables; table_name | table_type | distribution_column | table_size | shard_count | table_owner | access_method ------------+-------------+---------------------+------------+-------------+-------------+--------------- t1 | distributed | a | 24 kB | 4 | openGauss | (1 row)
意见反馈