Killing the backend to cancel a long waiting query

From: "Paulo Scardine" <paulos(at)cimed(dot)ind(dot)br>
To: <pgsql-hackers(at)postgresql(dot)org>
Cc: <pgsql-odbc(at)postgresql(dot)org>, <pgsql-interfaces(at)postgresql(dot)org>
Subject: Killing the backend to cancel a long waiting query
Date: 2003-09-18 18:04:32
Message-ID: 007701c37e0f$4fc1b550$6101a8c0@Paulo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces pgsql-odbc

There are many interfaces that doesn't support canceling a long query other
than killing the application or killing the backend using the server
operational system.

I've searched the docs, faqs and list archives; seen a lot of questions but
no answers.

So I hacked a small pggetpid and pgkillpid C functions, and now I can learn
the backend's PID, start the query in a new thread, and kill the backend
using another connection if I want. Its ugly, I know, but worked wonderfully
with ODBC, the Delphi developers here and the users are very happy.

Questions are:
1) is there a better way to do that?
2) is it safe to kill the backend this way (other than an user killing the
wrong postgres owned proccess)?
3) is this useful for anyone else?

Regards,
--
Paulo Scardine

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-09-18 18:09:19 Re: authentication packet
Previous Message Oliver Elphick 2003-09-18 17:53:00 ECPG interface: 7.4beta3 compile failure; CVS tip compile failure

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2003-09-18 19:08:48 Re: [HACKERS] Killing the backend to cancel a long waiting query
Previous Message Robert Treat 2003-09-18 13:09:58 Fwd: Re: ERROR: dynamic load not supported

Browse pgsql-odbc by date

  From Date Subject
Next Message Tom Lane 2003-09-18 19:08:48 Re: [HACKERS] Killing the backend to cancel a long waiting query
Previous Message Albert Graef 2003-09-18 15:40:50 problem with multiple result sets