From: | Michał Kłeczek <michal(at)kleczek(dot)org> |
---|---|
To: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
Cc: | David Rowley <dgrowleyml(at)gmail(dot)com>, Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Draft LIMIT pushdown to Append and MergeAppend patch |
Date: | 2023-10-09 13:09:01 |
Message-ID: | 7D291E0E-88FB-4E54-B0E6-AF519443C58A@kleczek.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On 9 Oct 2023, at 15:04, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>
> On Mon, Oct 9, 2023 at 4:33 PM David Rowley <dgrowleyml(at)gmail(dot)com <mailto:dgrowleyml(at)gmail(dot)com>> wrote:
>>
>> What are there benefits if the paths are already ordered? e.g if it's
>> an index scan then we'll only pull the tuples we need from it.
>>
>
> postgres_fdw creates a path with pathkeys based on the clauses on that
> relation. There is no index involved there. Pushing down LIMIT will
> limit the number of rows fetched from the foreign server and the
> foreign server may have opportunity to optimize query based on the
> LIMIT.
I would add another benefit:
opportunity to fetch everything early, buffer it and release the session.
Without limit information fdw has to keep cursors open.
—
Michal
From | Date | Subject | |
---|---|---|---|
Next Message | Amul Sul | 2023-10-09 13:26:58 | Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression |
Previous Message | Ashutosh Bapat | 2023-10-09 13:04:39 | Re: Draft LIMIT pushdown to Append and MergeAppend patch |