nocfbot-absorb-definition-doc.txt

text/plain

Filename: nocfbot-absorb-definition-doc.txt
Type: text/plain
Part: 1
Message: Re: Row pattern recognition
diff --git a/src/backend/executor/README.rpr b/src/backend/executor/README.rpr
index 9275e265d4b..f5e90848458 100644
--- a/src/backend/executor/README.rpr
+++ b/src/backend/executor/README.rpr
@@ -407,6 +407,10 @@ IV-5. Absorbability Analysis (RPR_ELEM_ABSORBABLE)
 Context absorption is an optimization technique that reduces O(n^2) to O(n).
 (Runtime behavior is described in Chapter VIII.)
 
+Definition: a pattern is absorbable when the first unbounded repetition of a
+fixed-length body reachable from the start of the pattern exists; that
+repetition is the absorption comparison point.
+
 This phase determines whether the pattern has a structure suitable for the
 absorption optimization and sets flags on the relevant elements:
 
diff --git a/src/backend/optimizer/plan/rpr.c b/src/backend/optimizer/plan/rpr.c
index fac3d7bcf38..f2801ffcba3 100644
--- a/src/backend/optimizer/plan/rpr.c
+++ b/src/backend/optimizer/plan/rpr.c
@@ -1742,6 +1742,10 @@ computeAbsorbabilityRecursive(RPRPattern *pattern, RPRElemIdx startIdx,
  * newer contexts that cannot produce longer matches than older contexts.
  * This achieves O(n^2) -> O(n) performance improvement.
  *
+ * Definition: a pattern is absorbable when the first unbounded repetition of
+ * a fixed-length body reachable from the start of the pattern exists; that
+ * repetition is the absorption comparison point.
+ *
  * Only greedy unbounded quantifiers at pattern start can be absorbable.
  * Reluctant quantifiers are excluded because they don't maintain monotonic
  * decrease property required for safe absorption.