我正在 AgnsGraph 上开发图形应用程序,并且交易性能不佳。我想从 AgensGraph 的日志中列出长期查询。
如何从日志中提取慢查询?
你可以试试AgensGraph的statement log。
首先,更改“postgresql.conf”上的参数
log_duration = on
log_statement = 'all'
二、重启AgensGraph。
$ ag_ctl stop
waiting for server to shut down.... done
server stopped
$ ag_ctl start
server starting
最后,运行查询并检查日志文件。
agens=# set graph_path to graph;
SET
agens=# create view temp as select gs from generate_series( 1, 1000000 ) gs;
CREATE VIEW
agens=# load from temp as gs create (:n{id:gs});
GRAPH WRITE (INSERT VERTEX 1000000, INSERT EDGE 0)
agens=# \quit
对长持续时间值的过滤语句。
LOG: statement: set graph_path to graph;
LOG: duration: 0.296 ms
LOG: statement: create view temp as select gs from generate_series( 1, 1000000 ) gs;
LOG: duration: 9.859 ms
LOG: statement: load from temp as gs create (:n{id:gs});
LOG: duration: 20194.808 ms