@@ -91,45 +91,65 @@ typedef struct PlannerGlobal
91
91
{
92
92
NodeTag type ;
93
93
94
- ParamListInfo boundParams ; /* Param values provided to planner() */
94
+ /* Param values provided to planner() */
95
+ ParamListInfo boundParams ;
95
96
96
- List * subplans ; /* Plans for SubPlan nodes */
97
+ /* Plans for SubPlan nodes */
98
+ List * subplans ;
97
99
98
- List * subroots ; /* PlannerInfos for SubPlan nodes */
100
+ /* PlannerInfos for SubPlan nodes */
101
+ List * subroots ;
99
102
100
- Bitmapset * rewindPlanIDs ; /* indices of subplans that require REWIND */
103
+ /* indices of subplans that require REWIND */
104
+ Bitmapset * rewindPlanIDs ;
101
105
102
- List * finalrtable ; /* "flat" rangetable for executor */
106
+ /* "flat" rangetable for executor */
107
+ List * finalrtable ;
103
108
104
- List * finalrowmarks ; /* "flat" list of PlanRowMarks */
109
+ /* "flat" list of PlanRowMarks */
110
+ List * finalrowmarks ;
105
111
106
- List * resultRelations ; /* "flat" list of integer RT indexes */
112
+ /* "flat" list of integer RT indexes */
113
+ List * resultRelations ;
107
114
108
- List * appendRelations ; /* "flat" list of AppendRelInfos */
115
+ /* "flat" list of AppendRelInfos */
116
+ List * appendRelations ;
109
117
110
- List * relationOids ; /* OIDs of relations the plan depends on */
118
+ /* OIDs of relations the plan depends on */
119
+ List * relationOids ;
111
120
112
- List * invalItems ; /* other dependencies, as PlanInvalItems */
121
+ /* other dependencies, as PlanInvalItems */
122
+ List * invalItems ;
113
123
114
- List * paramExecTypes ; /* type OIDs for PARAM_EXEC Params */
124
+ /* type OIDs for PARAM_EXEC Params */
125
+ List * paramExecTypes ;
115
126
116
- Index lastPHId ; /* highest PlaceHolderVar ID assigned */
127
+ /* highest PlaceHolderVar ID assigned */
128
+ Index lastPHId ;
117
129
118
- Index lastRowMarkId ; /* highest PlanRowMark ID assigned */
130
+ /* highest PlanRowMark ID assigned */
131
+ Index lastRowMarkId ;
119
132
120
- int lastPlanNodeId ; /* highest plan node ID assigned */
133
+ /* highest plan node ID assigned */
134
+ int lastPlanNodeId ;
121
135
122
- bool transientPlan ; /* redo plan when TransactionXmin changes? */
136
+ /* redo plan when TransactionXmin changes? */
137
+ bool transientPlan ;
123
138
124
- bool dependsOnRole ; /* is plan specific to current role? */
139
+ /* is plan specific to current role? */
140
+ bool dependsOnRole ;
125
141
126
- bool parallelModeOK ; /* parallel mode potentially OK? */
142
+ /* parallel mode potentially OK? */
143
+ bool parallelModeOK ;
127
144
128
- bool parallelModeNeeded ; /* parallel mode actually required? */
145
+ /* parallel mode actually required? */
146
+ bool parallelModeNeeded ;
129
147
130
- char maxParallelHazard ; /* worst PROPARALLEL hazard level */
148
+ /* worst PROPARALLEL hazard level */
149
+ char maxParallelHazard ;
131
150
132
- PartitionDirectory partition_directory ; /* partition descriptors */
151
+ /* partition descriptors */
152
+ PartitionDirectory partition_directory ;
133
153
} PlannerGlobal ;
134
154
135
155
/* macro for fetching the Plan associated with a SubPlan node */
@@ -159,21 +179,26 @@ struct PlannerInfo
159
179
{
160
180
NodeTag type ;
161
181
162
- Query * parse ; /* the Query being planned */
182
+ /* the Query being planned */
183
+ Query * parse ;
163
184
164
- PlannerGlobal * glob ; /* global info for current planner run */
185
+ /* global info for current planner run */
186
+ PlannerGlobal * glob ;
165
187
166
- Index query_level ; /* 1 at the outermost Query */
188
+ /* 1 at the outermost Query */
189
+ Index query_level ;
167
190
168
- PlannerInfo * parent_root ; /* NULL at outermost Query */
191
+ /* NULL at outermost Query */
192
+ PlannerInfo * parent_root ;
169
193
170
194
/*
171
195
* plan_params contains the expressions that this query level needs to
172
196
* make available to a lower query level that is currently being planned.
173
197
* outer_params contains the paramIds of PARAM_EXEC Params that outer
174
198
* query levels will make available to this query level.
175
199
*/
176
- List * plan_params ; /* list of PlannerParamItems, see below */
200
+ /* list of PlannerParamItems, see below */
201
+ List * plan_params ;
177
202
Bitmapset * outer_params ;
178
203
179
204
/*
@@ -183,15 +208,16 @@ struct PlannerInfo
183
208
* does not correspond to a base relation, such as a join RTE or an
184
209
* unreferenced view RTE; or if the RelOptInfo hasn't been made yet.
185
210
*/
186
- struct RelOptInfo * * simple_rel_array ; /* All 1-rel RelOptInfos */
187
- int simple_rel_array_size ; /* allocated size of array */
211
+ struct RelOptInfo * * simple_rel_array ;
212
+ /* allocated size of array */
213
+ int simple_rel_array_size ;
188
214
189
215
/*
190
216
* simple_rte_array is the same length as simple_rel_array and holds
191
217
* pointers to the associated rangetable entries. Using this is a shade
192
218
* faster than using rt_fetch(), mostly due to fewer indirections.
193
219
*/
194
- RangeTblEntry * * simple_rte_array ; /* rangetable as an array */
220
+ RangeTblEntry * * simple_rte_array ;
195
221
196
222
/*
197
223
* append_rel_array is the same length as the above arrays, and holds
@@ -236,35 +262,51 @@ struct PlannerInfo
236
262
* automatically added to the join_rel_level[join_cur_level] list.
237
263
* join_rel_level is NULL if not in use.
238
264
*/
239
- List * * join_rel_level ; /* lists of join-relation RelOptInfos */
240
- int join_cur_level ; /* index of list being extended */
265
+ /* lists of join-relation RelOptInfos */
266
+ List * * join_rel_level ;
267
+ /* index of list being extended */
268
+ int join_cur_level ;
241
269
242
- List * init_plans ; /* init SubPlans for query */
270
+ /* init SubPlans for query */
271
+ List * init_plans ;
243
272
244
- List * cte_plan_ids ; /* per-CTE-item list of subplan IDs (or -1 if
245
- * no subplan was made for that CTE) */
273
+ /*
274
+ * per-CTE-item list of subplan IDs (or -1 if no subplan was made for that
275
+ * CTE)
276
+ */
277
+ List * cte_plan_ids ;
246
278
247
- List * multiexpr_params ; /* List of Lists of Params for MULTIEXPR
248
- * subquery outputs */
279
+ /* List of Lists of Params for MULTIEXPR subquery outputs */
280
+ List * multiexpr_params ;
249
281
250
- List * eq_classes ; /* list of active EquivalenceClasses */
282
+ /* list of active EquivalenceClasses */
283
+ List * eq_classes ;
251
284
252
- bool ec_merging_done ; /* set true once ECs are canonical */
285
+ /* set true once ECs are canonical */
286
+ bool ec_merging_done ;
253
287
254
- List * canon_pathkeys ; /* list of "canonical" PathKeys */
288
+ /* list of "canonical" PathKeys */
289
+ List * canon_pathkeys ;
255
290
256
- List * left_join_clauses ; /* list of RestrictInfos for mergejoinable
257
- * outer join clauses w/nonnullable var on
258
- * left */
291
+ /*
292
+ * list of RestrictInfos for mergejoinable outer join clauses
293
+ * w/nonnullable var on left
294
+ */
295
+ List * left_join_clauses ;
259
296
260
- List * right_join_clauses ; /* list of RestrictInfos for mergejoinable
261
- * outer join clauses w/nonnullable var on
262
- * right */
297
+ /*
298
+ * list of RestrictInfos for mergejoinable outer join clauses
299
+ * w/nonnullable var on right
300
+ */
301
+ List * right_join_clauses ;
263
302
264
- List * full_join_clauses ; /* list of RestrictInfos for mergejoinable
265
- * full join clauses */
303
+ /*
304
+ * list of RestrictInfos for mergejoinable full join clauses
305
+ */
306
+ List * full_join_clauses ;
266
307
267
- List * join_info_list ; /* list of SpecialJoinInfos */
308
+ /* list of SpecialJoinInfos */
309
+ List * join_info_list ;
268
310
269
311
/*
270
312
* all_result_relids is empty for SELECT, otherwise it contains at least
@@ -274,38 +316,55 @@ struct PlannerInfo
274
316
* leaf_result_relids is similar except that only actual result tables,
275
317
* not partitioned tables, are included in it.
276
318
*/
277
- Relids all_result_relids ; /* set of all result relids */
278
- Relids leaf_result_relids ; /* set of all leaf relids */
319
+ /* set of all result relids */
320
+ Relids all_result_relids ;
321
+ /* set of all leaf relids */
322
+ Relids leaf_result_relids ;
279
323
280
324
/*
325
+ * list of AppendRelInfos
326
+ *
281
327
* Note: for AppendRelInfos describing partitions of a partitioned table,
282
328
* we guarantee that partitions that come earlier in the partitioned
283
329
* table's PartitionDesc will appear earlier in append_rel_list.
284
330
*/
285
- List * append_rel_list ; /* list of AppendRelInfos */
331
+ List * append_rel_list ;
286
332
287
- List * row_identity_vars ; /* list of RowIdentityVarInfos */
333
+ /* list of RowIdentityVarInfos */
334
+ List * row_identity_vars ;
288
335
289
- List * rowMarks ; /* list of PlanRowMarks */
336
+ /* list of PlanRowMarks */
337
+ List * rowMarks ;
290
338
291
- List * placeholder_list ; /* list of PlaceHolderInfos */
339
+ /* list of PlaceHolderInfos */
340
+ List * placeholder_list ;
292
341
293
- List * fkey_list ; /* list of ForeignKeyOptInfos */
342
+ /* list of ForeignKeyOptInfos */
343
+ List * fkey_list ;
294
344
295
- List * query_pathkeys ; /* desired pathkeys for query_planner() */
345
+ /* desired pathkeys for query_planner() */
346
+ List * query_pathkeys ;
296
347
297
- List * group_pathkeys ; /* groupClause pathkeys, if any */
298
- List * window_pathkeys ; /* pathkeys of bottom window, if any */
299
- List * distinct_pathkeys ; /* distinctClause pathkeys, if any */
300
- List * sort_pathkeys ; /* sortClause pathkeys, if any */
348
+ /* groupClause pathkeys, if any */
349
+ List * group_pathkeys ;
350
+ /* pathkeys of bottom window, if any */
351
+ List * window_pathkeys ;
352
+ /* distinctClause pathkeys, if any */
353
+ List * distinct_pathkeys ;
354
+ /* sortClause pathkeys, if any */
355
+ List * sort_pathkeys ;
301
356
302
- List * part_schemes ; /* Canonicalised partition schemes used in the
303
- * query. */
357
+ /* Canonicalised partition schemes used in the query. */
358
+ List * part_schemes ;
304
359
305
- List * initial_rels ; /* RelOptInfos we are now trying to join */
360
+ /* RelOptInfos we are now trying to join */
361
+ List * initial_rels ;
306
362
307
- /* Use fetch_upper_rel() to get any particular upper rel */
308
- List * upper_rels [UPPERREL_FINAL + 1 ]; /* upper-rel RelOptInfos */
363
+ /*
364
+ * Upper-rel RelOptInfos. Use fetch_upper_rel() to get any particular
365
+ * upper rel.
366
+ */
367
+ List * upper_rels [UPPERREL_FINAL + 1 ];
309
368
310
369
/* Result tlists chosen by grouping_planner for upper-stage processing */
311
370
struct PathTarget * upper_targets [UPPERREL_FINAL + 1 ];
@@ -340,39 +399,62 @@ struct PlannerInfo
340
399
/* context holding PlannerInfo */
341
400
MemoryContext planner_cxt ;
342
401
343
- Cardinality total_table_pages ; /* # of pages in all non-dummy tables of
344
- * query */
345
-
346
- Selectivity tuple_fraction ; /* tuple_fraction passed to query_planner */
347
- Cardinality limit_tuples ; /* limit_tuples passed to query_planner */
402
+ /* # of pages in all non-dummy tables of query */
403
+ Cardinality total_table_pages ;
348
404
349
- Index qual_security_level ; /* minimum security_level for quals */
350
- /* Note: qual_security_level is zero if there are no securityQuals */
405
+ /* tuple_fraction passed to query_planner */
406
+ Selectivity tuple_fraction ;
407
+ /* limit_tuples passed to query_planner */
408
+ Cardinality limit_tuples ;
351
409
352
- bool hasJoinRTEs ; /* true if any RTEs are RTE_JOIN kind */
353
- bool hasLateralRTEs ; /* true if any RTEs are marked LATERAL */
354
- bool hasHavingQual ; /* true if havingQual was non-null */
355
- bool hasPseudoConstantQuals ; /* true if any RestrictInfo has
356
- * pseudoconstant = true */
357
- bool hasAlternativeSubPlans ; /* true if we've made any of those */
358
- bool hasRecursion ; /* true if planning a recursive WITH item */
410
+ /*
411
+ * Minimum security_level for quals. Note: qual_security_level is zero if
412
+ * there are no securityQuals.
413
+ */
414
+ Index qual_security_level ;
415
+
416
+ /* true if any RTEs are RTE_JOIN kind */
417
+ bool hasJoinRTEs ;
418
+ /* true if any RTEs are marked LATERAL */
419
+ bool hasLateralRTEs ;
420
+ /* true if havingQual was non-null */
421
+ bool hasHavingQual ;
422
+ /* true if any RestrictInfo has pseudoconstant = true */
423
+ bool hasPseudoConstantQuals ;
424
+ /* true if we've made any of those */
425
+ bool hasAlternativeSubPlans ;
426
+ /* true if planning a recursive WITH item */
427
+ bool hasRecursion ;
359
428
360
429
/*
361
430
* Information about aggregates. Filled by preprocess_aggrefs().
362
431
*/
363
- List * agginfos ; /* AggInfo structs */
364
- List * aggtransinfos ; /* AggTransInfo structs */
365
- int numOrderedAggs ; /* number w/ DISTINCT/ORDER BY/WITHIN GROUP */
366
- bool hasNonPartialAggs ; /* does any agg not support partial mode? */
367
- bool hasNonSerialAggs ; /* is any partial agg non-serializable? */
432
+ /* AggInfo structs */
433
+ List * agginfos ;
434
+ /* AggTransInfo structs */
435
+ List * aggtransinfos ;
436
+ /* number w/ DISTINCT/ORDER BY/WITHIN GROUP */
437
+ int numOrderedAggs ;
438
+ /* does any agg not support partial mode? */
439
+ bool hasNonPartialAggs ;
440
+ /* is any partial agg non-serializable? */
441
+ bool hasNonSerialAggs ;
368
442
369
- /* These fields are used only when hasRecursion is true: */
370
- int wt_param_id ; /* PARAM_EXEC ID for the work table */
371
- struct Path * non_recursive_path ; /* a path for non-recursive term */
443
+ /*
444
+ * These fields are used only when hasRecursion is true:
445
+ */
446
+ /* PARAM_EXEC ID for the work table */
447
+ int wt_param_id ;
448
+ /* a path for non-recursive term */
449
+ struct Path * non_recursive_path ;
372
450
373
- /* These fields are workspace for createplan.c */
374
- Relids curOuterRels ; /* outer rels above current node */
375
- List * curOuterParams ; /* not-yet-assigned NestLoopParams */
451
+ /*
452
+ * These fields are workspace for createplan.c
453
+ */
454
+ /* outer rels above current node */
455
+ Relids curOuterRels ;
456
+ /* not-yet-assigned NestLoopParams */
457
+ List * curOuterParams ;
376
458
377
459
/*
378
460
* These fields are workspace for setrefs.c. Each is an array
0 commit comments