postgresqlpostgresql-11

How to reload PostgreSQL configuration


I am trying to enable the transaction logs in PostgreSQL, where query run time is more than 3 seconds, by setting this flag

log_min_duration_statement = 3000

How to reload the configuration file without restarting the Postgres?

I've tried the below options and got these errors

1) postgres=# select pg_reload_config();
**ERROR:  function pg_reload_config() does not exist**
LINE 1: select pg_reload_config();
2) postgres@ospostgresql:/$ /usr/lib/postgresql/11/bin/pg_ctl reload
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.

Solution

  • Thank you a_horse_with_no_name in helping to identify the typo which causes issue-1

    1) postgres=# select pg_reload_config();
    **ERROR:  function pg_reload_config() does not exist**
    **-->** This is resolved by giving correct function name i.e. 
        select pg_reload_conf();
    
    2) postgres@ospostgresql:/$ /usr/lib/postgresql/11/bin/pg_ctl reload
    pg_ctl: no database directory specified and environment variable PGDATA unset
    Try "pg_ctl --help" for more information.
    **-->** This error is resolved by changing the user to postgres
        1) su postgres
        2) /usr/lib/postgresql/11/bin/pg_ctl -D /var/lib/postgresql/11/main reload