数据仓库服务 GAUSSDB(DWS)-系统表信息函数:table_distribution()

时间:2024-12-24 10:32:44

table_distribution()

描述:查看当前库中所有表在各节点的存储空间分布情况。

返回值类型:record

  • 使用本函数涉及全库表信息查询,需要具备管理员权限或预置角色gs_role_read_all_stats权限。

当前基于table_distribution()函数, GaussDB (DWS)提供视图PGXC_GET_TABLE_SKEWNESS进行数据倾斜查询,建议在数据库中表数量(小于10000)较少的场景直接使用。

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
SELECT * FROM table_distribution();
     schemaname     |        tablename        |   nodename   | dnsize
--------------------+-------------------------+--------------+--------
 scheduler          | pg_task                 | dn_6005_6006 |   8192
 public             | ocr_group               | dn_6005_6006 |   8192
 public             | ocr_item                | dn_6005_6006 |   8192
 sea                | ocr_group               | dn_6005_6006 |  16384
 sea                | ocr_item                | dn_6005_6006 |  16384
 public             | customer_t1             | dn_6005_6006 |  16384
 dbms_om            | gs_wlm_session_info     | dn_6005_6006 |   8192
 dbms_om            | gs_wlm_operator_info    | dn_6005_6006 |   8192
 dbms_om            | gs_wlm_ec_operator_info | dn_6005_6006 |   8192
 public             | pgxc_copy_error_log     | dn_6005_6006 |   8192
 information_schema | sql_features            | dn_6005_6006 |  98304
 information_schema | sql_implementation_info | dn_6005_6006 |  49152
 information_schema | sql_languages           | dn_6005_6006 |  49152
 information_schema | sql_packages            | dn_6005_6006 |  49152
 information_schema | sql_parts               | dn_6005_6006 |  49152
 information_schema | sql_sizing              | dn_6005_6006 |  49152
 information_schema | sql_sizing_profiles     | dn_6005_6006 |   8192
 scheduler          | pg_task                 | dn_6003_6004 |   8192
 public             | ocr_group               | dn_6003_6004 |   8192
 public             | ocr_item                | dn_6003_6004 |  16384
 sea                | ocr_group               | dn_6003_6004 |   8192
 sea                | ocr_item                | dn_6003_6004 |  16384
 public             | customer_t1             | dn_6003_6004 |  16384
 dbms_om            | gs_wlm_session_info     | dn_6003_6004 |   8192
 dbms_om            | gs_wlm_operator_info    | dn_6003_6004 |   8192
 dbms_om            | gs_wlm_ec_operator_info | dn_6003_6004 |   8192
 public             | pgxc_copy_error_log     | dn_6003_6004 |   8192
 information_schema | sql_features            | dn_6003_6004 |  98304
 information_schema | sql_implementation_info | dn_6003_6004 |  49152
 information_schema | sql_languages           | dn_6003_6004 |  49152
 information_schema | sql_packages            | dn_6003_6004 |  49152
 information_schema | sql_parts               | dn_6003_6004 |  49152
 information_schema | sql_sizing              | dn_6003_6004 |  49152
 information_schema | sql_sizing_profiles     | dn_6003_6004 |   8192
 scheduler          | pg_task                 | dn_6001_6002 |   8192
 public             | ocr_group               | dn_6001_6002 |  16384
 public             | ocr_item                | dn_6001_6002 |   8192
 sea                | ocr_group               | dn_6001_6002 |   8192
 sea                | ocr_item                | dn_6001_6002 |  16384
 public             | customer_t1             | dn_6001_6002 |  16384
 dbms_om            | gs_wlm_session_info     | dn_6001_6002 |   8192
 dbms_om            | gs_wlm_operator_info    | dn_6001_6002 |   8192
 dbms_om            | gs_wlm_ec_operator_info | dn_6001_6002 |   8192
 public             | pgxc_copy_error_log     | dn_6001_6002 |   8192
 information_schema | sql_features            | dn_6001_6002 |  98304
 information_schema | sql_implementation_info | dn_6001_6002 |  49152
 information_schema | sql_languages           | dn_6001_6002 |  49152
 information_schema | sql_packages            | dn_6001_6002 |  49152
 information_schema | sql_parts               | dn_6001_6002 |  49152
 information_schema | sql_sizing              | dn_6001_6002 |  49152
 information_schema | sql_sizing_profiles     | dn_6001_6002 |   8192
(51 rows)
support.huaweicloud.com/sqlreference-dws/dws_06_0341.html