1
1
diff --git a/contrib/Makefile b/contrib/Makefile
2
- index f27e458482..0c62191904 100644
2
+ index f27e458482e..0c621919045 100644
3
3
--- a/contrib/Makefile
4
4
+++ b/contrib/Makefile
5
5
@@ -7,6 +7,7 @@ include $(top_builddir)/src/Makefile.global
@@ -11,7 +11,7 @@ index f27e458482..0c62191904 100644
11
11
auto_explain \
12
12
bloom \
13
13
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
14
- index 70551522da..958529fbab 100644
14
+ index 70551522dac..958529fbab4 100644
15
15
--- a/src/backend/commands/explain.c
16
16
+++ b/src/backend/commands/explain.c
17
17
@@ -24,6 +24,7 @@
@@ -57,7 +57,7 @@ index 70551522da..958529fbab 100644
57
57
if (es->format == EXPLAIN_FORMAT_TEXT)
58
58
appendStringInfoChar(es->str, '\n');
59
59
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
60
- index 4d9746d54a..6fa85d1c71 100644
60
+ index 4d9746d54a0..6fa85d1c71f 100644
61
61
--- a/src/backend/nodes/copyfuncs.c
62
62
+++ b/src/backend/nodes/copyfuncs.c
63
63
@@ -132,6 +132,7 @@ CopyPlanFields(const Plan *from, Plan *newnode)
@@ -69,35 +69,31 @@ index 4d9746d54a..6fa85d1c71 100644
69
69
70
70
/*
71
71
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
72
- index 58c2590698..1e06738a13 100644
72
+ index 58c2590698c..b9f39d36e03 100644
73
73
--- a/src/backend/nodes/outfuncs.c
74
74
+++ b/src/backend/nodes/outfuncs.c
75
75
@@ -342,6 +342,7 @@ _outPlanInfo(StringInfo str, const Plan *node)
76
76
WRITE_NODE_FIELD(initPlan);
77
77
WRITE_BITMAPSET_FIELD(extParam);
78
78
WRITE_BITMAPSET_FIELD(allParam);
79
- + /* WRITE_NODE_FIELD(ext_nodes); */
79
+ + WRITE_NODE_FIELD(ext_nodes);
80
80
}
81
81
82
82
/*
83
83
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
84
- index eaa51c5c06..6ad8b78c7d 100644
84
+ index eaa51c5c062..65741a86a05 100644
85
85
--- a/src/backend/nodes/readfuncs.c
86
86
+++ b/src/backend/nodes/readfuncs.c
87
- @@ -1628,6 +1628,11 @@ ReadCommonPlan(Plan *local_node)
87
+ @@ -1628,6 +1628,7 @@ ReadCommonPlan(Plan *local_node)
88
88
READ_NODE_FIELD(initPlan);
89
89
READ_BITMAPSET_FIELD(extParam);
90
90
READ_BITMAPSET_FIELD(allParam);
91
- + local_node->ext_nodes = NIL;
92
- + /* READ_NODE_FIELD(ext_nodes);
93
- + * Don't serialize this field. It is required to serialize RestrictInfo and
94
- + * EqualenceClass.
95
- + */
91
+ + READ_NODE_FIELD(ext_nodes);
96
92
}
97
93
98
94
/*
99
95
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
100
- index 006f91f0a8..ef9c8ec581 100644
96
+ index 006f91f0a87..ef9c8ec5817 100644
101
97
--- a/src/backend/optimizer/path/costsize.c
102
98
+++ b/src/backend/optimizer/path/costsize.c
103
99
@@ -98,6 +98,11 @@
@@ -362,7 +358,7 @@ index 006f91f0a8..ef9c8ec581 100644
362
358
{
363
359
double parallel_divisor = path->parallel_workers;
364
360
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
365
- index 0ed858f305..9d4a6c5903 100644
361
+ index 0ed858f305a..9d4a6c59030 100644
366
362
--- a/src/backend/optimizer/plan/createplan.c
367
363
+++ b/src/backend/optimizer/plan/createplan.c
368
364
@@ -71,6 +71,7 @@
@@ -393,7 +389,7 @@ index 0ed858f305..9d4a6c5903 100644
393
389
394
390
/*
395
391
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
396
- index 70899e5430..34075cc87b 100644
392
+ index 5da863d85de..5b21ffd0667 100644
397
393
--- a/src/backend/optimizer/plan/planner.c
398
394
+++ b/src/backend/optimizer/plan/planner.c
399
395
@@ -143,7 +143,8 @@ static List *extract_rollup_sets(List *groupingSets);
@@ -406,7 +402,7 @@ index 70899e5430..34075cc87b 100644
406
402
grouping_sets_data *gd,
407
403
List *target_list);
408
404
static RelOptInfo *create_grouping_paths(PlannerInfo *root,
409
- @@ -3151 ,7 +3152 ,8 @@ standard_qp_callback(PlannerInfo *root, void *extra)
405
+ @@ -3145 ,7 +3146 ,8 @@ standard_qp_callback(PlannerInfo *root, void *extra)
410
406
*/
411
407
static double
412
408
get_number_of_groups(PlannerInfo *root,
@@ -416,7 +412,7 @@ index 70899e5430..34075cc87b 100644
416
412
grouping_sets_data *gd,
417
413
List *target_list)
418
414
{
419
- @@ -3188 ,7 +3190 ,7 @@ get_number_of_groups(PlannerInfo *root,
415
+ @@ -3182 ,7 +3184 ,7 @@ get_number_of_groups(PlannerInfo *root,
420
416
GroupingSetData *gs = lfirst_node(GroupingSetData, lc2);
421
417
double numGroups = estimate_num_groups(root,
422
418
groupExprs,
@@ -425,7 +421,7 @@ index 70899e5430..34075cc87b 100644
425
421
&gset,
426
422
NULL);
427
423
428
- @@ -3214 ,7 +3216 ,7 @@ get_number_of_groups(PlannerInfo *root,
424
+ @@ -3208 ,7 +3210 ,7 @@ get_number_of_groups(PlannerInfo *root,
429
425
GroupingSetData *gs = lfirst_node(GroupingSetData, lc2);
430
426
double numGroups = estimate_num_groups(root,
431
427
groupExprs,
@@ -434,7 +430,7 @@ index 70899e5430..34075cc87b 100644
434
430
&gset,
435
431
NULL);
436
432
437
- @@ -3231 ,8 +3233 ,8 @@ get_number_of_groups(PlannerInfo *root,
433
+ @@ -3225 ,8 +3227 ,8 @@ get_number_of_groups(PlannerInfo *root,
438
434
groupExprs = get_sortgrouplist_exprs(parse->groupClause,
439
435
target_list);
440
436
@@ -445,7 +441,7 @@ index 70899e5430..34075cc87b 100644
445
441
}
446
442
}
447
443
else if (parse->groupingSets)
448
- @@ -3619 ,7 +3621 ,8 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
444
+ @@ -3613 ,7 +3615 ,8 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
449
445
* Estimate number of groups.
450
446
*/
451
447
dNumGroups = get_number_of_groups(root,
@@ -455,7 +451,7 @@ index 70899e5430..34075cc87b 100644
455
451
gd,
456
452
extra->targetList);
457
453
458
- @@ -6425 ,13 +6428 ,15 @@ create_partial_grouping_paths(PlannerInfo *root,
454
+ @@ -6419 ,13 +6422 ,15 @@ create_partial_grouping_paths(PlannerInfo *root,
459
455
if (cheapest_total_path != NULL)
460
456
dNumPartialGroups =
461
457
get_number_of_groups(root,
@@ -474,7 +470,7 @@ index 70899e5430..34075cc87b 100644
474
470
extra->targetList);
475
471
476
472
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
477
- index e105a4d5f1..c5bcc9d1d1 100644
473
+ index e105a4d5f1d..c5bcc9d1d15 100644
478
474
--- a/src/backend/optimizer/util/relnode.c
479
475
+++ b/src/backend/optimizer/util/relnode.c
480
476
@@ -258,6 +258,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
@@ -540,7 +536,7 @@ index e105a4d5f1..c5bcc9d1d1 100644
540
536
541
537
return ppi;
542
538
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
543
- index 87879c9ddc..1aad8c43d9 100644
539
+ index 87879c9ddc8..1aad8c43d92 100644
544
540
--- a/src/backend/utils/adt/selfuncs.c
545
541
+++ b/src/backend/utils/adt/selfuncs.c
546
542
@@ -143,6 +143,7 @@
@@ -573,7 +569,7 @@ index 87879c9ddc..1aad8c43d9 100644
573
569
* estimate_num_groups - Estimate number of groups in a grouped query
574
570
*
575
571
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
576
- index e94d9e49cf..49236ced77 100644
572
+ index e94d9e49cf6..49236ced77c 100644
577
573
--- a/src/include/commands/explain.h
578
574
+++ b/src/include/commands/explain.h
579
575
@@ -75,6 +75,18 @@ extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
@@ -596,7 +592,7 @@ index e94d9e49cf..49236ced77 100644
596
592
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
597
593
ParamListInfo params, DestReceiver *dest);
598
594
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
599
- index e370a01141..9f2f1628f5 100644
595
+ index 3c034fa3c5e..e441674970c 100644
600
596
--- a/src/include/nodes/pathnodes.h
601
597
+++ b/src/include/nodes/pathnodes.h
602
598
@@ -756,6 +756,10 @@ typedef struct RelOptInfo
@@ -635,7 +631,7 @@ index e370a01141..9f2f1628f5 100644
635
631
636
632
637
633
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
638
- index 2308c80dde..a933afa483 100644
634
+ index 1c9357f6a77..58c005c1a9b 100644
639
635
--- a/src/include/nodes/plannodes.h
640
636
+++ b/src/include/nodes/plannodes.h
641
637
@@ -158,6 +158,9 @@ typedef struct Plan
@@ -649,7 +645,7 @@ index 2308c80dde..a933afa483 100644
649
645
650
646
/* ----------------
651
647
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
652
- index 2113bc82de..bcc2520cec 100644
648
+ index 2113bc82de0..bcc2520cec5 100644
653
649
--- a/src/include/optimizer/cost.h
654
650
+++ b/src/include/optimizer/cost.h
655
651
@@ -39,6 +39,37 @@ typedef enum
@@ -733,7 +729,7 @@ index 2113bc82de..bcc2520cec 100644
733
729
734
730
#endif /* COST_H */
735
731
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
736
- index 2922c0cdc1..c59dce6989 100644
732
+ index 2922c0cdc14..c59dce6989e 100644
737
733
--- a/src/include/optimizer/pathnode.h
738
734
+++ b/src/include/optimizer/pathnode.h
739
735
@@ -18,6 +18,10 @@
@@ -748,7 +744,7 @@ index 2922c0cdc1..c59dce6989 100644
748
744
* prototypes for pathnode.c
749
745
*/
750
746
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
751
- index bf1adfc52a..9c78e0f4e0 100644
747
+ index bf1adfc52ac..9c78e0f4e02 100644
752
748
--- a/src/include/optimizer/planmain.h
753
749
+++ b/src/include/optimizer/planmain.h
754
750
@@ -24,6 +24,12 @@ extern double cursor_tuple_fraction;
@@ -765,7 +761,7 @@ index bf1adfc52a..9c78e0f4e0 100644
765
761
* prototypes for plan/planmain.c
766
762
*/
767
763
diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h
768
- index 9dd444e1ff..cfaae98aa2 100644
764
+ index 9dd444e1ff5..b0b5a656185 100644
769
765
--- a/src/include/utils/selfuncs.h
770
766
+++ b/src/include/utils/selfuncs.h
771
767
@@ -144,6 +144,13 @@ typedef bool (*get_index_stats_hook_type) (PlannerInfo *root,
@@ -782,13 +778,13 @@ index 9dd444e1ff..cfaae98aa2 100644
782
778
783
779
/* Functions in selfuncs.c */
784
780
785
- @@ -213 ,6 +220 ,9 @@ extern void mergejoinscansel(PlannerInfo *root, Node *clause,
786
- extern double estimate_num_groups(PlannerInfo *root, List *groupExprs ,
787
- double input_rows, List **pgset,
788
- EstimationInfo *estinfo);
781
+ @@ -210 ,6 +217 ,9 @@ extern void mergejoinscansel(PlannerInfo *root, Node *clause,
782
+ Selectivity *leftstart, Selectivity *leftend ,
783
+ Selectivity *rightstart, Selectivity *rightend);
784
+
789
785
+ extern double estimate_num_groups_ext(PlannerInfo *root, List *groupExprs,
790
786
+ Path *subpath, RelOptInfo *grouped_rel,
791
787
+ List **pgset, EstimationInfo *estinfo);
792
-
793
- extern void estimate_hash_bucket_stats(PlannerInfo *root ,
794
- Node *hashkey, double nbuckets,
788
+ extern double estimate_num_groups(PlannerInfo *root, List *groupExprs,
789
+ double input_rows, List **pgset ,
790
+ EstimationInfo *estinfo);
0 commit comments