PostgreSQL: How to change log_min_duration_statement so that the change takes effect?

Viewed 891

I'm not able to change log_min_duration_statement setting. I connected to postges and tried:

select setting from pg_settings where name = 'log_min_duration_statement';
-1
alter system set log_min_duration_statement = 0;
select setting from pg_settings where name = 'log_min_duration_statement';
-1

Obviously nothing changed; what am I doing wrong? Thank you, Michael

2 Answers

After alter system you need to reload the configuration.

select pg_reload_conf();

To debug things like that, you can verify where where the current values comes from by looking at the columns source_file and source_line from the view pg_settings

If you have been unable to solve this with alter system then try to change directly in postgresql.conf. I have previously tried with alter, update, restart server but nothing.

When I've tried directly editing postgresql.conf and restarting I've seen in pg_settings 0 (was -1 previously).

Just remove # before line log_min_duration_statement and change -1 to 0.

In file is this #log_min_duration_statement = -1 and should be this log_min_duration_statement = 0.

I am not sure why you made this change but take care because some other settings are linked to this one. e.g. log_statement is probably none and should be ddl or all.

Related