Skip site navigation (1) Skip section navigation (2)

Re: Is there a way to kill a connection from the pg_stat_activitly list?

From: Jessica Richard <rjessil(at)yahoo(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: Tommy Gildseth <tommy(dot)gildseth(at)usit(dot)uio(dot)no>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Is there a way to kill a connection from the pg_stat_activitly list?
Date: 2007-10-16 12:03:30
Message-ID: 379974.90208.qm@web56402.mail.re3.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-admin
select pg_cancel_backend(procpid) solved half of my problem...at least it terminated the query for that user... but it is still holding a user connection in IDLE state....If I have too many of those, Postgres may run of out of user connections....

I already knew how to kill a connection if the connection is from the local host. But I have many remote connections coming from different machines... hard to kill with unix command "kill"...  One time, I was testing to kill a particular connection on a testing machine, the entrie Postgres was brought down....

I need to find a safer, cleaner way to disconnect a user from Postgres when needed.

Thanks a lot,


Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote: On 10/15/07, Jessica Richard  wrote:
> Thanks a lot!
>
> "select pg_cancel_backend(procpid) " can end the current query for that
> user, but then this connection becomes IDLE, still connected.
>
> Is there a command for me to totally disconnect a user by procpid? Some
> times, I need to kick out a particular Postgres user completely.

From the command line on the server you can issue a kill 
 to do
that.  From within pgsql you'd need to write a function in an
untrusted language to pull it off.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster



       
---------------------------------
Don't let your dream ride pass you by.    Make it a reality with Yahoo! Autos. 

In response to

Responses

pgsql-admin by date

Next:From: Greg CaultonDate: 2007-10-16 12:55:30
Subject: installation automation
Previous:From: Jonah H. HarrisDate: 2007-10-16 12:00:07
Subject: Re: Is there a way to kill a connection from the pg_stat_activitly list?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group