pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sean Johnston <sean.johnston@edgeintelligence.com>
Cc: Etsuro Fujita <etsuro.fujita@gmail.com>
Cc: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: BUG #15781: subselect on foreign table (postgres_fdw) can crash (segfault)
Date: Fri, 24 May 2019 13:59:01 -0400
Message-ID: <22204.1558720741@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMXPhFV-h=QRKjh4nuiqUt8weNEvFsH3H4bMpahcKhr6XtTVUw@mail.gmail.com>
References: <15781-2601b1002bad087c@postgresql.org>
	<25734.1556216681@sss.pgh.pa.us>
	<5CC2FC12.6050409@lab.ntt.co.jp>
	<30995.1556298600@sss.pgh.pa.us>
	<CAPmGK15OYdYVMgUMEOBO2Z_QU+Vsz2XbLJhp0ze6m-7bZ3nqww@mail.gmail.com>
	<20776.1556376433@sss.pgh.pa.us>
	<CAMXPhFV-h=QRKjh4nuiqUt8weNEvFsH3H4bMpahcKhr6XtTVUw@mail.gmail.com>

Sean Johnston <sean.johnston@edgeintelligence.com> writes:
> Not sure if this is the right avenue to follow up on this. The patch works
> fine. However, we're working on a modified version of the postgres_fdw in
> which we're trying to push as much as possible to the remote nodes,
> including ordering and limits. The patch causes the upper paths for the
> ordering and limit to be rejected as they have no relids.

Uh, what?  If you're speaking of 8cad5adb9, the only case I'm aware of
where it might be a performance issue is if you have "GROUP BY
local-expr", which seems like a pretty weird thing to need to push
to the remote side, since the local expression would be effectively
a constant on the far end.

You could imagine working around it by discarding such GROUP BY
columns in what's to be sent to the far end, and if you end up with
an empty GROUP BY clause, sending "HAVING TRUE" instead to keep the
semantics the same.  But I'm uninterested in stacking yet more
klugery atop 8cad5adb9 so far as the community code is concerned.
The right way forward, as noted in the commit message, is to revert
that patch in favor of adding some API that will let the FDW control
how setrefs.c processes a ForeignScan's expressions.  We just can't
do that in released branches :-(.

It's possible that we should treat this issue as an open item for v12
instead of letting it slide to v13 or later.  But I think people would
only be amenable to that if you can point to a non-silly example where
failure to push the GROUP BY creates a performance issue.

			regards, tom lane





view thread (13+ messages)  latest in thread

Message-ID: <22204.1558720741@sss.pgh.pa.us>
Permalink:  ../22204.1558720741@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22204.1558720741@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sean.johnston@edgeintelligence.com, etsuro.fujita@gmail.com, fujita.etsuro@lab.ntt.co.jp, pgsql-hackers@lists.postgresql.org
  Subject: Re: BUG #15781: subselect on foreign table (postgres_fdw) can crash (segfault)
  In-Reply-To: <22204.1558720741@sss.pgh.pa.us>
  References: <15781-2601b1002bad087c@postgresql.org> <25734.1556216681@sss.pgh.pa.us> <5CC2FC12.6050409@lab.ntt.co.jp> <30995.1556298600@sss.pgh.pa.us> <CAPmGK15OYdYVMgUMEOBO2Z_QU+Vsz2XbLJhp0ze6m-7bZ3nqww@mail.gmail.com> <20776.1556376433@sss.pgh.pa.us> <CAMXPhFV-h=QRKjh4nuiqUt8weNEvFsH3H4bMpahcKhr6XtTVUw@mail.gmail.com> <22204.1558720741@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox