Re: [HACKERS] Function to kill backend - Mailing list pgsql-patches

From Andreas Pflug
Subject Re: [HACKERS] Function to kill backend
Date
Msg-id 41050F0F.40401@pse-consulting.de
Whole thread Raw
In response to Re: [HACKERS] Function to kill backend  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Function to kill backend
Re: [HACKERS] Function to kill backend
List pgsql-patches
Tom Lane wrote:

>
> If you don't mind plastering a "use at your own risk" sign on it, then
> go for it.

killing a backend is obviously much more "at your own risk" than a
descent function.

Taken from your mail, I understand that a killed backend might leave
some loose ends, eg. open locks, which would degrade the cluster's
performance. Still, it should not corrupt the shared mem, just leave it
as if the backend's still alive and sleeping, right?

You'd kill a backend only if your complete cluster is suffering from it,
and you hope to keep it running by just shooting that process. If the
cluster still has that uncleaned locks or so, you're unlucky and need to
shutdown the cluster.

Maybe we should supply a restricted version of pg_terminate_backend
that's callable from admin interfaces only so we can make sure that the
user was warned what he's doing before the termination is executed,
something like that:

ticket := select pg_admin_ticket();
/* calculate well-known stuff on ticket
    and issue before it times out */
select pg_terminate_backend(ticket_hash);

Regards,
Andreas

pgsql-patches by date:

Previous
From: Oliver Jowett
Date:
Subject: fix for parameterized queries in DECLARE CURSOR statements
Next
From: Andrew Dunstan
Date:
Subject: Re: pg_config