1
1
diff --git a/contrib/Makefile b/contrib/Makefile
2
- index 1846d415b6..95519ac11d 100644
2
+ index 1846d415b6f..95519ac11de 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 1846d415b6..95519ac11d 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 bc05c96b4c..b6a3abe0d2 100644
14
+ index bc05c96b4ce..b6a3abe0d2b 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 bc05c96b4c..b6a3abe0d2 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 692b6c1559..580d04d784 100644
60
+ index 692b6c1559f..580d04d7844 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 692b6c1559..580d04d784 100644
69
69
70
70
/*
71
71
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
72
- index 21ececf0c2..a0e7a7ebca 100644
72
+ index 21ececf0c2f..ebfd3ba86de 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 7976b369ba..604314e0b3 100644
84
+ index 7976b369ba8..2e47bd8d950 100644
85
85
--- a/src/backend/nodes/readfuncs.c
86
86
+++ b/src/backend/nodes/readfuncs.c
87
- @@ -1580,6 +1580,11 @@ ReadCommonPlan(Plan *local_node)
87
+ @@ -1580,6 +1580,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 4edc859cb5..988f2e6ab7 100644
96
+ index 4edc859cb57..988f2e6ab75 100644
101
97
--- a/src/backend/optimizer/path/costsize.c
102
98
+++ b/src/backend/optimizer/path/costsize.c
103
99
@@ -98,6 +98,12 @@
@@ -363,7 +359,7 @@ index 4edc859cb5..988f2e6ab7 100644
363
359
{
364
360
double parallel_divisor = path->parallel_workers;
365
361
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
366
- index 917713c163..5b7bf1cec6 100644
362
+ index 917713c1633..5b7bf1cec69 100644
367
363
--- a/src/backend/optimizer/plan/createplan.c
368
364
+++ b/src/backend/optimizer/plan/createplan.c
369
365
@@ -70,6 +70,7 @@
@@ -394,7 +390,7 @@ index 917713c163..5b7bf1cec6 100644
394
390
395
391
/*
396
392
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
397
- index 27c665ac12..f599fba755 100644
393
+ index 821693c60ee..fa627f472f9 100644
398
394
--- a/src/backend/optimizer/plan/planner.c
399
395
+++ b/src/backend/optimizer/plan/planner.c
400
396
@@ -145,7 +145,8 @@ static List *extract_rollup_sets(List *groupingSets);
@@ -407,7 +403,7 @@ index 27c665ac12..f599fba755 100644
407
403
grouping_sets_data *gd,
408
404
List *target_list);
409
405
static RelOptInfo *create_grouping_paths(PlannerInfo *root,
410
- @@ -3686 ,7 +3687 ,8 @@ standard_qp_callback(PlannerInfo *root, void *extra)
406
+ @@ -3682 ,7 +3683 ,8 @@ standard_qp_callback(PlannerInfo *root, void *extra)
411
407
*/
412
408
static double
413
409
get_number_of_groups(PlannerInfo *root,
@@ -417,7 +413,7 @@ index 27c665ac12..f599fba755 100644
417
413
grouping_sets_data *gd,
418
414
List *target_list)
419
415
{
420
- @@ -3723 ,7 +3725 ,7 @@ get_number_of_groups(PlannerInfo *root,
416
+ @@ -3719 ,7 +3721 ,7 @@ get_number_of_groups(PlannerInfo *root,
421
417
GroupingSetData *gs = lfirst_node(GroupingSetData, lc2);
422
418
double numGroups = estimate_num_groups(root,
423
419
groupExprs,
@@ -426,7 +422,7 @@ index 27c665ac12..f599fba755 100644
426
422
&gset);
427
423
428
424
gs->numGroups = numGroups;
429
- @@ -3748 ,7 +3750 ,7 @@ get_number_of_groups(PlannerInfo *root,
425
+ @@ -3744 ,7 +3746 ,7 @@ get_number_of_groups(PlannerInfo *root,
430
426
GroupingSetData *gs = lfirst_node(GroupingSetData, lc2);
431
427
double numGroups = estimate_num_groups(root,
432
428
groupExprs,
@@ -435,7 +431,7 @@ index 27c665ac12..f599fba755 100644
435
431
&gset);
436
432
437
433
gs->numGroups = numGroups;
438
- @@ -3764 ,8 +3766 ,8 @@ get_number_of_groups(PlannerInfo *root,
434
+ @@ -3760 ,8 +3762 ,8 @@ get_number_of_groups(PlannerInfo *root,
439
435
groupExprs = get_sortgrouplist_exprs(parse->groupClause,
440
436
target_list);
441
437
@@ -446,7 +442,7 @@ index 27c665ac12..f599fba755 100644
446
442
}
447
443
}
448
444
else if (parse->groupingSets)
449
- @@ -4151 ,7 +4153 ,8 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
445
+ @@ -4147 ,7 +4149 ,8 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
450
446
* Estimate number of groups.
451
447
*/
452
448
dNumGroups = get_number_of_groups(root,
@@ -456,7 +452,7 @@ index 27c665ac12..f599fba755 100644
456
452
gd,
457
453
extra->targetList);
458
454
459
- @@ -6935 ,13 +6938 ,15 @@ create_partial_grouping_paths(PlannerInfo *root,
455
+ @@ -6931 ,13 +6934 ,15 @@ create_partial_grouping_paths(PlannerInfo *root,
460
456
if (cheapest_total_path != NULL)
461
457
dNumPartialGroups =
462
458
get_number_of_groups(root,
@@ -475,7 +471,7 @@ index 27c665ac12..f599fba755 100644
475
471
extra->targetList);
476
472
477
473
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
478
- index a203e6f1ff..d31bf5bae6 100644
474
+ index a203e6f1ff5..d31bf5bae63 100644
479
475
--- a/src/backend/optimizer/util/relnode.c
480
476
+++ b/src/backend/optimizer/util/relnode.c
481
477
@@ -258,6 +258,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
@@ -541,7 +537,7 @@ index a203e6f1ff..d31bf5bae6 100644
541
537
542
538
return ppi;
543
539
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
544
- index 37458da096..248a1875a1 100644
540
+ index 37458da096d..248a1875a18 100644
545
541
--- a/src/backend/utils/adt/selfuncs.c
546
542
+++ b/src/backend/utils/adt/selfuncs.c
547
543
@@ -147,6 +147,7 @@
@@ -573,7 +569,7 @@ index 37458da096..248a1875a1 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 ba661d32a6..09d0abe58b 100644
572
+ index ba661d32a63..09d0abe58be 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 ba661d32a6..09d0abe58b 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 5ebf070979..5b2acd7de2 100644
595
+ index d2b4271de9d..559b9db7121 100644
600
596
--- a/src/include/nodes/pathnodes.h
601
597
+++ b/src/include/nodes/pathnodes.h
602
598
@@ -739,6 +739,10 @@ typedef struct RelOptInfo
@@ -635,7 +631,7 @@ index 5ebf070979..5b2acd7de2 100644
635
631
636
632
637
633
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
638
- index 90f02ce6fd..88c332164d 100644
634
+ index 90f02ce6fdd..88c332164dd 100644
639
635
--- a/src/include/nodes/plannodes.h
640
636
+++ b/src/include/nodes/plannodes.h
641
637
@@ -159,6 +159,9 @@ typedef struct Plan
@@ -649,7 +645,7 @@ index 90f02ce6fd..88c332164d 100644
649
645
650
646
/* ----------------
651
647
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
652
- index 6141654e47..e6b28cbb05 100644
648
+ index 6141654e478..e6b28cbb05f 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 6141654e47..e6b28cbb05 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 3bd7072ae8..21bbaba11c 100644
732
+ index 3bd7072ae8c..21bbaba11c8 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 3bd7072ae8..21bbaba11c 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 8ce60e202e..75415102c2 100644
747
+ index 8ce60e202e5..75415102c2e 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 8ce60e202e..75415102c2 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 7ac4a06391..def3522881 100644
764
+ index 7ac4a063915..74fe91b89f1 100644
769
765
--- a/src/include/utils/selfuncs.h
770
766
+++ b/src/include/utils/selfuncs.h
771
767
@@ -127,6 +127,12 @@ typedef bool (*get_index_stats_hook_type) (PlannerInfo *root,
@@ -781,13 +777,13 @@ index 7ac4a06391..def3522881 100644
781
777
782
778
/* Functions in selfuncs.c */
783
779
784
- @@ -195,6 +201,9 @@ extern void mergejoinscansel(PlannerInfo *root, Node *clause,
780
+ @@ -193,6 +199,9 @@ extern void mergejoinscansel(PlannerInfo *root, Node *clause,
781
+ Selectivity *leftstart, Selectivity *leftend,
782
+ Selectivity *rightstart, Selectivity *rightend);
785
783
786
- extern double estimate_num_groups(PlannerInfo *root, List *groupExprs,
787
- double input_rows, List **pgset);
788
784
+ extern double estimate_num_groups_ext(PlannerInfo *root, List *groupExprs,
789
785
+ Path *subpath, RelOptInfo *grouped_rel,
790
786
+ List **pgset);
787
+ extern double estimate_num_groups(PlannerInfo *root, List *groupExprs,
788
+ double input_rows, List **pgset);
791
789
792
- extern void estimate_hash_bucket_stats(PlannerInfo *root,
793
- Node *hashkey, double nbuckets,
0 commit comments