FDW / list of needed columns, WHERE conditions (in PlanForeignScan)

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема FDW / list of needed columns, WHERE conditions (in PlanForeignScan)
Дата
Msg-id 4FC3E431.20704@fuzzy.cz
обсуждение исходный текст
Ответы Re: FDW / list of needed columns, WHERE conditions (in PlanForeignScan)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

I'm writing my first FDW, and I need to get the list of columns I
actually need to fetch when planning the query. I do want to fetch only
the columns that are actually needed, not all of them.

Initially I've used RelOptInfo->reltargetlist but it seems it does not
cover cases like
  SELECT 1 FROM FDW WHERE column_a = 1

and so on. Even RelOptInfo->attr_needed seems not to work as this
returns "not needed" for all columns:
   for (i = baserel->min_attr; i <= baserel->max_attr; i++) {       if (baserel->attr_needed[i-baserel->min_attr] !=
NULL)          elog(WARNING, "attr %d needed", i);       else           elog(WARNING, "attr %d not needed", i);   }
 

Where to get this info?

Also, I'd like to apply as much restrictions as possible when executing
the plan. I see there's PlanState->qual, described as "implicitly-ANDed
qual conditions", which I assume is what I need. But this seems to be
available only in BeginForeignScan (as ss.ps.qual in ForeignScanState),
not in planning which is the place where I need to compute estimates
etc. Where do I get this, when planning the query?

kind regards
Tomas


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: pg_basebackup --xlog compatibility break
Следующее
От: Tom Lane
Дата:
Сообщение: Re: FDW / list of needed columns, WHERE conditions (in PlanForeignScan)