Re: Row pattern recognition - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: Row pattern recognition
Date
Msg-id 20260703.211309.1130370315247638762.ishii@postgresql.org
Whole thread
In response to Re: Row pattern recognition  (Tatsuo Ishii <ishii@postgresql.org>)
Responses Re: Row pattern recognition
List pgsql-hackers
Hi Henson, Jian,

In v50-0006-tidy-plumbing.patch, the planner cost model seems slightly
changed.  Before the cost was charged according to the number of
pattern variables in PATTERN clause.  But now it is charged according
to the number of pattern variables in DEFINE clause.  Maybe I missed
the discussion on the changing. Can you please explain the reason of
the change?

--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -3231,30 +3231,18 @@ cost_windowagg(Path *path, PlannerInfo *root,
      * so we'll just do this for now.
      *
      * Moreover, if row pattern recognition is used, we charge the DEFINE
-     * expressions once per tuple for each variable that appears in PATTERN.
+     * expressions once per tuple for each DEFINE variable.
      */
     if (winclause->rpPattern)
     {
-        List       *pattern_vars;
         QualCost    defcosts;
 
-        pattern_vars = collectPatternVariables(winclause->rpPattern);
-
-        foreach_node(String, pv, pattern_vars)
+        foreach_node(TargetEntry, def, winclause->defineClause)
         {
-            char       *ptname = strVal(pv);
-
-            foreach_node(TargetEntry, def, winclause->defineClause)
-            {
-                if (!strcmp(ptname, def->resname))
-                {
-                    cost_qual_eval_node(&defcosts, (Node *) def->expr, root);
-                    startup_cost += defcosts.startup;
-                    total_cost += defcosts.per_tuple * input_tuples;
-                }
-            }
+            cost_qual_eval_node(&defcosts, (Node *) def->expr, root);
+            startup_cost += defcosts.startup;
+            total_cost += defcosts.per_tuple * input_tuples;
         }

Regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Fix tracing of BackendKeyData and CancelRequest messages
Next
From: "Matheus Alcantara"
Date:
Subject: Re: hashjoins vs. Bloom filters (yet again)