Re: FDW LIM IT pushdown

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Michał Kłeczek <michal(at)kleczek(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: FDW LIM IT pushdown
Date: 2023-10-09 09:32:15
Message-ID: CAExHW5uyZhPq0SKN+gMU8xmAV0Qz2zacaohKh09qJzXCfijNcA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Michal,

On Fri, Oct 6, 2023 at 9:34 PM Michał Kłeczek <michal(at)kleczek(dot)org> wrote:
>
> Hello hackers,
>
> First timer here with a question:
>
> I’ve searched through various e-mail threads and documents and could not find if pushdown of LIMIT clauses to FDW is implemented.
> Seen some conversation about that a couple of years ago when that was treated as a feature request but nothing since then.
> Citus does that according to its documentation but for now we are trying to base our solution on “plain” Postgres.
>
> If it is not implemented - could you, guys, provide me with some pointers to source code where I could look at and try to implement that?
>

I started looking at code from grouping_planner and reached
create_ordinary_grouping_paths(). It calls
create_partitionwise_grouping_paths() to push aggregate and grouping
down into partitions and from there it is pushed down into FDW.
Looking at create_limit_path(), I don't similar treatment. So there
may be some cases where we are not pushing down final LIMIT.

However create_append_path() uses PlannerInfo::limit_tuples or
root->limit_tuples when creating append path node. So either it's
being used for costing or for pushing it down to the partitions.

This isn't a full answer, but I hope these pointers would help you.

--
Best Wishes,
Ashutosh Bapat

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-10-09 09:37:21 Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag
Previous Message Gurjeet Singh 2023-10-09 09:31:30 Re: [PoC/RFC] Multiple passwords, interval expirations