Thread: pg_cancel_backend and pg_ctl kill

pg_cancel_backend and pg_ctl kill

From
Mija Lee
Date:
Hi -

I've been having some problems where we have a nightly script to
replicate data which fails because of an <IDLE in transaction> process.
I figured I should kill any of the processes before doing the
replication. I've read several of the posts about pg_cancel_backend and
from what I've read it looks like this won't kill IDLE processes. There
were several suggestions about shelling out & using kill, or writing a C
function.

What I'm wondering about is if pg_ctl kill [procpid] will do the job.
The doc seems to suggest this, but I'm wanted to check before bringing
my server to it's knees...

Running 8.2.4 on solaris 10.

Mija






Re: pg_cancel_backend and pg_ctl kill

From
Chander Ganesan
Date:
Hi Mija,

Mija Lee wrote:
> Hi -
>
> I've been having some problems where we have a nightly script to
> replicate data which fails because of an <IDLE in transaction> process.
> I figured I should kill any of the processes before doing the
> replication. I've read several of the posts about pg_cancel_backend
> and from what I've read it looks like this won't kill IDLE processes.
> There were several suggestions about shelling out & using kill, or
> writing a C function.
>
> What I'm wondering about is if pg_ctl kill [procpid] will do the job.
> The doc seems to suggest this, but I'm wanted to check before bringing
> my server to it's knees...
It will, but it's about the same as killing the backend process using
the 'kill' command.  It's especially useful in the Windows environment,
where no kill command exists.

--
Chander Ganesan
Open Technology Group, Inc.
One Copley Parkway, Suite 210
Morrisville, NC  27560
Phone: 877-258-8987/919-463-0999
http://www.otg-nc.com
Ask me about our Expert PostgreSQL & PostGIS Training


Re: pg_cancel_backend and pg_ctl kill

From
Mija Lee
Date:
Thanks Chander. I will just use the kill then.

Chander Ganesan wrote:
> Hi Mija,
>
> Mija Lee wrote:
>> Hi -
>>
>> I've been having some problems where we have a nightly script to
>> replicate data which fails because of an <IDLE in transaction> process.
>> I figured I should kill any of the processes before doing the
>> replication. I've read several of the posts about pg_cancel_backend
>> and from what I've read it looks like this won't kill IDLE processes.
>> There were several suggestions about shelling out & using kill, or
>> writing a C function.
>>
>> What I'm wondering about is if pg_ctl kill [procpid] will do the job.
>> The doc seems to suggest this, but I'm wanted to check before bringing
>> my server to it's knees...
> It will, but it's about the same as killing the backend process using
> the 'kill' command.  It's especially useful in the Windows environment,
> where no kill command exists.
>
> --
> Chander Ganesan
> Open Technology Group, Inc.
> One Copley Parkway, Suite 210
> Morrisville, NC  27560
> Phone: 877-258-8987/919-463-0999
> http://www.otg-nc.com
> Ask me about our Expert PostgreSQL & PostGIS Training