1👍
✅
Use the log_min_duration
option in the configuration file:
You might also want to install the auto-explain module which will also dump the execution plan of the slow queries to the log file.
More details here: http://www.postgresql.org/docs/current/static/auto-explain.html
Source:stackexchange.com