pgsql: Allow LIMIT pushdown in postgres_fdw with empty ORDER BY pathkey
pgsql: Allow LIMIT pushdown in postgres_fdw with empty ORDER BY pathkey
От:
David Rowley <drowley@postgresql.org>
Дата:
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 Reviewed-by: Robins Tharakan 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(-)