Search Postgresql Archives

Re: Terminate query on page exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



david harel wrote:
> I use postgresql on a Linux server on a virtual machine (despite my protest 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 even though the page was
> closed.

That is true.

> I want to make sure the query is dropped when the customer closes the page.
> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux