1
+ diff --git a/contrib/Makefile b/contrib/Makefile
2
+ index bbf220407b..8225105893 100644
3
+ --- a/contrib/Makefile
4
+ +++ b/contrib/Makefile
5
+ @@ -6,6 +6,7 @@ include $(top_builddir)/src/Makefile.global
6
+
7
+ SUBDIRS = \
8
+ adminpack \
9
+ + aqo \
10
+ amcheck \
11
+ auth_delay \
12
+ auto_explain \
1
13
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
2
- index d2a2479822..3109d8751e 100644
14
+ index 5d1f7089da..268b50071d 100644
3
15
--- a/src/backend/commands/explain.c
4
16
+++ b/src/backend/commands/explain.c
5
17
@@ -24,6 +24,7 @@
@@ -45,7 +57,7 @@ index d2a2479822..3109d8751e 100644
45
57
if (es->format == EXPLAIN_FORMAT_TEXT)
46
58
appendStringInfoChar(es->str, '\n');
47
59
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
48
- index 836f427ea8..2b6184f349 100644
60
+ index 51d630fa89..c46aca258b 100644
49
61
--- a/src/backend/nodes/copyfuncs.c
50
62
+++ b/src/backend/nodes/copyfuncs.c
51
63
@@ -136,6 +136,7 @@ CopyPlanFields(const Plan *from, Plan *newnode)
@@ -57,7 +69,7 @@ index 836f427ea8..2b6184f349 100644
57
69
58
70
/*
59
71
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
60
- index b1f2de8b28..9cc22c3c10 100644
72
+ index ce12915592..30e7f35a6c 100644
61
73
--- a/src/backend/nodes/outfuncs.c
62
74
+++ b/src/backend/nodes/outfuncs.c
63
75
@@ -356,6 +356,7 @@ _outPlanInfo(StringInfo str, const Plan *node)
@@ -69,10 +81,10 @@ index b1f2de8b28..9cc22c3c10 100644
69
81
70
82
/*
71
83
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
72
- index ddf76ac778..c28acb46d8 100644
84
+ index 6a05b69415..f61432a6e7 100644
73
85
--- a/src/backend/nodes/readfuncs.c
74
86
+++ b/src/backend/nodes/readfuncs.c
75
- @@ -1855 ,6 +1855 ,11 @@ ReadCommonPlan(Plan *local_node)
87
+ @@ -1857 ,6 +1857 ,11 @@ ReadCommonPlan(Plan *local_node)
76
88
READ_NODE_FIELD(initPlan);
77
89
READ_BITMAPSET_FIELD(extParam);
78
90
READ_BITMAPSET_FIELD(allParam);
@@ -85,10 +97,10 @@ index ddf76ac778..c28acb46d8 100644
85
97
86
98
/*
87
99
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
88
- index b787c6f81a..18deca6d72 100644
100
+ index fcc26b01a4..b3f1535c4b 100644
89
101
--- a/src/backend/optimizer/path/costsize.c
90
102
+++ b/src/backend/optimizer/path/costsize.c
91
- @@ -98 ,6 +98 ,11 @@
103
+ @@ -99 ,6 +99 ,11 @@
92
104
#include "utils/spccache.h"
93
105
#include "utils/tuplesort.h"
94
106
@@ -100,15 +112,15 @@ index b787c6f81a..18deca6d72 100644
100
112
101
113
#define LOG2(x) (log(x) / 0.693147180559945)
102
114
103
- @@ -189 ,7 +194 ,6 @@ static Cost append_nonpartial_cost(List *subpaths, int numpaths,
115
+ @@ -190 ,7 +195 ,6 @@ static Cost append_nonpartial_cost(List *subpaths, int numpaths,
104
116
static void set_rel_width(PlannerInfo *root, RelOptInfo *rel);
105
117
static double relation_byte_size(double tuples, int width);
106
118
static double page_size(double tuples, int width);
107
119
- static double get_parallel_divisor(Path *path);
108
120
109
121
110
122
/*
111
- @@ -5226 ,6 +5230 ,58 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
123
+ @@ -5272 ,6 +5276 ,58 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
112
124
}
113
125
114
126
@@ -167,7 +179,7 @@ index b787c6f81a..18deca6d72 100644
167
179
/*
168
180
* set_baserel_size_estimates
169
181
* Set the size estimates for the given base relation.
170
- @@ -5242 ,19 +5298 ,10 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
182
+ @@ -5288 ,19 +5344 ,10 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
171
183
void
172
184
set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
173
185
{
@@ -188,7 +200,7 @@ index b787c6f81a..18deca6d72 100644
188
200
189
201
cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
190
202
191
- @@ -5265 ,13 +5312 ,33 @@ set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
203
+ @@ -5311 ,13 +5358 ,33 @@ set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
192
204
* get_parameterized_baserel_size
193
205
* Make a size estimate for a parameterized scan of a base relation.
194
206
*
@@ -224,7 +236,7 @@ index b787c6f81a..18deca6d72 100644
224
236
{
225
237
List *allclauses;
226
238
double nrows;
227
- @@ -5300 ,6 +5367 ,36 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
239
+ @@ -5346 ,6 +5413 ,36 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
228
240
* set_joinrel_size_estimates
229
241
* Set the size estimates for the given join relation.
230
242
*
@@ -261,7 +273,7 @@ index b787c6f81a..18deca6d72 100644
261
273
* The rel's targetlist must have been constructed already, and a
262
274
* restriction clause list that matches the given component rels must
263
275
* be provided.
264
- @@ -5319 ,11 +5416 ,11 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
276
+ @@ -5365 ,11 +5462 ,11 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
265
277
* build_joinrel_tlist, and baserestrictcost is not used for join rels.
266
278
*/
267
279
void
@@ -278,7 +290,7 @@ index b787c6f81a..18deca6d72 100644
278
290
{
279
291
rel->rows = calc_joinrel_size_estimate(root,
280
292
rel,
281
- @@ -5339 ,6 +5436 ,35 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
293
+ @@ -5385 ,6 +5482 ,35 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
282
294
* get_parameterized_joinrel_size
283
295
* Make a size estimate for a parameterized scan of a join relation.
284
296
*
@@ -314,7 +326,7 @@ index b787c6f81a..18deca6d72 100644
314
326
* 'rel' is the joinrel under consideration.
315
327
* 'outer_path', 'inner_path' are (probably also parameterized) Paths that
316
328
* produce the relations being joined.
317
- @@ -5351 ,11 +5477 ,11 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
329
+ @@ -5397 ,11 +5523 ,11 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
318
330
* set_joinrel_size_estimates must have been applied already.
319
331
*/
320
332
double
@@ -331,7 +343,7 @@ index b787c6f81a..18deca6d72 100644
331
343
{
332
344
double nrows;
333
345
334
- @@ -6072 ,7 +6198 ,7 @@ set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel)
346
+ @@ -6118 ,7 +6244 ,7 @@ set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel)
335
347
/* Should only be applied to base relations */
336
348
Assert(rel->relid > 0);
337
349
@@ -340,7 +352,7 @@ index b787c6f81a..18deca6d72 100644
340
352
341
353
cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
342
354
343
- @@ -6359 ,7 +6485 ,7 @@ page_size(double tuples, int width)
355
+ @@ -6405 ,7 +6531 ,7 @@ page_size(double tuples, int width)
344
356
* Estimate the fraction of the work that each worker will do given the
345
357
* number of workers budgeted for the path.
346
358
*/
@@ -350,18 +362,18 @@ index b787c6f81a..18deca6d72 100644
350
362
{
351
363
double parallel_divisor = path->parallel_workers;
352
364
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
353
- index db11936efe..8b5cd8426e 100644
365
+ index 76606faa3e..3981bea57a 100644
354
366
--- a/src/backend/optimizer/plan/createplan.c
355
367
+++ b/src/backend/optimizer/plan/createplan.c
356
- @@ -71 ,6 +71 ,7 @@
368
+ @@ -70 ,6 +70 ,7 @@
357
369
#define CP_LABEL_TLIST 0x0004 /* tlist must contain sortgrouprefs */
358
370
#define CP_IGNORE_TLIST 0x0008 /* caller will replace tlist */
359
371
360
372
+ create_plan_hook_type create_plan_hook = NULL;
361
373
362
374
static Plan *create_plan_recurse(PlannerInfo *root, Path *best_path,
363
375
int flags);
364
- @@ -547 ,6 +548 ,10 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
376
+ @@ -546 ,6 +547 ,10 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
365
377
break;
366
378
}
367
379
@@ -372,7 +384,7 @@ index db11936efe..8b5cd8426e 100644
372
384
return plan;
373
385
}
374
386
375
- @@ -5373 ,6 +5378 ,7 @@ copy_generic_path_info(Plan *dest, Path *src)
387
+ @@ -5372 ,6 +5377 ,7 @@ copy_generic_path_info(Plan *dest, Path *src)
376
388
dest->plan_width = src->pathtarget->width;
377
389
dest->parallel_aware = src->parallel_aware;
378
390
dest->parallel_safe = src->parallel_safe;
@@ -381,7 +393,7 @@ index db11936efe..8b5cd8426e 100644
381
393
382
394
/*
383
395
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
384
- index 9a4accb4d9..8554e6723e 100644
396
+ index a0f2390334..51f5a7d626 100644
385
397
--- a/src/backend/optimizer/plan/planner.c
386
398
+++ b/src/backend/optimizer/plan/planner.c
387
399
@@ -143,7 +143,8 @@ static List *extract_rollup_sets(List *groupingSets);
@@ -443,7 +455,7 @@ index 9a4accb4d9..8554e6723e 100644
443
455
gd,
444
456
extra->targetList);
445
457
446
- @@ -6701 ,13 +6704 ,15 @@ create_partial_grouping_paths(PlannerInfo *root,
458
+ @@ -6708 ,13 +6711 ,15 @@ create_partial_grouping_paths(PlannerInfo *root,
447
459
if (cheapest_total_path != NULL)
448
460
dNumPartialGroups =
449
461
get_number_of_groups(root,
@@ -528,7 +540,7 @@ index 520409f4ba..fd0524d72b 100644
528
540
529
541
return ppi;
530
542
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
531
- index 71cbc1c3d8..f78d004d1d 100644
543
+ index fa1f589fad..f758776ac5 100644
532
544
--- a/src/backend/utils/adt/selfuncs.c
533
545
+++ b/src/backend/utils/adt/selfuncs.c
534
546
@@ -143,6 +143,7 @@
@@ -584,7 +596,7 @@ index 666977fb1f..33b109afbb 100644
584
596
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
585
597
ParamListInfo params, DestReceiver *dest);
586
598
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
587
- index 244d1e1197..315b9fe776 100644
599
+ index a6e5db4eec..5b7bf8b8b7 100644
588
600
--- a/src/include/nodes/pathnodes.h
589
601
+++ b/src/include/nodes/pathnodes.h
590
602
@@ -757,6 +757,10 @@ typedef struct RelOptInfo
@@ -615,7 +627,7 @@ index 244d1e1197..315b9fe776 100644
615
627
* Is given relation partitioned?
616
628
@@ -1153,6 +1163,10 @@ typedef struct ParamPathInfo
617
629
Relids ppi_req_outer; /* rels supplying parameters used by path */
618
- Cardinality ppi_rows; /* estimated number of result tuples */
630
+ Cardinality ppi_rows; /* estimated number of result tuples */
619
631
List *ppi_clauses; /* join clauses available from outer rels */
620
632
+
621
633
+ /* AQO DEBUG purposes */
@@ -625,7 +637,7 @@ index 244d1e1197..315b9fe776 100644
625
637
626
638
627
639
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
628
- index e43e360d9b..c4234e2e5b 100644
640
+ index 0ea9a22dfb..64db54ff30 100644
629
641
--- a/src/include/nodes/plannodes.h
630
642
+++ b/src/include/nodes/plannodes.h
631
643
@@ -159,6 +159,12 @@ typedef struct Plan
@@ -758,7 +770,7 @@ index c4f61c1a09..ade32a6f44 100644
758
770
* prototypes for plan/planmain.c
759
771
*/
760
772
diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h
761
- index c313a08d54..e3d0d493d8 100644
773
+ index d485b9bfcd..175660ecb9 100644
762
774
--- a/src/include/utils/selfuncs.h
763
775
+++ b/src/include/utils/selfuncs.h
764
776
@@ -144,6 +144,13 @@ typedef bool (*get_index_stats_hook_type) (PlannerInfo *root,
0 commit comments