Cannot get log_min_duration_statement to work

I have been searching the Internet for more than two hours, but I'm really stuck with this. I want PostgreSQL (I use version 8.4 on Debian) to start logging only slow queries.

In this regard, I use the following configuration in postgresql.conf :

 log_destination = 'csvlog' logging_collector = on log_min_messages = log log_min_duration_statement = 1000 log_duration = on log_line_prefix = '%t ' log_statement = 'all' 

The rest of the configuration is in the default settings (commented out). Logging works, but it logs all claims, even those below the threshold of 1000 (ms). If I do "show all", I see that all settings are valid. I also tried restarting Postgres.

I hope someone can help me.

+4
source share
2 answers
 log_statement = 'all' 

instructs the server to register all statements as simple as this. Besides,

 log_duration = on 

also informs the server of the registration of all operators, including information about the duration.
Change it to

 log_statement = none log_duration = off 

No quotes are required. Or comment on them and reboot. Then no application will be registered, except for those that work longer than 1000 ms - instructed

 log_min_duration_statement = 1000 

It is all in a great guide .

+12
source

Must be:

 log_destination = 'csvlog' logging_collector = on log_min_duration_statement = 1000 log_line_prefix = '%t %p %r %d %u '### more context log_statement = 'ddl' ### log schema changes 
0
source

Source: https://habr.com/ru/post/1385085/


All Articles