数据目录的/global下在数据库stop之后会自动生成一个pgstat.stat文件。保存着dbe_perf_schema下query记录statement相关的dbe_perf.statement(获得当前节点的执行语句(归一化sql)的信息。查询视图必须具有sysadmin权限。
数据库主节点上可以看到此数据库主节点接收到的归一化的sql的全量统计信息(包含数据库节点);数据库节点上仅可看到归一化的sql的此节点执行的统计信息)、dbe_perf.statement_wlmstat_complex_runtime(statement_wlmstat_complex_runtime视图显示和当前用户执行作业正在运行时的负载管理相关信息)视图静态记录。在数据库拉起后文件自动清理。
select count(*) from dbe_perf.statement;
select count(*) from dbe_perf.statement_count;
select count(*) from dbe_perf.global_statement_count;
select count(*) from dbe_perf.summary_statement_count;
select count(*) from dbe_perf.global_statement_complex_history;
select count(*) from dbe_perf.global_statement_complex_history_table;
select count(*) from dbe_perf.global_statement_complex_runtime;
select count(*) from dbe_perf.statement_responsetime_percentile;
select count(*) from dbe_perf.statement_complex_runtime;
select count(*) from dbe_perf.statement_complex_history_table;
select count(*) from dbe_perf.statement_complex_history;
select count(*) from dbe_perf.statement_wlmstat_complex_runtime;
验证情况如下,从现象看只有dbe_perf.statement、dbe_perf.statement_wlmstat_complex_runtime受影响。
select count(*) from dbe_perf.statement;
-------
47
(1 row)
postgres=# select count(*) from dbe_perf.statement_count;
count
-------
4
(1 row)
postgres=# select count(*) from dbe_perf.global_statement_count;
count
-------
4
(1 row)
postgres=# select count(*) from dbe_perf.summary_statement_count;
count
-------
4
(1 row)
postgres=# select count(*) from dbe_perf.global_statement_complex_history;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.global_statement_complex_history_table;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.global_statement_complex_runtime;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.statement_responsetime_percentile;
count
-------
1
(1 row)
postgres=# select count(*) from dbe_perf.statement_complex_runtime;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.statement_complex_history_table;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.statement_complex_history;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.statement_wlmstat_complex_runtime;
count
-------
9
(1 row)
可能会报 warning: workload manager is not valid.,需要将use_workload_manager参数打开,该参数表示是否开启资源管理功能。
use_workload_manager参数由off变为on状态后,不会统计off时的存储资源。如果需要统计off时用户使用的存储资源,请在数据库中执行以下命令:select gs_wlm_readjust_user_space(0);
stop 库后,删除pgstat.stat文件后再次查询
postgres=# select count(*) from dbe_perf.statement;
count
-------
27
(1 row)
postgres=# select count(*) from dbe_perf.statement_count;
count
-------
4
(1 row)
postgres=# select count(*) from dbe_perf.global_statement_count;
count
-------
4
(1 row)
postgres=# select count(*) from dbe_perf.summary_statement_count;
count
-------
4
(1 row)
postgres=# select count(*) from dbe_perf.global_statement_complex_history;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.global_statement_complex_history_table;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.global_statement_complex_runtime;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.statement_responsetime_percentile;
count
-------
1
(1 row)
postgres=# select count(*) from dbe_perf.statement_complex_runtime;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.statement_complex_history_table;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.statement_complex_history;
count
-------
0
(1 row)
postgres=# select count(*) from dbe_perf.statement_wlmstat_complex_runtime;
count
-------
9
(1 row)
第一轮里看到dbe_perf.statement在删除pgstat.stat后数量从47变成了27.
第二轮测试,发现dbe_perf.statement_wlmstat_complex_runtime的信息也受到了影响