Re: postgres_fdw and column casting shippability

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: postgres_fdw and column casting shippability
Date: 2017-05-16 16:54:13
Message-ID: CAMkU=1yoqZem84+xXzTa=GQnL1k+vaafO2bCBQMukyqh2SQPjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, May 15, 2017 at 3:22 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> > I've tried versions 9.6.3 and 10dev, and neither do what I expected. It
> > doesn't seem to be a planning problem where it thinks the fast plan is
> > slower, it just doesn't seem to consider the faster plans as being
> options
> > at all. Is there some setting to make it realize the cast is shippable?
>
> AFAICS, postgres_fdw doesn't have any knowledge of CoerceViaIO parse
> nodes, so it's never going to consider this type of brute-force cast
> as shippable. Normal casts would presumably be shippable if the
> underlying function is considered safe.
>

So then, the secret is to write it like this:

explain analyze select data from remote2 join remote1 on (int8in(textout(
remote2.id)) = remote1.id)
where cutoff > 0.9999;

This works to have the join pushed to the foreign side in 9.6, but not
before that.

Thanks,

Jeff

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Adam Brusselback 2017-05-19 15:14:05 GIN index not used if created in the same transaction as query
Previous Message Tom Lane 2017-05-15 22:22:48 Re: postgres_fdw and column casting shippability