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

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-interfacespgsql-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

pgsql-hackers by date

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

pgsql-odbc by date

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

pgsql-interfaces by date

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

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