| From: | David Rowley <drowley(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Allow LIMIT pushdown in postgres_fdw with empty ORDER BY pathkey |
| Date: | 2026-11-04 03:24:04 |
| Message-ID: | E1xORbY-000000006Zf-3NqC@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Allow LIMIT pushdown in postgres_fdw with empty ORDER BY pathkeys
When all of the ORDER BY clause's PathKeys are redundant due to consts in
all of the pathkeys' EquivalenceClasses, sort_pathkeys is NIL, but
query_pathkeys may then get set to setop_pathkeys, which may not be
shippable. add_foreign_ordered_paths() previously used the shippability
of query_pathkeys to decide whether the UPPERREL_ORDERED step was safe to
push down, which needlessly prevented the subsequent UPPERREL_FINAL step
from pushing down the LIMIT. No sort is needed in this case, so just mark
the ordered step as pushdown-safe.
Author: David Rowley <dgrowleyml(at)gmail(dot)com>
Reviewed-by: Robins Tharakan <tharakan(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAEP4nAwnSefmi4w+89XbHQ0f-0OixCYUJo9kVcbXSYL8L4rEPg@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/b6178c942ea7a85f72beb6a775d2793062a7ff8e
Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 10 ++++++++++
contrib/postgres_fdw/postgres_fdw.c | 14 ++++++++++----
contrib/postgres_fdw/sql/postgres_fdw.sql | 4 ++++
3 files changed, 24 insertions(+), 4 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nikolay Samokhvalov | 2026-11-04 06:41:15 | Re: pgsql: Reduce "Var IS [NOT] NULL" quals during constant folding |
| Previous Message | David Rowley | 2026-11-04 02:58:38 | pgsql: Fix incorrect Assert in add_foreign_ordered_paths |