1

I'm developing graph application on AgensGraph, and suffering poor performance of transaction. I want to list long-term queries from log of AgensGraph.

How to extract slow queries from log?

mekhi
  • 13
  • 3

1 Answers1

1

You can try statement log of AgensGraph.

First, change parameters on "postgresql.conf"

log_duration = on
log_statement = 'all'

Second, restart AgensGraph.

$ ag_ctl stop
waiting for server to shut down.... done
server stopped
$ ag_ctl start
server starting

Finally, run queries and check log file.

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

Filter statement on long duration values.

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
cullen
  • 51
  • 4