10
10
#include "postgres.h"
11
11
#include "optimizer/cost.h"
12
12
#include "optimizer/restrictinfo.h"
13
+ #include "utils/guc.h"
13
14
#include "hooks.h"
14
15
#include "utils.h"
15
16
#include "pathman.h"
@@ -106,7 +107,7 @@ pathman_join_pathlist_hook(PlannerInfo *root,
106
107
inner = create_runtimeappend_path (root ,cur_inner_path ,
107
108
get_appendrel_parampathinfo (innerrel ,
108
109
inner_required ),
109
- joinclauses , paramsel );
110
+ paramsel );
110
111
111
112
initial_cost_nestloop (root ,& workspace ,jointype ,
112
113
outer ,inner ,
@@ -262,7 +263,6 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
262
263
263
264
for (i = irange_lower (irange );i <=irange_upper (irange );i ++ )
264
265
append_child_relation (root ,rel ,rti ,rte ,i ,dsm_arr [i ],wrappers );
265
-
266
266
}
267
267
268
268
/* Clear old path list */
@@ -282,8 +282,6 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
282
282
Relids inner_required = PATH_REQ_OUTER ((Path * )cur_path );
283
283
ParamPathInfo * ppi = get_appendrel_parampathinfo (rel ,inner_required );
284
284
Path * inner_path = NULL ;
285
- ListCell * subpath_cell ;
286
- List * runtime_quals = NIL ;
287
285
288
286
if (!(IsA (cur_path ,AppendPath )|| IsA (cur_path ,MergeAppendPath ))||
289
287
rel -> has_eclass_joins ||
@@ -292,56 +290,29 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
292
290
continue ;
293
291
}
294
292
295
- foreach (subpath_cell ,cur_path -> subpaths )
296
- {
297
- Path * subpath = (Path * )lfirst (subpath_cell );
298
- RelOptInfo * child_rel = subpath -> parent ;
299
- List * quals ;
300
- ListCell * qual_cell ;
301
- ReplaceVarsContext repl_var_cxt ;
302
-
303
- repl_var_cxt .child = subpath -> parent ;
304
- repl_var_cxt .parent = rel ;
305
- repl_var_cxt .sublevels_up = 0 ;
306
-
307
- quals = extract_actual_clauses (child_rel -> baserestrictinfo , false);
308
-
309
- /* Do not proceed if there's a rel containing quals without params */
310
- if (!clause_contains_params ((Node * )quals ))
311
- {
312
- runtime_quals = NIL ;/* skip this path */
313
- break ;
314
- }
315
-
316
- /* Replace child Vars with a parent rel's Var */
317
- quals = (List * )replace_child_vars_with_parent_var ((Node * )quals ,
318
- & repl_var_cxt );
319
-
320
- /* Combine unique quals for RuntimeAppend */
321
- foreach (qual_cell ,quals )
322
- runtime_quals = list_append_unique (runtime_quals ,
323
- (Node * )lfirst (qual_cell ));
324
- }
325
-
326
- /*
327
- * Dismiss RuntimeAppend if there
328
- * are no parameterized quals
329
- */
330
- if (runtime_quals == NIL )
331
- continue ;
332
-
333
293
if (IsA (cur_path ,AppendPath )&& pg_pathman_enable_runtimeappend )
334
294
inner_path = create_runtimeappend_path (root ,cur_path ,
335
- ppi ,runtime_quals ,
336
- paramsel );
295
+ ppi ,paramsel );
337
296
else if (IsA (cur_path ,MergeAppendPath )&&
338
297
pg_pathman_enable_runtime_merge_append )
339
298
inner_path = create_runtimemergeappend_path (root ,cur_path ,
340
- ppi ,runtime_quals ,
341
- paramsel );
299
+ ppi ,paramsel );
342
300
343
301
if (inner_path )
344
302
add_path (rel ,inner_path );
345
303
}
346
304
}
347
305
}
306
+
307
+ void pg_pathman_enable_assign_hook (bool newval ,void * extra )
308
+ {
309
+ if (pg_pathman_enable == newval )
310
+ return ;
311
+
312
+ pg_pathman_enable_runtime_merge_append = newval ;
313
+ pg_pathman_enable_runtimeappend = newval ;
314
+
315
+ elog (NOTICE ,
316
+ "RuntimeAppend and RuntimeMergeAppend nodes have been %s" ,
317
+ newval ?"enabled" :"disabled" );
318
+ }