数据仓库服务 GAUSSDB(DWS)-统计信息函数:pgxc_stat_single_table(schema, tablename)

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

pgxc_stat_single_table(schema, tablename)

描述:在CN上执行,入参为schema和表名。查询单张表在全库中的统计信息及该表在每个DN上的脏页率。

该函数仅8.1.3及以上集群版本支持。

该函数的统计信息依赖于ANALYZE,为获取该表最准确的信息请先对表进行ANALYZE。

返回值类型:record

返回值字段与函数pg_stat_get_tuple()相同。

1
2
3
4
5
6
7
8
SELECT * FROM pgxc_stat_single_table('public','t1');
 nodename  | tableid | partid |      last_vacuum       |    last_autovacuum     |         last_analyze          |    last_autoanalyze    | vacuum_count | autovacuum_count | analyze_count | autoanalyze_count | n_tup_ins | n_
tup_upd | n_tup_del | n_tup_hot_upd | n_tup_change | n_live_tup | n_dead_tup | dirty_rate | last_data_changed
-----------+---------+--------+------------------------+------------------------+-------------------------------+------------------------+--------------+------------------+---------------+-------------------+-----------+---
--------+-----------+---------------+--------------+------------+------------+------------+-------------------
 datanode1 | 1270075 |        | 2000-01-01 08:00:00+08 | 2000-01-01 08:00:00+08 | 2023-01-09 09:38:43.220876+08 | 2000-01-01 08:00:00+08 |            0 |                0 |             1 |                 0 |         0 |
      0 |         0 |             0 |            0 |          0 |          0 |          0 |
(1 row)
support.huaweicloud.com/sqlreference-dws/dws_06_0065.html