Re: Postgresql 8.0 and Cancel/Kill backend functions

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Postgresql 8.0 and Cancel/Kill backend functions
Дата
Msg-id 20050112184242.GA95593@winnie.fuhr.org
обсуждение исходный текст
Ответ на Postgresql 8.0 and Cancel/Kill backend functions  (Tony Caduto <tony.caduto@amsoftwaredesign.com>)
Список pgsql-general
On Wed, Jan 12, 2005 at 12:00:22PM -0600, Tony Caduto wrote:

> Does anyone know if such functions have been added to version 8?

See the 8.0 Release Notes in the development documentation:

  * Add function to send cancel request to other backends (Magnus)

See also the "System Administration Functions" section in the
"Functions and Operators" chapter.

Here's an example:

Session 1:
CREATE FUNCTION sleep(integer) RETURNS void AS $$
sleep $_[0];
$$ LANGUAGE plperlu;
SELECT sleep(60);

Session 2:
SELECT procpid, current_query FROM pg_stat_activity;
 procpid |   current_query
---------+-------------------
...
   95609 | SELECT sleep(60);
...
SELECT pg_cancel_backend(95609);

Session 1:
ERROR:  canceling query due to user request

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

В списке pgsql-general по дате отправления:

Предыдущее
От: "Magnus Hagander"
Дата:
Сообщение: Re: Postgresql 8.0 and Cancel/Kill backend functions
Следующее
От: "Ed L."
Дата:
Сообщение: Re: vacuum vs open transactions