Draft LIMIT pushdown to Append and MergeAppend patch

From: Michał Kłeczek <michal(at)kleczek(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Draft LIMIT pushdown to Append and MergeAppend patch
Date: 2023-10-07 10:01:17
Message-ID: B629FDD4-78CE-45BE-A1C6-30E8B233FA3C@kleczek.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,

Attached is a draft patch implementing LIMIT pushdown to Append and MergeAppend nodes.

This patch eliminates the need to resort to subqueries to optimise UNIONs.
It also enables more aggressive partition pruning.
Not sure if it causes LIMIT pushdown to foreign partitions though.

Applying this patch causes regressions in:
- postgres_fdw tests
- partitions tests

This is due to subsequent partition pruning applied when LIMIT is pushed down - I guess that’s a (big) win.

I would be happy to hear if the approach is sound.

Thanks,
Michal

Attachment Content-Type Size
limit-pushdown.patch application/octet-stream 2.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2023-10-07 10:29:41 Re: Wrong results with grouping sets
Previous Message Richard Guo 2023-10-07 09:39:48 Check each of base restriction clauses for constant-FALSE-or-NULL