From: Robert Treat <xzilla@users.sourceforge.net>
To: Paulo Scardine <paulos@cimed.ind.br>
Cc: Dave Page <dpage@vale-housing.co.uk>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Killing the backend to cancel a long waiting query
Date: 22 Sep 2003 14:29:31 -0400
Message-ID: <1064255371.25694.1903.camel@camel> (raw)
In-Reply-To: <04f301c38132$7804bc30$6101a8c0@Paulo>
References: <20030921054224.GF3845@filer>
<20030921142434.S61926-100000@houston.familyhealth.com.au>
<50096.80.177.99.193.1064140018.squirrel@ssl.vale-housing.co.uk>
<04f301c38132$7804bc30$6101a8c0@Paulo>
On Mon, 2003-09-22 at 13:53, Paulo Scardine wrote:
> I can implement it as C functions, I think.
> Would be nice to have something like:
>
> Test=# select pg_list_backends();
> pid | conn_id | user | database | time | host | status
> -------+----------+----------+-----------+------+---------------+--------
> 4724 | 35445134 | marcelo | test | 0:34 | 192.168.2.212 | select
> 18737 | 15412337 | postgres | template1 | 0:00 | 192.168.1.65 | idle
> 18693 | 11448964 | postgres | test | 0:00 | 127.0.0.1 | idle
> (3 rows)
>
> Test=# select pg_stopquery_pid(4724);
> pg_stopquery_pid
> ------------------
> 0
>
> Is it worth?
Yes, but you may need a way to ensure that the query canceled is the
same one that you really want to cancel. (imagine come connection
pooling and bad luck mixed together so that the long running query
actually ends but another query fires up between the time you lookup the
long running query and the time you issue the kill...). maybe
transaction id as well as pid for arguments?
Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: xzilla@users.sourceforge.net, paulos@cimed.ind.br, dpage@vale-housing.co.uk, pgsql-hackers@postgresql.org
Subject: Re: Killing the backend to cancel a long waiting query
In-Reply-To: <1064255371.25694.1903.camel@camel>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox