Re: Terminate query on page exit

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: patrick keshishian <pkeshish(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Terminate query on page exit
Date: 2013-02-19 12:38:13
Message-ID: CAFj8pRB24SX3xsYM844eO=HExCG8FRc1fyOn6HzshFT8p-9KFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2013/2/19 patrick keshishian <pkeshish(at)gmail(dot)com>:
> On Tuesday, February 19, 2013, Albe Laurenz wrote:
>>
>> 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.
>
>
> you don't truly mean to advise that, do you? :)

it is not bad advice - usually all long queries should be cancelled by
timeout - and timeout is the most simple and sometimes good enough
solution. You can set timeout just for account used for login from web
application

But there are not simple solution - complete solution needs AJAX, back
calls, ...

Regards

Pavel Stehule

> --patrick

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-02-19 12:42:03 Re: Terminate query on page exit
Previous Message Tom Lane 2013-02-19 11:41:14 Re: Perl function leading to out of memory error