Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 6, 2019 at 11:53 AM Jeff Janes <jeff.janes@xxxxxxxxx> wrote:
On Mon, May 6, 2019 at 11:38 AM Vitaly Baranovsky <barvetalforums@xxxxxxxxx> wrote:
Thank you, Jeff!

We'll be looking forward to the next version of Postgres in this case.

As far as I understand, you've answered about sending filtering condition to a foreign server... Could you, please, clarify about another (the first) part of my question? Why the server choose seq scan instead of pk key index only scan for the local table? 

Thank you


Aren't those the same thing?  The foreign server can't use the where clause, if it doesn't get sent. 

Nevermind. When you said local table, I had some tunnel vision and was thinking of the foreign table as viewed from the perspective of the foreign server (to which it is local), not the actual local table.   That too is "fixed" in the same commit to the 12dev branch as the other issue is: 

commit 4be058fe9ec5e630239b656af21fc083371f30ed
Date:   Mon Jan 28 17:54:10 2019 -0500

    In the planner, replace an empty FROM clause with a dummy RTE.
 

My tests are all done with empty, unanalyzed tables as I just took you DDL without inventing my own DML, so may be different than what what you were seeing with your populated tables.

Cheers,

Jeff

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux