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