summaryrefslogtreecommitdiff
path: root/src/backend/access/index/amapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/index/amapi.c')
-rw-r--r--src/backend/access/index/amapi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/access/index/amapi.c b/src/backend/access/index/amapi.c
index d6b8dad4d52..f0f4f974bce 100644
--- a/src/backend/access/index/amapi.c
+++ b/src/backend/access/index/amapi.c
@@ -120,6 +120,11 @@ IndexAmTranslateStrategy(StrategyNumber strategy, Oid amoid, Oid opfamily, bool
CompareType result;
IndexAmRoutine *amroutine;
+ /* shortcut for common case */
+ if (amoid == BTREE_AM_OID &&
+ (strategy > InvalidStrategy && strategy <= BTMaxStrategyNumber))
+ return (CompareType) strategy;
+
amroutine = GetIndexAmRoutineByAmId(amoid, false);
if (amroutine->amtranslatestrategy)
result = amroutine->amtranslatestrategy(strategy, opfamily);
@@ -145,6 +150,11 @@ IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool m
StrategyNumber result;
IndexAmRoutine *amroutine;
+ /* shortcut for common case */
+ if (amoid == BTREE_AM_OID &&
+ (cmptype > COMPARE_INVALID && cmptype <= COMPARE_GT))
+ return (StrategyNumber) cmptype;
+
amroutine = GetIndexAmRoutineByAmId(amoid, false);
if (amroutine->amtranslatecmptype)
result = amroutine->amtranslatecmptype(cmptype, opfamily);