数据仓库服务 GAUSSDB(DWS)-如何判断表是否执行过UPDATE或DELETE:处理方法

时间:2024-11-02 18:44:29

处理方法

通过以下命令查找哪些表执行过UPDATE及DELETE操作:

1
2
3
4
5
6
7
8
9
ANALYZE tablename;
SELECT  
    n.nspname , c.relname, 
    pg_stat_get_tuples_deleted(x.pcrelid) as deleted,
pg_stat_get_tuples_updated(x.pcrelid) as updated
FROM pg_class c
INNER JOIN pg_namespace n ON n.oid = c.relnamespace
INNER JOIN pgxc_class x ON x.pcrelid = c.oid
WHERE c.relkind = 'r' and c.relname='tablename' ;
support.huaweicloud.com/trouble-dws/dws_09_0098.html