如何在AgensGraph上查找慢查询?

时间:2019-01-21 08:16:32

标签: agens-graph

我正在AgensGraph上开发图形应用程序,并且交易性能很差。 我想从AgensGraph的日志中列出长期查询。

如何从日志中提取慢查询?

1 个答案:

答案 0 :(得分:0)

您可以尝试AgensGraph的语句日志。

首先,更改“ 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