Re: postgres_fdw bug in 9.6

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postgres_fdw bug in 9.6
Date: 2017-01-10 12:15:22
Message-ID: CAFjFpRePaFOMg_k0T5r9qQZe_yZZoGubp2P2CFF6B4zoZ-rAKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>> If the inner and/or outer paths are not ordered as required, we will need
>> to
>> order them. Code below doesn't seem to handle that case.
>> /*
>> * If the paths are already well enough ordered, we
>> can
>> * skip doing an explicit sort.
>> */
>> if (outerkeys &&
>> pathkeys_contained_in(outerkeys,
>> outer_path->pathkeys))
>> outerkeys = NIL;
>> if (innerkeys &&
>> pathkeys_contained_in(innerkeys,
>> inner_path->pathkeys))
>> innerkeys = NIL;
>
>
> I might be missing something, but if the outer/inner paths are already well
> sorted, we wouldn't need an explicit sort, so we can set the
> outerkeys/innerkeys to NIL safely. (You can find the same optimization in
> try_mergejoin_path.)

Actually I didn't notice that create_mergejoin_path saves those keys
in the MergePath and then adds sorting steps during planning. Sorry
for the trouble.

Another concern here is that we are copying pieces of logic in
add_paths_to_joinrel() without arranging it as neatly as in that
function.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-01-10 13:24:24 Re: proposal: session server side variables
Previous Message Dilip Kumar 2017-01-10 11:46:00 Re: Parallel bitmap heap scan