From c09e5a6a01659a66dd84f3e745694999d3414ddd Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 2 Feb 2025 10:26:04 +0100 Subject: Convert strategies to and from compare types For each Index AM, provide a mapping between operator strategies and the system-wide generic concept of a comparison type. For example, for btree, BTLessStrategyNumber maps to and from COMPARE_LT. Numerous places in the planner and executor think directly in terms of btree strategy numbers (and a few in terms of hash strategy numbers.) These should be converted over subsequent commits to think in terms of CompareType instead. (This commit doesn't make any use of this API yet.) Author: Mark Dilger Reviewed-by: Peter Eisentraut Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com --- doc/src/sgml/indexam.sgml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index dc7d14b60dd..d17fcbd5cec 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -164,6 +164,10 @@ typedef struct IndexAmRoutine amestimateparallelscan_function amestimateparallelscan; /* can be NULL */ aminitparallelscan_function aminitparallelscan; /* can be NULL */ amparallelrescan_function amparallelrescan; /* can be NULL */ + + /* interface functions to support planning */ + amtranslate_strategy_function amtranslatestrategy; /* can be NULL */ + amtranslate_cmptype_function amtranslatecmptype; /* can be NULL */ } IndexAmRoutine; @@ -876,6 +880,28 @@ amparallelrescan (IndexScanDesc scan); the beginning. + + +CompareType +amtranslatestrategy (StrategyNumber strategy, Oid opfamily, Oid opcintype); + +StrategyNumber +amtranslatecmptype (CompareType cmptype, Oid opfamily, Oid opcintype); + + These functions, if implemented, will be called by the planer and executor + to convert between fixed CompareType values and the specific + strategy numbers used by the access method. These functions can be + implemented by access methods that implement functionality similar to the + built-in btree or hash access methods, and by implementing these + translations, the system can learn about the semantics of the access + method's operations and can use them in place of btree or hash indexes in + various places. If the functionality of the access method is not similar + to those built-in access methods, these functions do not need to be + implemented. If the functions are not implemented, the access method will + be ignored for certain planner and executor decisions, but is otherwise + fully functional. + + -- cgit v1.2.3