Thread: Disconnecting users for backup etc

Disconnecting users for backup etc

From
Stephen Davies
Date:
Hello.

What is the recommended method of disconnecting all users while a
database is vacuumed and backed up?

I have tried a stop/start cycle but this doesn't work. The only method
that I have found so far that does work is to kill -9 every postgresql
process but this sounds way too heavy handed.

Cheers and thanks,
Stephen Davies

========================================================================
Stephen Davies Consulting                              scldad@sdc.com.au
Adelaide, South Australia.                             Voice: 08-8177 1595
Computing & Network solutions.                         Fax: 08-8177 0133



Re: Disconnecting users for backup etc

From
Doug McNaught
Date:
Stephen Davies <scldad@sdc.com.au> writes:

> Hello.
>
> What is the recommended method of disconnecting all users while a
> database is vacuumed and backed up?

You don't have to do this unless you really want to.

Backups created by pg_dump are internally consistent as of the start
of the dump (they run inside a transaction).

VACUUM runs with users on-line just fine.  It may affect performance
while it's running, since it locks tables, but it won't have any
problems.

> I have tried a stop/start cycle but this doesn't work. The only method
> that I have found so far that does work is to kill -9 every postgresql
> process but this sounds way too heavy handed.

WIth a reasonably modern Postgres, 'pg_ctl stop -m fast' should bring
it down semi-hard.  With older versions you can have the same effect
by sending SIGINT to the postmaster process.

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time...          --Dylan