Re: Terminate query on page exit

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Terminate query on page exit
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B057B519E@ntex2010a.host.magwien.gv.at
обсуждение исходный текст
Ответ на Terminate query on page exit  ("david harel" <david@qis.co.il>)
Ответы Re: Terminate query on page exit  (patrick keshishian <pkeshish@gmail.com>)
Список pgsql-general
david harel wrote:
> I use postgresql on a Linux server on a virtual machine (despite my prote=
st to IT personal).
> The client is typically a web server implementing PHP sites.
>
> Customers many times close a page typically when a heavy report runs for =
too long.
> Using the command "top", I got the impression that the query still runs e=
ven though the page was
> closed.

That is true.

> I want to make sure the query is dropped when the customer closes the pag=
e.
> Any method to kill such query would it still hang out there?

One crude method would be to set statement_timeout to a nonzero
value - then queries that take longer than that many seconds
will be canceled.

Another option would be to use asynchronous query processing.
The challenge is of course to regularly poll the query status,
but if you can detect that the page is closed you could send
a cancel request (pg_cancel_query in PHP).

Yours,
Laurenz Albe

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

Предыдущее
От: Jan Strube
Дата:
Сообщение: Perl function leading to out of memory error
Следующее
От: Tomas Pasterak
Дата:
Сообщение: Questions: How to configure PostgreSQL at the beginning ....