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

From: Vitaly Baranovsky <barvetalforums(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)
Date: 2019-05-06 15:38:42
Message-ID: CALWbrdG21EvPRMCWPUWuzfnukDRYq0M-+cggLxYzj6rSTHhdAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

On Mon, May 6, 2019 at 6:32 PM Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:

> On Mon, May 6, 2019 at 10:44 AM Vitaly Baranovsky <
> barvetalforums(at)gmail(dot)com> wrote:
>
>> Hello all,
>>
>> I faced strange behavior of PostgreSQL during the query execution.
>>
>
> ...
>
>
>> Also, please, note, that SQL without WHERE clause has been set to the
>> foreign server:
>> " Remote SQL: SELECT primary_uuid FROM public.foreign_table"
>>
>> So, the optimizer doesn't select optimal plans for such executions :(
>>
>
> It works the way you want in version 12, which is currently under
> development and should be released in 5 months or so.
>
> Cheers,
>
> Jeff
>
>>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2019-05-06 15:53:19 Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)
Previous Message Jeff Janes 2019-05-06 15:32:03 Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)