Re: Getting sorted data from foreign server for merge join

From: Greg Stark <stark(at)mit(dot)edu>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Getting sorted data from foreign server for merge join
Date: 2015-11-07 22:42:30
Message-ID: CAM-w4HOZqo4p36fWe7w2mFFUzgtR+ZF5PCWtfhx_53mM2j9b=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 6, 2015 at 4:54 AM, Ashutosh Bapat
<ashutosh(dot)bapat(at)enterprisedb(dot)com> wrote:
> PFA patch to get data sorted from the foreign server (postgres_fdw)
> according to the pathkeys useful for merge join.

An idle thought. There are going to be a lot of cases where different
software systems actually disagree about collation rules. I wonder if
it would be valuable to have a node that just checks that each row is
in fact greater than the previous row and throws an error if not. That
can be optional or a parameter of the FDW but it's probably cheap
enough to have enabled by default. It would save a lot of difficult to
heartache since the behaviour if the inputs aren't correctly sorted
will be strangely incorrect join results. Often the results may just
be missing or duplicated rows and that can be easy to miss and lead to
corrupted databases or security problems.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lars Kanis 2015-11-07 23:04:36 Re: Better name for PQsslAttributes()
Previous Message Tom Lane 2015-11-07 22:26:28 Re: OS X El Capitan and DYLD_LIBRARY_PATH