Re: [ADMIN] how do i kill user sessions?

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [ADMIN] how do i kill user sessions?
Date: 2005-05-12 08:14:49
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE6C748C@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > I have a problem with the users administration. When I
> want to erase
> > (drop) some databases there's an error: ** database
> "name_db" is being
> > accessed by other users.** I want to kill the user
> sessions conected
> > but i don't know how to do it (Kill the user sessions).
>
> First, use ps to find the pid of the offending users. for instance:
>
> ps ax|grep postgres|grep test
> 18925 pts/1 S 0:00 postgres: postgres test [local] idle
>
> then, as the postgres superuser, kill the backend:
>
> kill 18925

Moved to hackers, since this is no longer an answer to the original
question.

First, I think this is a very FA:ed Q (how to kill off a session), so I
think this should go in the FAQ.

Second, most of the time people ask about this, they get the advice to
use 'kill'. Last I heard, this was not considered safe in any other
situations than total database shutdown. (using it to cancel a query is
safe, but that won't get rid of the backend) And that the only
recommended way to terminate a backend was to shutdown and restart the
postmaster along with all backends. Such a FAQ entry should clearly
outline this (and why it's not safe). Unless this is no longer true, but
I haven't seen any patches that have claimed to fix this.

Third, I beleive it's very important for us to fix this. My experience
from last time clearly tells me that I'm not capable of doing this
myself, so I'll just reiterate the point and hope that somebody who does
can make it happen :-) again, unless it's already fixed and I missed it.

//Magnus

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2005-05-12 08:33:47 Re: Server instrumentation for 8.1
Previous Message Christopher Kings-Lynne 2005-05-12 08:02:37 Re: SQL_ASCII vs. 7-bit ASCII encodings