Reloading PostgreSQL after configuration changes

Solution 1:

Though the original person asking the question implied he's running Ubuntu 8.10 many people, using later versions of Ubuntu might stumble here as well. And this might in fact work with 8.10 too. I dunno, I don't have any 8.10 installations to try it with..

Ok, lets cut to the point. So the cool "new" way of controlling services is to use the service command. So you can reload configs with the following command:

service postgresql-8.3 reload

naturally you need to have the proper rights so it is most likely required to prepend the command with something like sudo or su -c root like this:

sudo service postgresql-8.3 reload
or
su -c root 'service postgresql-8.3 reload'

P.S. It is suggested in the Ubuntu documentation that something relating to this new method had been done way back there with the release of 6.10, however if I've understood it correctly it had not been taken into more general use until 9.10.

Solution 2:

You can check where your PGDATA is by connecting to pg, and issuing command:

show data_directory;

On ubuntu, it's usually /var/lib/postgresql/8.3/main/.

Also, you can: /etc/init.d/postgresql-8.3 reload


Solution 3:

Option 1: From the command-line shell

su - postgres
/usr/bin/pg_ctl reload

Option 2: Using SQL

SELECT pg_reload_conf();

Using either option will not interrupt any active queries or connections to the database, thus applying these changes seemlessly.


Solution 4:

This will do the trick:

kill -HUP $(head -1 $PGDATA/postmaster.pid)

Solution 5:

If you don't want to restart the server and just send a signal to postgreSQL, just type command:
pg_ctl reload