| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | assam258(at)gmail(dot)com, jian(dot)universality(at)gmail(dot)com |
| Cc: | pgsql-hackers(at)postgresql(dot)org, zsolt(dot)parragi(at)percona(dot)com, sjjang112233(at)gmail(dot)com, vik(at)postgresfriends(dot)org, er(at)xs4all(dot)nl, jacob(dot)champion(at)enterprisedb(dot)com, david(dot)g(dot)johnston(at)gmail(dot)com, peter(at)eisentraut(dot)org, li(dot)evan(dot)chao(at)gmail(dot)com |
| Subject: | Re: Row pattern recognition |
| Date: | 2026-07-03 12:13:09 |
| Message-ID: | 20260703.211309.1130370315247638762.ishii@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matheus Alcantara | 2026-07-03 12:50:57 | Re: hashjoins vs. Bloom filters (yet again) |
| Previous Message | Heikki Linnakangas | 2026-07-03 12:10:30 | Re: Fix tracing of BackendKeyData and CancelRequest messages |