Skip to content

Commit b05ee92

Browse files
committed
add PickyAppend user GUC
1 parent 081c4ee commit b05ee92

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

pg_pathman.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "utils/date.h"
3434
#include "utils/typcache.h"
3535
#include "utils/lsyscache.h"
36+
#include "utils/guc.h"
3637
#include "access/heapam.h"
3738
#include "access/nbtree.h"
3839
#include "storage/ipc.h"
@@ -157,6 +158,17 @@ _PG_init(void)
157158
pickyappend_exec_methods.MarkPosCustomScan = NULL;
158159
pickyappend_exec_methods.RestrPosCustomScan = NULL;
159160
pickyappend_exec_methods.ExplainCustomScan = pickyppend_explain;
161+
162+
DefineCustomBoolVariable("pg_pathman.enable_pickyappend",
163+
"Enables the planner's use of PickyAppend custom node.",
164+
NULL,
165+
&pg_pathman_enable_pickyappend,
166+
true,
167+
PGC_USERSET,
168+
0,
169+
NULL,
170+
NULL,
171+
NULL);
160172
}
161173

162174
void

pickyappend.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#include "optimizer/tlist.h"
1111
#include "optimizer/var.h"
1212

13+
14+
bool pg_pathman_enable_pickyappend = true;
15+
1316
set_join_pathlist_hook_type set_join_pathlist_next = NULL;
1417

1518
CustomPathMethods pickyappend_path_methods;
@@ -293,7 +296,7 @@ pathman_join_pathlist_hook(PlannerInfo *root,
293296
set_join_pathlist_next(root, joinrel, outerrel,
294297
innerrel, jointype, extra);
295298

296-
if (jointype == JOIN_FULL)
299+
if (jointype == JOIN_FULL || !pg_pathman_enable_pickyappend)
297300
return;
298301

299302
if (innerrel->reloptkind == RELOPT_BASEREL &&

pickyappend.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
#include "pathman.h"
88

9+
10+
extern bool pg_pathman_enable_pickyappend;
11+
912
typedef struct
1013
{
1114
Oid relid;

0 commit comments

Comments
 (0)