From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Clients disconnect but query still runs |
Date: | 2009-07-29 12:58:27 |
Message-ID: | h4ph1j$pi$1@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2009-07-28, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert James <srobertjames(at)gmail(dot)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)
From | Date | Subject | |
---|---|---|---|
Next Message | Jasen Betts | 2009-07-29 13:02:02 | Re: combining db's- importing primary keys |
Previous Message | Scott Mead | 2009-07-29 12:51:40 | Re: Building from source vs RPMs |