> On 7 Oct 2023, at 12:01, Michał Kłeczek wrote: > > 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