MOGDB/openGauss的dbe_perf.Statement與pgstat.stat檔案關係驗證

T1YSL發表於2022-01-04

資料目錄的/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檢視顯示和當前使用者執行作業正在執行時的負載管理相關資訊)檢視靜態記錄。在資料庫拉起後檔案自動清理。

一、Statement所有相關的檢視有:

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受影響。

二、第一輪測試

image.png

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);

image.png

Stop 庫後,刪除pgstat.stat檔案後再次查詢

image.png

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的資訊也受到了影響
image.png
image.png


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69990629/viewspace-2850504/,如需轉載,請註明出處,否則將追究法律責任。

相關文章