looks like i do it wrong. I turned auto_explain on with adding next valued to postgresql.conf:

shared_preload_libraries = 'pg_stat_statements,pg_wait_sampling,pg_stat_kcache,auto_explain'
auto_explain.log_min_duration = '3s'

in my monitoring I can see long running queries that exceeded limit of 3s and successfully finished.

'values' here says how long query lasted: from my grafana monitoring

But when I look into my log 'postgresql-Mon.log' (and next days) there is nothing about those queries. Only a few strings about modules during database startup process.

Am I missing something?

  • What info is that png supposed to be conveying? – jjanes Dec 10 '19 at 11:55
  • oh, yes, thanks, the value is the time in seconds for how long query lasted. – Mikhail Aksenov Dec 10 '19 at 13:45
  • Did you restart the server? Those changes will not take effect until a restart (I don't think a reload is sufficient). – jjanes Dec 10 '19 at 13:48
  • Yes I did. Actually super heavy queries appeared there, so, will focus on them, so hope decreasing of auto_explain.log_min_duration will help to see more queries :) – Mikhail Aksenov Dec 10 '19 at 13:58

Look over the documentation regarding this extension

pg_stat_statements does not persist between restarts... pg_stat_statements

pg_stat_statements_reset() will clear all data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.