Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru> writes:
> The following very simple test reduce the problem with wrong cost
> estimation:
> create foreign table t1_fdw(x integer, y integer) server pg_fdw options
> (table_name 't1', use_remote_estimate 'false');
> create foreign table t2_fdw(x integer) server pg_fdw options (table_name
> 't2', use_remote_estimate 'false');
> It is possible to force Postgres to use correct plan by setting
> "fdw_startup_cost" to some very large value (100000000 for example).
> ...
> Also correct plan is used when use_remote_estimate is true.
If you are unhappy about the results with use_remote_estimate off, don't
run it that way. The optimizer does not have a crystal ball.
regards, tom lane