May 2017
Beginner
416 pages
10h 37m
English
The log can also be used to track down individual slow queries. Back in the old days, this was pretty much the only way to spot performance problems.
How does it work? postgresql.conf has a variable called log_min_duration_statement. If this is set to a value greater than zero, every query exceeding our chosen setting will make it to the log:
# log_min_duration_statement = -1
Most people see the slow query log as the ultimate source of wisdom. However, I would like to add a word of caution. There are many slow queries, and they just happen to eat up a lot of CPU: index creation, data exports, analytics, and so on.
Those long-running queries are totally expected and are in many cases not the root cause of all evil. It ...
Read now
Unlock full access