@@ -102,8 +102,8 @@ create_partial_tempscan_path(PlannerInfo *root, RelOptInfo *rel,
102
102
pathnode -> parallel_workers = path -> parallel_workers ;
103
103
104
104
/* DEBUGGING purposes only */
105
- pathnode -> startup_cost = path -> startup_cost /*/ disable_cost*/ ;
106
- pathnode -> total_cost = path -> total_cost /*/ disable_cost*/ ;
105
+ pathnode -> startup_cost = path -> startup_cost ;
106
+ pathnode -> total_cost = path -> total_cost ;
107
107
108
108
cpath -> custom_paths = list_make1 (path );
109
109
cpath -> custom_private = NIL ;
@@ -206,7 +206,8 @@ try_partial_tempscan(PlannerInfo *root, RelOptInfo *rel, Index rti,
206
206
RangeTblEntry * rte )
207
207
{
208
208
int parallel_workers ;
209
- Path * path ;
209
+ ListCell * lc ;
210
+ List * partial_pathlist_new = NIL ;
210
211
211
212
/*
212
213
* Some extension intercept this hook earlier. Allow it to do a work
@@ -234,16 +235,33 @@ try_partial_tempscan(PlannerInfo *root, RelOptInfo *rel, Index rti,
234
235
if (parallel_workers <=0 )
235
236
return ;
236
237
238
+ /* Enable parallel paths generation for this relation */
239
+ Assert (rel -> partial_pathlist == NIL );
237
240
rel -> consider_parallel = true;
238
241
239
- path = create_seqscan_path (root ,rel ,NULL ,parallel_workers );
240
- if (path )
242
+ /* Add partial sequental scan path. */
243
+ add_partial_path (rel , (Path * )
244
+ create_seqscan_path (root ,rel ,NULL ,parallel_workers ));
245
+
246
+ /* Add there more specific paths too */
247
+ create_index_paths (root ,rel );
248
+ create_tidscan_paths (root ,rel );
249
+
250
+ foreach (lc ,rel -> partial_pathlist )
241
251
{
242
- /* Add an unordered partial path based on a parallel sequential scan. */
243
- add_partial_path (rel , (Path * )
244
- create_partial_tempscan_path (root ,rel ,path ));
252
+ Path * path = lfirst (lc );
253
+
254
+ partial_pathlist_new =
255
+ lappend (partial_pathlist_new ,
256
+ (void * )create_partial_tempscan_path (root ,rel ,path ));
245
257
}
246
258
259
+ /*
260
+ * Dangerous zone. But we assume it is strictly local. What about extension
261
+ * which could call ours and add some paths after us?
262
+ */
263
+ rel -> partial_pathlist = partial_pathlist_new ;
264
+
247
265
Assert (IsA (linitial (rel -> partial_pathlist ),CustomPath ));
248
266
}
249
267