Re: Missed LIMIT clause pushdown in FDW API

From: Alexander Reshetov <alexander(dot)v(dot)reshetov(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Missed LIMIT clause pushdown in FDW API
Date: 2016-03-31 21:16:58
Message-ID: CAKi3F36Y1ON08uT-oDxUwhgSr4TtmT-B+GBg_CJwpbi-=khPeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom, it's really good news. Thanks!

For now as workaround I think that it's possible to add additional column
in table. In this way it would be possible to scan only needed part of solumn
in storage. While quals is pushed down it will be possible to limit like this

select * from table where fake_column == 1

So this fake column would be used as flag for FDW engine to limit query
to one result. Of course it can't replace LIMIT, but could help to use
at least lateral join with “limit 1” method.

But I'm not sure that some results would not be cached in this situation.
Will this workaround work as expected? Or maybe there is some other possible
temporary solution (at least for specified lateral join)?

On Wed, Mar 30, 2016 at 4:33 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>> On Wed, Mar 30, 2016 at 3:52 AM, Alexander Reshetov
>> <alexander(dot)v(dot)reshetov(at)gmail(dot)com> wrote:
>>> As far as I know there is no LIMIT clause pushdown in FDW API.
>>> Is there some reasons not to support LIMIT clause pushdown?
>
> It was impossible to do it before 3fc6e2d7f5b652b4, committed 3 weeks
> ago. Now that that infrastructure exists, someone might look into
> using it for this purpose ... but not before 9.7 at the earliest.
>
>> Working for me on 9.5 with postgres_fdw...
>
> Really? It's true that postgres_fdw won't fetch more rows than it
> actually needs from the remote --- but that's not the same as telling
> the remote planner to prefer a fast-start plan.
>
> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-03-31 21:28:33 Re: Create trigger on Materialized View?
Previous Message Thomas Munro 2016-03-31 20:55:34 Re: Multixacts wraparound monitoring