@@ -430,6 +430,7 @@ static void estimate_path_cost_size(PlannerInfo *root,
430
430
List * pathkeys ,
431
431
PgFdwPathExtraData * fpextra ,
432
432
double * p_rows , int * p_width ,
433
+ int * p_disabled_nodes ,
433
434
Cost * p_startup_cost , Cost * p_total_cost );
434
435
static void get_remote_estimate (const char * sql ,
435
436
PGconn * conn ,
@@ -442,6 +443,7 @@ static void adjust_foreign_grouping_path_cost(PlannerInfo *root,
442
443
double retrieved_rows ,
443
444
double width ,
444
445
double limit_tuples ,
446
+ int * disabled_nodes ,
445
447
Cost * p_startup_cost ,
446
448
Cost * p_run_cost );
447
449
static bool ec_member_matches_foreign (PlannerInfo * root , RelOptInfo * rel ,
@@ -735,6 +737,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
735
737
*/
736
738
estimate_path_cost_size (root , baserel , NIL , NIL , NULL ,
737
739
& fpinfo -> rows , & fpinfo -> width ,
740
+ & fpinfo -> disabled_nodes ,
738
741
& fpinfo -> startup_cost , & fpinfo -> total_cost );
739
742
740
743
/* Report estimated baserel size to planner. */
@@ -765,6 +768,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
765
768
/* Fill in basically-bogus cost estimates for use later. */
766
769
estimate_path_cost_size (root , baserel , NIL , NIL , NULL ,
767
770
& fpinfo -> rows , & fpinfo -> width ,
771
+ & fpinfo -> disabled_nodes ,
768
772
& fpinfo -> startup_cost , & fpinfo -> total_cost );
769
773
}
770
774
@@ -1030,6 +1034,7 @@ postgresGetForeignPaths(PlannerInfo *root,
1030
1034
path = create_foreignscan_path (root , baserel ,
1031
1035
NULL , /* default pathtarget */
1032
1036
fpinfo -> rows ,
1037
+ fpinfo -> disabled_nodes ,
1033
1038
fpinfo -> startup_cost ,
1034
1039
fpinfo -> total_cost ,
1035
1040
NIL , /* no pathkeys */
@@ -1184,13 +1189,14 @@ postgresGetForeignPaths(PlannerInfo *root,
1184
1189
ParamPathInfo * param_info = (ParamPathInfo * ) lfirst (lc );
1185
1190
double rows ;
1186
1191
int width ;
1192
+ int disabled_nodes ;
1187
1193
Cost startup_cost ;
1188
1194
Cost total_cost ;
1189
1195
1190
1196
/* Get a cost estimate from the remote */
1191
1197
estimate_path_cost_size (root , baserel ,
1192
1198
param_info -> ppi_clauses , NIL , NULL ,
1193
- & rows , & width ,
1199
+ & rows , & width , & disabled_nodes ,
1194
1200
& startup_cost , & total_cost );
1195
1201
1196
1202
/*
@@ -1203,6 +1209,7 @@ postgresGetForeignPaths(PlannerInfo *root,
1203
1209
path = create_foreignscan_path (root , baserel ,
1204
1210
NULL , /* default pathtarget */
1205
1211
rows ,
1212
+ disabled_nodes ,
1206
1213
startup_cost ,
1207
1214
total_cost ,
1208
1215
NIL , /* no pathkeys */
@@ -3079,7 +3086,7 @@ postgresExecForeignTruncate(List *rels,
3079
3086
* final sort and the LIMIT restriction.
3080
3087
*
3081
3088
* The function returns the cost and size estimates in p_rows, p_width,
3082
- * p_startup_cost and p_total_cost variables.
3089
+ * p_disabled_nodes, p_startup_cost and p_total_cost variables.
3083
3090
*/
3084
3091
static void
3085
3092
estimate_path_cost_size (PlannerInfo * root ,
@@ -3088,12 +3095,14 @@ estimate_path_cost_size(PlannerInfo *root,
3088
3095
List * pathkeys ,
3089
3096
PgFdwPathExtraData * fpextra ,
3090
3097
double * p_rows , int * p_width ,
3098
+ int * p_disabled_nodes ,
3091
3099
Cost * p_startup_cost , Cost * p_total_cost )
3092
3100
{
3093
3101
PgFdwRelationInfo * fpinfo = (PgFdwRelationInfo * ) foreignrel -> fdw_private ;
3094
3102
double rows ;
3095
3103
double retrieved_rows ;
3096
3104
int width ;
3105
+ int disabled_nodes = 0 ;
3097
3106
Cost startup_cost ;
3098
3107
Cost total_cost ;
3099
3108
@@ -3483,6 +3492,7 @@ estimate_path_cost_size(PlannerInfo *root,
3483
3492
adjust_foreign_grouping_path_cost (root , pathkeys ,
3484
3493
retrieved_rows , width ,
3485
3494
fpextra -> limit_tuples ,
3495
+ & disabled_nodes ,
3486
3496
& startup_cost , & run_cost );
3487
3497
}
3488
3498
else
@@ -3577,6 +3587,7 @@ estimate_path_cost_size(PlannerInfo *root,
3577
3587
/* Return results. */
3578
3588
* p_rows = rows ;
3579
3589
* p_width = width ;
3590
+ * p_disabled_nodes = disabled_nodes ;
3580
3591
* p_startup_cost = startup_cost ;
3581
3592
* p_total_cost = total_cost ;
3582
3593
}
@@ -3637,6 +3648,7 @@ adjust_foreign_grouping_path_cost(PlannerInfo *root,
3637
3648
double retrieved_rows ,
3638
3649
double width ,
3639
3650
double limit_tuples ,
3651
+ int * p_disabled_nodes ,
3640
3652
Cost * p_startup_cost ,
3641
3653
Cost * p_run_cost )
3642
3654
{
@@ -3656,6 +3668,7 @@ adjust_foreign_grouping_path_cost(PlannerInfo *root,
3656
3668
cost_sort (& sort_path ,
3657
3669
root ,
3658
3670
pathkeys ,
3671
+ 0 ,
3659
3672
* p_startup_cost + * p_run_cost ,
3660
3673
retrieved_rows ,
3661
3674
width ,
@@ -6147,13 +6160,15 @@ add_paths_with_pathkeys_for_rel(PlannerInfo *root, RelOptInfo *rel,
6147
6160
{
6148
6161
double rows ;
6149
6162
int width ;
6163
+ int disabled_nodes ;
6150
6164
Cost startup_cost ;
6151
6165
Cost total_cost ;
6152
6166
List * useful_pathkeys = lfirst (lc );
6153
6167
Path * sorted_epq_path ;
6154
6168
6155
6169
estimate_path_cost_size (root , rel , NIL , useful_pathkeys , NULL ,
6156
- & rows , & width , & startup_cost , & total_cost );
6170
+ & rows , & width , & disabled_nodes ,
6171
+ & startup_cost , & total_cost );
6157
6172
6158
6173
/*
6159
6174
* The EPQ path must be at least as well sorted as the path itself, in
@@ -6175,6 +6190,7 @@ add_paths_with_pathkeys_for_rel(PlannerInfo *root, RelOptInfo *rel,
6175
6190
create_foreignscan_path (root , rel ,
6176
6191
NULL ,
6177
6192
rows ,
6193
+ disabled_nodes ,
6178
6194
startup_cost ,
6179
6195
total_cost ,
6180
6196
useful_pathkeys ,
@@ -6188,6 +6204,7 @@ add_paths_with_pathkeys_for_rel(PlannerInfo *root, RelOptInfo *rel,
6188
6204
create_foreign_join_path (root , rel ,
6189
6205
NULL ,
6190
6206
rows ,
6207
+ disabled_nodes ,
6191
6208
startup_cost ,
6192
6209
total_cost ,
6193
6210
useful_pathkeys ,
@@ -6335,6 +6352,7 @@ postgresGetForeignJoinPaths(PlannerInfo *root,
6335
6352
ForeignPath * joinpath ;
6336
6353
double rows ;
6337
6354
int width ;
6355
+ int disabled_nodes ;
6338
6356
Cost startup_cost ;
6339
6357
Cost total_cost ;
6340
6358
Path * epq_path ; /* Path to create plan to be executed when
@@ -6424,12 +6442,14 @@ postgresGetForeignJoinPaths(PlannerInfo *root,
6424
6442
6425
6443
/* Estimate costs for bare join relation */
6426
6444
estimate_path_cost_size (root , joinrel , NIL , NIL , NULL ,
6427
- & rows , & width , & startup_cost , & total_cost );
6445
+ & rows , & width , & disabled_nodes ,
6446
+ & startup_cost , & total_cost );
6428
6447
/* Now update this information in the joinrel */
6429
6448
joinrel -> rows = rows ;
6430
6449
joinrel -> reltarget -> width = width ;
6431
6450
fpinfo -> rows = rows ;
6432
6451
fpinfo -> width = width ;
6452
+ fpinfo -> disabled_nodes = disabled_nodes ;
6433
6453
fpinfo -> startup_cost = startup_cost ;
6434
6454
fpinfo -> total_cost = total_cost ;
6435
6455
@@ -6441,6 +6461,7 @@ postgresGetForeignJoinPaths(PlannerInfo *root,
6441
6461
joinrel ,
6442
6462
NULL , /* default pathtarget */
6443
6463
rows ,
6464
+ disabled_nodes ,
6444
6465
startup_cost ,
6445
6466
total_cost ,
6446
6467
NIL , /* no pathkeys */
@@ -6768,6 +6789,7 @@ add_foreign_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
6768
6789
ForeignPath * grouppath ;
6769
6790
double rows ;
6770
6791
int width ;
6792
+ int disabled_nodes ;
6771
6793
Cost startup_cost ;
6772
6794
Cost total_cost ;
6773
6795
@@ -6818,11 +6840,13 @@ add_foreign_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
6818
6840
6819
6841
/* Estimate the cost of push down */
6820
6842
estimate_path_cost_size (root , grouped_rel , NIL , NIL , NULL ,
6821
- & rows , & width , & startup_cost , & total_cost );
6843
+ & rows , & width , & disabled_nodes ,
6844
+ & startup_cost , & total_cost );
6822
6845
6823
6846
/* Now update this information in the fpinfo */
6824
6847
fpinfo -> rows = rows ;
6825
6848
fpinfo -> width = width ;
6849
+ fpinfo -> disabled_nodes = disabled_nodes ;
6826
6850
fpinfo -> startup_cost = startup_cost ;
6827
6851
fpinfo -> total_cost = total_cost ;
6828
6852
@@ -6831,6 +6855,7 @@ add_foreign_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
6831
6855
grouped_rel ,
6832
6856
grouped_rel -> reltarget ,
6833
6857
rows ,
6858
+ disabled_nodes ,
6834
6859
startup_cost ,
6835
6860
total_cost ,
6836
6861
NIL , /* no pathkeys */
@@ -6859,6 +6884,7 @@ add_foreign_ordered_paths(PlannerInfo *root, RelOptInfo *input_rel,
6859
6884
PgFdwPathExtraData * fpextra ;
6860
6885
double rows ;
6861
6886
int width ;
6887
+ int disabled_nodes ;
6862
6888
Cost startup_cost ;
6863
6889
Cost total_cost ;
6864
6890
List * fdw_private ;
@@ -6952,7 +6978,8 @@ add_foreign_ordered_paths(PlannerInfo *root, RelOptInfo *input_rel,
6952
6978
6953
6979
/* Estimate the costs of performing the final sort remotely */
6954
6980
estimate_path_cost_size (root , input_rel , NIL , root -> sort_pathkeys , fpextra ,
6955
- & rows , & width , & startup_cost , & total_cost );
6981
+ & rows , & width , & disabled_nodes ,
6982
+ & startup_cost , & total_cost );
6956
6983
6957
6984
/*
6958
6985
* Build the fdw_private list that will be used by postgresGetForeignPlan.
@@ -6965,6 +6992,7 @@ add_foreign_ordered_paths(PlannerInfo *root, RelOptInfo *input_rel,
6965
6992
input_rel ,
6966
6993
root -> upper_targets [UPPERREL_ORDERED ],
6967
6994
rows ,
6995
+ disabled_nodes ,
6968
6996
startup_cost ,
6969
6997
total_cost ,
6970
6998
root -> sort_pathkeys ,
@@ -6998,6 +7026,7 @@ add_foreign_final_paths(PlannerInfo *root, RelOptInfo *input_rel,
6998
7026
bool save_use_remote_estimate = false;
6999
7027
double rows ;
7000
7028
int width ;
7029
+ int disabled_nodes ;
7001
7030
Cost startup_cost ;
7002
7031
Cost total_cost ;
7003
7032
List * fdw_private ;
@@ -7082,6 +7111,7 @@ add_foreign_final_paths(PlannerInfo *root, RelOptInfo *input_rel,
7082
7111
path -> parent ,
7083
7112
path -> pathtarget ,
7084
7113
path -> rows ,
7114
+ path -> disabled_nodes ,
7085
7115
path -> startup_cost ,
7086
7116
path -> total_cost ,
7087
7117
path -> pathkeys ,
@@ -7199,7 +7229,8 @@ add_foreign_final_paths(PlannerInfo *root, RelOptInfo *input_rel,
7199
7229
ifpinfo -> use_remote_estimate = false;
7200
7230
}
7201
7231
estimate_path_cost_size (root , input_rel , NIL , pathkeys , fpextra ,
7202
- & rows , & width , & startup_cost , & total_cost );
7232
+ & rows , & width , & disabled_nodes ,
7233
+ & startup_cost , & total_cost );
7203
7234
if (!fpextra -> has_final_sort )
7204
7235
ifpinfo -> use_remote_estimate = save_use_remote_estimate ;
7205
7236
@@ -7218,6 +7249,7 @@ add_foreign_final_paths(PlannerInfo *root, RelOptInfo *input_rel,
7218
7249
input_rel ,
7219
7250
root -> upper_targets [UPPERREL_FINAL ],
7220
7251
rows ,
7252
+ disabled_nodes ,
7221
7253
startup_cost ,
7222
7254
total_cost ,
7223
7255
pathkeys ,
0 commit comments