我指的是https://github.com/zubkov-andrei/pg_profile
来生成类似报告的awr。
我遵循的步骤如下:
1)在postgresql.conf (located inside D:\Program Files\PostgreSQL\9.6\data)
track_activities = on
track_counts = on
track_io_timing = on
track_functions = on
shared_preload_libraries = 'pg_stat_statements'
pg_stat_statements.max = 1000
pg_stat_statements.track = 'top'
pg_stat_statements.save = off
pg_profile.topn = 20
pg_profile.retention = 7
2)手动将以pg_profile
开头的所有文件复制到D:\Program Files\PostgreSQL\9.6\share\extension
3)从pgAdmin4控制台成功执行以下命令
CREATE EXTENSION dblink;
CREATE EXTENSION pg_stat_statements;
CREATE EXTENSION pg_profile;
4)要查看已经存在哪个节点,我执行了SELECT * from node_show();
导致
node_name as local
connstr as dbname=postgres port=5432
enabled as true
5)要创建快照,我执行了SELECT * from snapshot('local');
但低于错误
ERROR: could not establish connection
DETAIL: fe_sendauth: no password supplied
CONTEXT: SQL statement "SELECT dblink_connect('node_connection',node_connstr)"
PL/pgSQL function snapshot(integer) line 38 at PERFORM
PL/pgSQL function snapshot(name) line 9 at RETURN
SQL state: 08001
一旦我能够生成多个快照,那么我应该能够生成报告。
答案 0 :(得分:0)
只需使用SELECT * from snapshot()
查看该函数的代码。它以node为参数调用另一个。