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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Vitaly Baranovsky <barvetalforums(at)gmail(dot)com>, 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:53:19
Message-ID: 16478.1557157999@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> It works the way you want in version 12, which is currently under
> development and should be released in 5 months or so.

Even in older versions, the OP would get a significantly smarter
plan after setting use_remote_estimate = on. I think the core
issue here is that we won't generate remote parameterized paths
without that:

/*
* If we're not using remote estimates, stop here. We have no way to
* estimate whether any join clauses would be worth sending across, so
* don't bother building parameterized paths.
*/
if (!fpinfo->use_remote_estimate)
return;

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2019-05-06 15:53:46 Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)
Previous Message Vitaly Baranovsky 2019-05-06 15:38:42 Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)