pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Relax ordering-related hardcoded btree requirements in planning
Date: Sun, 06 Apr 2025 12:54:40 +0000
Message-ID: <E1u1PWK-002xjh-32@gemulon.postgresql.org> (raw)

Relax ordering-related hardcoded btree requirements in planning

There were several places in ordering-related planning where a
requirement for btree was hardcoded but an amcanorder index could
suffice.  This fixes that.  We just need to do the necessary mapping
between strategy numbers and compare types and adjust some related
APIs so that this works independent of btree strategy numbers.  For
instance, non-btree amcanorder indexes can now be used to support
sorting and merge joins.  Also, predtest.c works independent of btree
strategy numbers now.

To avoid performance regressions, some details on btree and other
built-in index types are still hardcoded as shortcuts, but other index
types now have access to the same features by providing the required
flags and callbacks.

Author: Mark Dilger <mark.dilger@enterprisedb.com>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a8025f544854ad8b865c6b4509030ee84aa8f4a0

Modified Files
--------------
src/backend/access/index/amapi.c        |  10 ++
src/backend/executor/nodeMergejoin.c    |   2 +-
src/backend/optimizer/path/allpaths.c   |  28 +++---
src/backend/optimizer/path/equivclass.c |   3 +-
src/backend/optimizer/path/pathkeys.c   |  22 ++---
src/backend/optimizer/plan/createplan.c |  10 +-
src/backend/optimizer/util/plancat.c    |  38 ++++----
src/backend/optimizer/util/predtest.c   | 122 +++++++++++------------
src/backend/parser/parse_clause.c       |   4 +-
src/backend/parser/parse_expr.c         |  34 +++----
src/backend/utils/adt/selfuncs.c        |  62 +++++++-----
src/backend/utils/cache/lsyscache.c     | 165 +++++++++++++++++++++-----------
src/backend/utils/sort/sortsupport.c    |   6 +-
src/include/utils/lsyscache.h           |  14 +--
src/include/utils/selfuncs.h            |   2 +-
src/tools/pgindent/typedefs.list        |   2 +-
16 files changed, 298 insertions(+), 226 deletions(-)



Message-ID: <E1u1PWK-002xjh-32@gemulon.postgresql.org>
Permalink:  ../E1u1PWK-002xjh-32@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1u1PWK-002xjh-32@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Relax ordering-related hardcoded btree requirements in planning
  In-Reply-To: <E1u1PWK-002xjh-32@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox