1

Postgres 10.4

Postgres 9.6

Problem on both versions

I want to collect postgresql slow queries plan, so I added to my postgresql.conf setting from documentation

session_preload_libraries = 'auto_explain'

auto_explain.log_min_duration = '5s'

in the end of config

But also we use

logging_collector = true

and if logging_collector is on, no explain in logs

If logging_collector commented, I can see plan of queries How can I use both options?

UPDATE: We had about 10 queries runs more than 5 seconds, but finally with grep we found only one output in log with explain instead of all plans How it could be only one record was logged? neither all plans, no no plans only one explain

3
  • Works for me. Could it be that the other long queries were run over existing connections (perhaps with a connection pooler) for which the session_preload_libraries has not taken effect?
    – jjanes
    Commented Aug 21, 2018 at 11:56
  • All queries were run from Elixir Phoneix application with pool of connections, and yes, be application was not restarted Commented Aug 21, 2018 at 12:04
  • Please add your answer as answer, so I'll mark this as solution. Really, the statistic of slow queries did not displayed immediately because of connection pool was created before log_min_duration was turn on Commented Sep 7, 2018 at 12:16

1 Answer 1

1

Works for me.

Could it be that the other long queries were run over existing connections (perhaps with a connection pooler) for which the session_preload_libraries has not taken effect?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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