@@ -11,7 +11,7 @@ index bbf220407b..8225105893 100644
11
11
auth_delay \
12
12
auto_explain \
13
13
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
14
- index a0311ce9dc..a4fa160d5a 100644
14
+ index 35c23bd27d..9dee2cee50 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 a0311ce9dc..a4fa160d5a 100644
57
57
if (es->format == EXPLAIN_FORMAT_TEXT)
58
58
appendStringInfoChar(es->str, '\n');
59
59
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
60
- index 29ae32d960..d009b161da 100644
60
+ index 7918bb6f0d..36099866bb 100644
61
61
--- a/src/backend/optimizer/path/costsize.c
62
62
+++ b/src/backend/optimizer/path/costsize.c
63
63
@@ -99,6 +99,11 @@
@@ -80,7 +80,7 @@ index 29ae32d960..d009b161da 100644
80
80
81
81
82
82
/*
83
- @@ -4970 ,6 +4974 ,58 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
83
+ @@ -4976 ,6 +4980 ,58 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
84
84
}
85
85
86
86
@@ -139,7 +139,7 @@ index 29ae32d960..d009b161da 100644
139
139
/*
140
140
* set_baserel_size_estimates
141
141
* Set the size estimates for the given base relation.
142
- @@ -4986 ,19 +5042 ,10 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
142
+ @@ -4992 ,19 +5048 ,10 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
143
143
void
144
144
set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
145
145
{
@@ -160,7 +160,7 @@ index 29ae32d960..d009b161da 100644
160
160
161
161
cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
162
162
163
- @@ -5009 ,13 +5056 ,33 @@ set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
163
+ @@ -5015 ,13 +5062 ,33 @@ set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
164
164
* get_parameterized_baserel_size
165
165
* Make a size estimate for a parameterized scan of a base relation.
166
166
*
@@ -196,7 +196,7 @@ index 29ae32d960..d009b161da 100644
196
196
{
197
197
List *allclauses;
198
198
double nrows;
199
- @@ -5044 ,6 +5111 ,36 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
199
+ @@ -5050 ,6 +5117 ,36 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
200
200
* set_joinrel_size_estimates
201
201
* Set the size estimates for the given join relation.
202
202
*
@@ -233,7 +233,7 @@ index 29ae32d960..d009b161da 100644
233
233
* The rel's targetlist must have been constructed already, and a
234
234
* restriction clause list that matches the given component rels must
235
235
* be provided.
236
- @@ -5063 ,11 +5160 ,11 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
236
+ @@ -5069 ,11 +5166 ,11 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
237
237
* build_joinrel_tlist, and baserestrictcost is not used for join rels.
238
238
*/
239
239
void
@@ -250,7 +250,7 @@ index 29ae32d960..d009b161da 100644
250
250
{
251
251
rel->rows = calc_joinrel_size_estimate(root,
252
252
rel,
253
- @@ -5083 ,6 +5180 ,35 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
253
+ @@ -5089 ,6 +5186 ,35 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
254
254
* get_parameterized_joinrel_size
255
255
* Make a size estimate for a parameterized scan of a join relation.
256
256
*
@@ -286,7 +286,7 @@ index 29ae32d960..d009b161da 100644
286
286
* 'rel' is the joinrel under consideration.
287
287
* 'outer_path', 'inner_path' are (probably also parameterized) Paths that
288
288
* produce the relations being joined.
289
- @@ -5095 ,11 +5221 ,11 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
289
+ @@ -5101 ,11 +5227 ,11 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
290
290
* set_joinrel_size_estimates must have been applied already.
291
291
*/
292
292
double
@@ -303,7 +303,7 @@ index 29ae32d960..d009b161da 100644
303
303
{
304
304
double nrows;
305
305
306
- @@ -5814 ,7 +5940 ,7 @@ set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel)
306
+ @@ -5820 ,7 +5946 ,7 @@ set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel)
307
307
/* Should only be applied to base relations */
308
308
Assert(rel->relid > 0);
309
309
@@ -312,7 +312,7 @@ index 29ae32d960..d009b161da 100644
312
312
313
313
cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
314
314
315
- @@ -6101 ,7 +6227 ,7 @@ page_size(double tuples, int width)
315
+ @@ -6107 ,7 +6233 ,7 @@ page_size(double tuples, int width)
316
316
* Estimate the fraction of the work that each worker will do given the
317
317
* number of workers budgeted for the path.
318
318
*/
@@ -322,7 +322,7 @@ index 29ae32d960..d009b161da 100644
322
322
{
323
323
double parallel_divisor = path->parallel_workers;
324
324
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
325
- index cd68942af0..ab782b47ab 100644
325
+ index 1b11852814..9629876f9f 100644
326
326
--- a/src/backend/optimizer/plan/createplan.c
327
327
+++ b/src/backend/optimizer/plan/createplan.c
328
328
@@ -70,6 +70,7 @@
@@ -344,7 +344,7 @@ index cd68942af0..ab782b47ab 100644
344
344
return plan;
345
345
}
346
346
347
- @@ -5371 ,6 +5376 ,7 @@ copy_generic_path_info(Plan *dest, Path *src)
347
+ @@ -5379 ,6 +5384 ,7 @@ copy_generic_path_info(Plan *dest, Path *src)
348
348
dest->plan_width = src->pathtarget->width;
349
349
dest->parallel_aware = src->parallel_aware;
350
350
dest->parallel_safe = src->parallel_safe;
@@ -353,7 +353,7 @@ index cd68942af0..ab782b47ab 100644
353
353
354
354
/*
355
355
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
356
- index 05f44faf6e..082e47332d 100644
356
+ index db5ff6fdca..f2ace8d1be 100644
357
357
--- a/src/backend/optimizer/plan/planner.c
358
358
+++ b/src/backend/optimizer/plan/planner.c
359
359
@@ -145,7 +145,8 @@ static List *extract_rollup_sets(List *groupingSets);
@@ -366,7 +366,7 @@ index 05f44faf6e..082e47332d 100644
366
366
grouping_sets_data *gd,
367
367
List *target_list);
368
368
static RelOptInfo *create_grouping_paths(PlannerInfo *root,
369
- @@ -3544 ,7 +3545 ,8 @@ standard_qp_callback(PlannerInfo *root, void *extra)
369
+ @@ -3554 ,7 +3555 ,8 @@ standard_qp_callback(PlannerInfo *root, void *extra)
370
370
*/
371
371
static double
372
372
get_number_of_groups(PlannerInfo *root,
@@ -376,7 +376,7 @@ index 05f44faf6e..082e47332d 100644
376
376
grouping_sets_data *gd,
377
377
List *target_list)
378
378
{
379
- @@ -3581 ,7 +3583 ,7 @@ get_number_of_groups(PlannerInfo *root,
379
+ @@ -3591 ,7 +3593 ,7 @@ get_number_of_groups(PlannerInfo *root,
380
380
GroupingSetData *gs = lfirst_node(GroupingSetData, lc3);
381
381
double numGroups = estimate_num_groups(root,
382
382
groupExprs,
@@ -385,7 +385,7 @@ index 05f44faf6e..082e47332d 100644
385
385
&gset,
386
386
NULL);
387
387
388
- @@ -3607 ,7 +3609 ,7 @@ get_number_of_groups(PlannerInfo *root,
388
+ @@ -3617 ,7 +3619 ,7 @@ get_number_of_groups(PlannerInfo *root,
389
389
GroupingSetData *gs = lfirst_node(GroupingSetData, lc2);
390
390
double numGroups = estimate_num_groups(root,
391
391
groupExprs,
@@ -394,7 +394,7 @@ index 05f44faf6e..082e47332d 100644
394
394
&gset,
395
395
NULL);
396
396
397
- @@ -3624 ,8 +3626 ,8 @@ get_number_of_groups(PlannerInfo *root,
397
+ @@ -3634 ,8 +3636 ,8 @@ get_number_of_groups(PlannerInfo *root,
398
398
groupExprs = get_sortgrouplist_exprs(root->processed_groupClause,
399
399
target_list);
400
400
@@ -405,7 +405,7 @@ index 05f44faf6e..082e47332d 100644
405
405
}
406
406
}
407
407
else if (parse->groupingSets)
408
- @@ -4015 ,7 +4017 ,8 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
408
+ @@ -4025 ,7 +4027 ,8 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
409
409
* Estimate number of groups.
410
410
*/
411
411
dNumGroups = get_number_of_groups(root,
@@ -415,7 +415,7 @@ index 05f44faf6e..082e47332d 100644
415
415
gd,
416
416
extra->targetList);
417
417
418
- @@ -7115 ,13 +7118 ,15 @@ create_partial_grouping_paths(PlannerInfo *root,
418
+ @@ -7127 ,13 +7130 ,15 @@ create_partial_grouping_paths(PlannerInfo *root,
419
419
if (cheapest_total_path != NULL)
420
420
dNumPartialGroups =
421
421
get_number_of_groups(root,
@@ -434,73 +434,73 @@ index 05f44faf6e..082e47332d 100644
434
434
extra->targetList);
435
435
436
436
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
437
- index 18b92336be..d56fd933d8 100644
437
+ index ad84cc43e1..8e1e436caf 100644
438
438
--- a/src/backend/optimizer/util/relnode.c
439
439
+++ b/src/backend/optimizer/util/relnode.c
440
- @@ -265 ,6 +265 ,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
440
+ @@ -272 ,6 +272 ,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
441
441
rel->all_partrels = NULL;
442
442
rel->partexprs = NULL;
443
443
rel->nullable_partexprs = NULL;
444
444
+ rel->ext_nodes = NULL;
445
445
446
446
/*
447
447
* Pass assorted information down the inheritance hierarchy.
448
- @@ -388 ,7 +389 ,6 @@ find_base_rel(PlannerInfo *root, int relid)
448
+ @@ -402 ,7 +403 ,6 @@ find_base_rel(PlannerInfo *root, int relid)
449
449
if (rel)
450
450
return rel;
451
451
}
452
452
-
453
453
elog(ERROR, "no relation entry for relid %d", relid);
454
454
455
455
return NULL; /* keep compiler quiet */
456
- @@ -679 ,6 +679 ,7 @@ build_join_rel(PlannerInfo *root,
456
+ @@ -732 ,6 +732 ,7 @@ build_join_rel(PlannerInfo *root,
457
457
joinrel->all_partrels = NULL;
458
458
joinrel->partexprs = NULL;
459
459
joinrel->nullable_partexprs = NULL;
460
460
+ joinrel->ext_nodes = NULL;
461
461
462
462
/* Compute information relevant to the foreign relations. */
463
463
set_foreign_rel_properties(joinrel, outer_rel, inner_rel);
464
- @@ -858 ,6 +859 ,7 @@ build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel,
464
+ @@ -917 ,6 +918 ,7 @@ build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel,
465
465
joinrel->all_partrels = NULL;
466
466
joinrel->partexprs = NULL;
467
467
joinrel->nullable_partexprs = NULL;
468
468
+ joinrel->ext_nodes = NULL;
469
469
470
470
/* Compute information relevant to foreign relations. */
471
471
set_foreign_rel_properties(joinrel, outer_rel, inner_rel);
472
- @@ -1298 ,6 +1300 ,7 @@ find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
472
+ @@ -1467 ,6 +1469 ,7 @@ find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
473
473
}
474
474
475
475
476
476
+ set_parampathinfo_postinit_hook_type parampathinfo_postinit_hook = NULL;
477
477
/*
478
478
* get_baserel_parampathinfo
479
479
* Get the ParamPathInfo for a parameterized path for a base relation,
480
- @@ -1366,6 +1369,10 @@ get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel,
481
- ppi->ppi_req_outer = required_outer;
480
+ @@ -1546,6 +1549,10 @@ get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel,
482
481
ppi->ppi_rows = rows;
483
482
ppi->ppi_clauses = pclauses;
483
+ ppi->ppi_serials = pserials;
484
484
+
485
485
+ if (parampathinfo_postinit_hook)
486
486
+ (*parampathinfo_postinit_hook)(ppi);
487
487
+
488
488
baserel->ppilist = lappend(baserel->ppilist, ppi);
489
489
490
490
return ppi;
491
- @@ -1591,6 +1598,10 @@ get_joinrel_parampathinfo(PlannerInfo *root, RelOptInfo *joinrel,
492
- ppi->ppi_req_outer = required_outer;
493
- ppi->ppi_rows = rows;
491
+ @@ -1799,6 +1806,10 @@ get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
492
+ ppi->ppi_rows = 0;
494
493
ppi->ppi_clauses = NIL;
494
+ ppi->ppi_serials = NULL;
495
495
+
496
496
+ if (parampathinfo_postinit_hook)
497
- + (*parampathinfo_postinit_hook)(ppi);
497
+ + (*parampathinfo_postinit_hook)(ppi);
498
498
+
499
- joinrel ->ppilist = lappend(joinrel ->ppilist, ppi);
499
+ appendrel ->ppilist = lappend(appendrel ->ppilist, ppi);
500
500
501
501
return ppi;
502
502
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
503
- index 4e4888dde4..5b22f65012 100644
503
+ index fe37e65af0..0e5299078b 100644
504
504
--- a/src/backend/utils/adt/selfuncs.c
505
505
+++ b/src/backend/utils/adt/selfuncs.c
506
506
@@ -145,6 +145,7 @@
@@ -556,10 +556,10 @@ index 7c1071ddd1..72e954dd3e 100644
556
556
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
557
557
ParamListInfo params, DestReceiver *dest);
558
558
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
559
- index 2d1d8f4bcd..48d60559f5 100644
559
+ index 62d9460258..a946d05e60 100644
560
560
--- a/src/include/nodes/pathnodes.h
561
561
+++ b/src/include/nodes/pathnodes.h
562
- @@ -1025 ,6 +1025 ,16 @@ typedef struct RelOptInfo
562
+ @@ -1038 ,6 +1038 ,16 @@ typedef struct RelOptInfo
563
563
List **partexprs pg_node_attr(read_write_ignore);
564
564
/* Nullable partition key expressions */
565
565
List **nullable_partexprs pg_node_attr(read_write_ignore);
@@ -576,19 +576,19 @@ index 2d1d8f4bcd..48d60559f5 100644
576
576
} RelOptInfo;
577
577
578
578
/*
579
- @@ -1495,6 +1505,10 @@ typedef struct ParamPathInfo
580
- Relids ppi_req_outer; /* rels supplying parameters used by path */
579
+ @@ -1558,6 +1568,10 @@ typedef struct ParamPathInfo
581
580
Cardinality ppi_rows; /* estimated number of result tuples */
582
581
List *ppi_clauses; /* join clauses available from outer rels */
582
+ Bitmapset *ppi_serials; /* set of rinfo_serial for enforced quals */
583
583
+
584
584
+ /* AQO DEBUG purposes */
585
- + double predicted_ppi_rows;
586
- + double fss_ppi_hash;
585
+ + double predicted_ppi_rows;
586
+ + double fss_ppi_hash;
587
587
} ParamPathInfo;
588
588
589
589
590
590
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
591
- index c1234fcf36..8c77da84aa 100644
591
+ index 4781a9c632..03f8216664 100644
592
592
--- a/src/include/nodes/plannodes.h
593
593
+++ b/src/include/nodes/plannodes.h
594
594
@@ -173,6 +173,9 @@ typedef struct Plan
@@ -686,7 +686,7 @@ index 6cf49705d3..6a96baf130 100644
686
686
687
687
#endif /* COST_H */
688
688
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
689
- index 02305ef902..5226ddc8e8 100644
689
+ index 69be701b16..497abb69c7 100644
690
690
--- a/src/include/optimizer/pathnode.h
691
691
+++ b/src/include/optimizer/pathnode.h
692
692
@@ -18,6 +18,10 @@
@@ -701,7 +701,7 @@ index 02305ef902..5226ddc8e8 100644
701
701
* prototypes for pathnode.c
702
702
*/
703
703
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
704
- index 95ecefdade..a732d24fb6 100644
704
+ index 5fc900737d..5e5ce876c4 100644
705
705
--- a/src/include/optimizer/planmain.h
706
706
+++ b/src/include/optimizer/planmain.h
707
707
@@ -24,6 +24,12 @@ extern PGDLLIMPORT double cursor_tuple_fraction;
0 commit comments