Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6760448

Browse files
committed
resolve merge conflicts
2 parents1a27df7 +38da2f7 commit6760448

File tree

2 files changed

+40
-19
lines changed

2 files changed

+40
-19
lines changed

‎pathman.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ typedef struct PathmanState
121121
DsmArraydatabases;
122122
}PathmanState;
123123

124-
PathmanState*pmstate;
124+
externboolpg_pathman_enable;
125+
externPathmanState*pmstate;
125126

126127
#definePATHMAN_GET_DATUM(value,by_val) ( (by_val) ? (value) : PointerGetDatum(&value) )
127128

‎pg_pathman.c

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ typedef struct
5151
Oidnew_varno;
5252
}change_varno_context;
5353

54+
boolpg_pathman_enable;
55+
PathmanState*pmstate;
56+
5457
/* Original hooks */
5558
staticset_rel_pathlist_hook_typeset_rel_pathlist_hook_original=NULL;
5659
staticshmem_startup_hook_typeshmem_startup_hook_original=NULL;
@@ -170,6 +173,17 @@ _PG_init(void)
170173
pickyappend_exec_methods.RestrPosCustomScan=NULL;
171174
pickyappend_exec_methods.ExplainCustomScan=pickyppend_explain;
172175

176+
DefineCustomBoolVariable("pg_pathman.enable",
177+
"Enables pg_pathman's optimizations during the planner stage",
178+
NULL,
179+
&pg_pathman_enable,
180+
true,
181+
PGC_USERSET,
182+
0,
183+
NULL,
184+
NULL,
185+
NULL);
186+
173187
DefineCustomBoolVariable("pg_pathman.enable_pickyappend",
174188
"Enables the planner's use of PickyAppend custom node.",
175189
NULL,
@@ -255,27 +269,30 @@ pathman_planner_hook(Query *parse, int cursorOptions, ParamListInfo boundParams)
255269
PlannedStmt*result;
256270
ListCell*lc;
257271

258-
inheritance_disabled= false;
259-
switch(parse->commandType)
272+
if (pg_pathman_enable)
260273
{
261-
caseCMD_SELECT:
262-
disable_inheritance(parse);
263-
break;
264-
caseCMD_UPDATE:
265-
caseCMD_DELETE:
266-
handle_modification_query(parse);
267-
break;
268-
default:
269-
break;
270-
}
274+
inheritance_disabled= false;
275+
switch(parse->commandType)
276+
{
277+
caseCMD_SELECT:
278+
disable_inheritance(parse);
279+
break;
280+
caseCMD_UPDATE:
281+
caseCMD_DELETE:
282+
handle_modification_query(parse);
283+
break;
284+
default:
285+
break;
286+
}
271287

272-
/* If query contains CTE (WITH statement) then handle subqueries too */
273-
foreach(lc,parse->cteList)
274-
{
275-
CommonTableExpr*cte= (CommonTableExpr*)lfirst(lc);
288+
/* If query contains CTE (WITH statement) then handle subqueries too */
289+
foreach(lc,parse->cteList)
290+
{
291+
CommonTableExpr*cte= (CommonTableExpr*)lfirst(lc);
276292

277-
if (IsA(cte->ctequery,Query))
278-
disable_inheritance((Query*)cte->ctequery);
293+
if (IsA(cte->ctequery,Query))
294+
disable_inheritance((Query*)cte->ctequery);
295+
}
279296
}
280297

281298
/* Invoke original hook */
@@ -411,6 +428,9 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
411428
boolfound;
412429
intfirst_child_relid=0;
413430

431+
if (!pg_pathman_enable)
432+
return;
433+
414434
/* This works only for SELECT queries */
415435
if (root->parse->commandType!=CMD_SELECT|| !inheritance_disabled)
416436
return;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp