Re: FDW for PostgreSQL

From: 花田 茂 <shigeru(dot)hanada(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>, Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FDW for PostgreSQL
Date: 2012-11-07 02:52:56
Message-ID: B93EA32C-2E08-47FE-8F4B-9EF76E7B2EFF@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2012/11/07, at 1:35, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Isn't it possible to pick-up only columns to be used in targetlist or
>> local qualifiers, without modification of baserestrictinfo?
>
> What the doc means to suggest is that you can look through the
> baserestrictinfo list and then record information elsewhere about
> interesting clauses you find. If the FDW is actually *modifying* that
> list, I agree that seems like a bad idea.

Kaigai-san might have misunderstood that postgresql_fdw changes
baserestrictinfo, since it did so in old implementation.

ClassifyConditions creates new lists, local_conds and remote_conds,
which have cells which point RestrictInfo(s) in baserestrictinfo.
It doesn't copy RestrictInfo for new lists, but I think it's ok
because baserestrictinfo list itself and RestrictInfo(s) pointed by
it are never modified by postgresql_fdw.

> I don't recall anything in
> the core system that does that, so it seems fragile. The closest
> parallel I can think of in the core system is indexscans pulling out
> restriction clauses to use as index quals. That code doesn't modify
> the baserestrictinfo list, only make new lists with some of the same
> entries.

Thanks for the advise. I found relation_excluded_by_constraints
which is called by set_rel_size() creates new RestrictInfo list from
baserestrictinfo, and this seems like what postgresql_fdw does in
GetForeignRelSize, from the perspective of relation size estimation.

Regards,
--
Shigeru HANADA
shigeru(dot)hanada(at)gmail(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-11-07 02:57:44 Re: FDW for PostgreSQL
Previous Message Etsuro Fujita 2012-11-07 02:32:20 Re: Update obsolete text in indexam.sgml