数据仓库服务 GAUSSDB(DWS)-使用GaussDB(DWS)冷热数据切换功能降低业务成本:查看冷热表数据分布

时间:2024-12-06 11:13:56

查看冷热表数据分布

  • 查看单表数据分布情况。
    1
    2
    3
    4
    5
    6
    7
    SELECT * FROM pg_catalog.pg_lifecycle_table_data_distribute('lifecycle_table');
    schemaname |    tablename    |   nodename   | hotpartition | coldpartition | switchablepartition | hotdatasize | colddatasize | switchabledatasize
    ------------+-----------------+--------------+--------------+---------------+---------------------+-------------+--------------+--------------------
     public     | lifecycle_table | dn_6001_6002 | p1,p2,p3,p8  |               |                     | 96 KB       | 0 bytes      | 0 bytes
     public     | lifecycle_table | dn_6003_6004 | p1,p2,p3,p8  |               |                     | 96 KB       | 0 bytes      | 0 bytes
     public     | lifecycle_table | dn_6005_6006 | p1,p2,p3,p8  |               |                     | 96 KB       | 0 bytes      | 0 bytes
    (3 rows)
    
  • 查看所有冷热表数据分布情况。
    1
    2
    3
    4
    5
    6
    7
    SELECT * FROM pg_catalog.pg_lifecycle_node_data_distribute();
    schemaname |    tablename    |   nodename   | hotpartition | coldpartition | switchablepartition | hotdatasize | colddatasize | switchabledatasize
    ------------+-----------------+--------------+--------------+---------------+---------------------+-------------+--------------+--------------------
     public     | lifecycle_table | dn_6001_6002 | p1,p2,p3,p8  |               |                     |       98304 |            0 |                  0
     public     | lifecycle_table | dn_6003_6004 | p1,p2,p3,p8  |               |                     |       98304 |            0 |                  0
     public     | lifecycle_table | dn_6005_6006 | p1,p2,p3,p8  |               |                     |       98304 |            0 |                  0
    (3 rows)
    
support.huaweicloud.com/bestpractice-dws/dws_05_0094.html