(2011/11/28 20:50), Shigeru Hanada wrote:
> (2011/11/25 17:27), Etsuro Fujita wrote:
>> So, I think it might be better to estimate
>> such costs by pgsql_fdw itself without EXPLAINing on the assumption that
>> a remote postgres server has the same abilities for query optimization,
>> which is less costly and widely applicable to the other DBMSs, while it,
>> of course, only works once we have statistics and/or index information
>> for foreign tables. But AFAIK we eventually want to have those, so I'd
>> like to propose to use the proposed approach until that time.
>
> Knowledge of foreign indexes also provide information of sort order.
> Planner will be able to consider merge join without local sort with such
> information. Without foreign index, we have to enumerate possible sort
> keys with Blute-Force approach for same result, as mentioned by
> Itagaki-san before.
Yes, with the knowledge of foreign indexes, I think we can take the
approach of thinking multiple plans for a foreign table; the cheapest
unordered plan and the cheapest plan with a given sort order. In
addition, it would be also possible to support
nestloop-with-inner-foreign-indexscans on a foreign table as pointed out
as future work by Tom Lane at PGCon 2011[1].
[1] http://www.pgcon.org/2011/schedule/attachments/188_Planner%20talk.pdf
Best regards,
Etsuro Fujita