Re: Add client connection check during the execution of the query

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add client connection check during the execution of the query
Date: 2021-03-01 05:18:17
Message-ID: CA+hUKGJd0XTiJ08V-HEEb=Jy6GmUNO0ht6FF5dN9JhXOmJ78Mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 3, 2019 at 4:40 AM Konstantin Knizhnik
<k(dot)knizhnik(at)postgrespro(dot)ru> wrote:
> On 18.07.2019 6:19, Tatsuo Ishii wrote:
> > So the performance is about 5% down with the feature enabled in this
> > case. For me, 5% down is not subtle. Probably we should warn this in
> > the doc.
>
> I also see some performance degradation, although it is not so large in
> my case (I used pgbench with scale factor 10 and run the same command as
> you).
> In my case difference is 103k vs. 105k TPS is smaller than 2%.

I didn't test, but hopefully the degradation is fixed by commit 09cf1d52?

> If OS detected closed connection, it should return POLLHUP, should not it?
> I am not sure if it is more portable or more efficient way - just seems
> to be a little bit more natural way (from my point of view) to check if
> connection is still alive.

That's if you're sleeping inepoll etc. This patch is for CPU-bound
backends, running a long query. We need to do something special to
find out if the kernel knows that the connection has been closed.

I've done a quick rebase of this the patch and added it to the
commitfest. No other changes. Several things were mentioned earlier
that still need to be tidied up.

Attachment Content-Type Size
v3-0001-Detect-dropped-connections-while-running-queries.patch text/x-patch 14.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-03-01 05:36:17 Re: [HACKERS] Custom compression methods
Previous Message Amit Khandekar 2021-03-01 05:14:42 Re: Speeding up GIST index creation for tsvectors