数据仓库服务 GAUSSDB(DWS)-其它函数:gs_table_distribution(schemaname text, tablename text)

时间:2024-09-05 10:32:17

gs_table_distribution(schemaname text, tablename text)

描述:快速查看指定表在各个节点上占用的存储空间。

返回值类型:record

表1 gs_table_distribution(schemaname text, tablename text)函数返回字段

名称

类型

描述

schemaname

name

模式名称。

tablename

name

表名。

relkind

character

类型。

  • i:索引
  • r:表

nodename

name

节点名称。

dnsize

bigint

表在该节点上的存储空间大小,单位:字节。

  • 使用本函数查询指定表存储分布信息,需要具备指定表的SELECT权限。
  • 该函数基于PG_RELFILENODE_SIZE系统表上的物理文件存储空间记录,需确保GUC参数use_workload_manager和enable_perm_space必须开启。
  • 性能上,单表查询时,gs_table_distribution函数低于table_distribution函数;在全库表查询时,gs_table_distribution函数大幅度优于table_distribution函数;在大集群大数据量场景下,如果进行全库表表查询,建议优先使用gs_table_distribution函数。
support.huaweicloud.com/sqlreference-830-dws/dws_06_0062.html