Re: Clients disconnect but query still runs

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: Clients disconnect but query still runs
Дата
Msg-id h4ph1j$pi$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на Clients disconnect but query still runs  (Robert James <srobertjames@gmail.com>)
Ответы Re: Clients disconnect but query still runs
Список pgsql-general
On 2009-07-28, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert James <srobertjames@gmail.com> writes:
>> Hi.  I noticed that when clients (both psql and pgAdmin) disconnect or
>> cancel, queries are often still running on the server.  A few questions:
>> 1) Is there a way to reconnect and get the results?
>
> No.
>
>> 2) Is there a way to tell postgres to automatically stop all queries when
>> the client who queried them disconnects?
>
> No.
>
>> 3) Is there a way to see all queries whose clients have disconnected?
>
> No.
>
>> 4) And finally: Why is this the behavior?
>
> It's not easy to tell whether a client has disconnected (particularly if
> the network stack is unhelpful, which is depressingly often true).
> Postgres will cancel a query if it gets told that the connection's been
> dropped, but it will only discover this when an attempt to output to the
> client fails.  It does not spend cycles looking aside to see if the
> connection has dropped when it is doing something that doesn't involve
> output to the client.
>
> If your client code is polite enough to send a cancel request before
> disconnecting, that should terminate the query reasonably promptly.
> But just "yanking the plug" doesn't do that.

can't coerce a signal from the network stack? the linux socket(2)
manpage is full of promise (SIGPIPE, SIGURG, SIGIO)




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

Предыдущее
От: Scott Mead
Дата:
Сообщение: Re: Building from source vs RPMs
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: combining db's- importing primary keys