Re: killing idle attaches without killing others

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Vick Khera <vivek(at)khera(dot)org>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: killing idle attaches without killing others
Date: 2010-08-04 14:50:02
Message-ID: 482E80323A35A54498B8B70FF2B87980046602C8B1@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How does PG determine if a process is <IDLE> ? It there some sort of timeout? I want to be able to distinguish between somene who's interrupted on the phone for a couple minutes vs the guy who left the program running over the weekend.

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Dean Rasheed
Sent: Wednesday, August 04, 2010 10:26 AM
To: Vick Khera
Cc: pgsql-general
Subject: Re: [GENERAL] killing idle attaches without killing others

On 4 August 2010 15:18, Vick Khera <vivek(at)khera(dot)org> wrote:
> On Wed, Aug 4, 2010 at 10:03 AM, Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com>
> wrote:
>>
>> How can one kill just the <IDLE> processes I see attached to a DB (from
>> pg_stat_activity) without disturbing the others?  If I need to kill the idle
>> pids one ata time, which signal_name should I use for that?
>>
>>
>
> Connected to psql as a superuser, issue SELECT pg_cancel_backend(PID); where
> PID is the pid of the process to close.

That's a SIGINT, but it doesn't actually kill the process, it just
cancels it's current query.

pg_terminate_backend() sends a SIGTERM to terminate the backend. I
think that function is new to 8.4, but you can still manually send the
signal if you're on 8.3.

http://www.postgresql.org/docs/current/static/functions-admin.html

Regards,
Dean

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rikard Bosnjakovic 2010-08-04 15:05:47 Embedded text column versus referenced text
Previous Message Tom Lane 2010-08-04 14:46:24 Re: hashtable issue - HASH_FIND??