Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9471ce0

Browse files
committed
Force optimiser to use AJ paths.
To check the feature we need good covering of tests. Force AJ whenever possible by drastically reducing startup and total costs of OTHER_JOINREL, generated by the AJ code.
1 parent 348744b commit 9471ce0

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/backend/optimizer/path/joinrels.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1874,10 +1874,11 @@ try_asymmetric_partitionwise_join(PlannerInfo *root,
18741874
nappinfos, appinfos)));
18751875

18761876
/* And make paths for the child join */
1877+
force_path = true;
18771878
populate_joinrel_with_paths(root, outer_child, inner_rel,
18781879
child_joinrel, child_sjinfo,
18791880
child_restrictlist);
1880-
1881+
force_path = false;
18811882
pfree(appinfos);
18821883

18831884
/*

src/backend/optimizer/util/pathnode.c

+8
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ typedef enum
4646
*/
4747
#define STD_FUZZ_FACTOR 1.01
4848

49+
bool force_path = false;
50+
4951
static List *translate_sub_tlist(List *tlist, int relid);
5052
static int append_total_cost_compare(const ListCell *a, const ListCell *b);
5153
static int append_startup_cost_compare(const ListCell *a, const ListCell *b);
@@ -425,6 +427,12 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
425427
List *new_path_pathkeys;
426428
ListCell *p1;
427429

430+
if (force_path)
431+
{
432+
new_path->startup_cost = 0.0001;
433+
new_path->total_cost = 0.0001;
434+
}
435+
428436
/*
429437
* This is a convenient place to check for query cancel --- no part of the
430438
* planner goes very long without calling add_path().

src/include/optimizer/pathnode.h

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "nodes/pathnodes.h"
1919

2020

21+
extern bool force_path;
22+
2123
/*
2224
* prototypes for pathnode.c
2325
*/

0 commit comments

Comments
 (0)