Re: [HACKERS] An issue in remote query optimization - Mailing list pgsql-hackers

From Etsuro Fujita
Subject Re: [HACKERS] An issue in remote query optimization
Date
Msg-id ee1b3b18-95b2-94b5-9c12-d8596fd216a9@lab.ntt.co.jp
Whole thread Raw
In response to [HACKERS] An issue in remote query optimization  (Abbas Butt <abbas.butt@enterprisedb.com>)
Responses Re: [HACKERS] An issue in remote query optimization  (Abbas Butt <abbas.butt@enterprisedb.com>)
List pgsql-hackers
On 2017/01/31 18:24, Abbas Butt wrote:
> Postgres_fdw optimizes remote queries by pushing down the where clause.
> This feature does not work consistently when the query is executed from
> within a pl/pgsql function. The optimization works when the function
> executes the query for the first 5 times, and fails afterwards.

> I understand that this is because PostgreSQL starts using generic plan
> with pulled up where clause after the 5th invocation hoping that it
> would be faster since we have skiped planning the query on each
> invocation, but in this case this decision is causing the query to slow
> down.
>
> How should we fix this problem?

ANALYZE for the foreign table doesn't work?

Best regards,
Etsuro Fujita





pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: [HACKERS] IF (NOT) EXISTS in psql-completion
Next
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] patch: function xmltable