Re: FDW for PostgreSQL - Mailing list pgsql-hackers

From 花田 茂
Subject Re: FDW for PostgreSQL
Date
Msg-id B93EA32C-2E08-47FE-8F4B-9EF76E7B2EFF@gmail.com
Whole thread Raw
In response to Re: FDW for PostgreSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: FDW for PostgreSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2012/11/07, at 1:35, Tom Lane <tgl@sss.pgh.pa.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.hanada@gmail.com







pgsql-hackers by date:

Previous
From: "Etsuro Fujita"
Date:
Subject: Re: Update obsolete text in indexam.sgml
Next
From: Tom Lane
Date:
Subject: Re: FDW for PostgreSQL