mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Support parallel bitmap heap scans.
The index is scanned by a single process, but then all cooperating processes can iterate jointly over the resulting set of heap blocks. In the future, we might also want to support using a parallel bitmap index scan to set up for a parallel bitmap heap scan, but that's a job for another day. Dilip Kumar, with some corrections and cosmetic changes by me. The larger patch set of which this is a part has been reviewed and tested by (at least) Andres Freund, Amit Khandekar, Tushar Ahuja, Rafia Sabih, Haribabu Kommi, Thomas Munro, and me. Discussion: http://postgr.es/m/CAFiTN-uc4=0WxRGfCzs-xfkMYcSEWUC-Fon6thkJGjkh9i=13A@mail.gmail.com
This commit is contained in:
@ -125,6 +125,7 @@ static BitmapHeapScan *create_bitmap_scan_plan(PlannerInfo *root,
|
||||
List *tlist, List *scan_clauses);
|
||||
static Plan *create_bitmap_subplan(PlannerInfo *root, Path *bitmapqual,
|
||||
List **qual, List **indexqual, List **indexECs);
|
||||
static void bitmap_subplan_mark_shared(Plan *plan);
|
||||
static TidScan *create_tidscan_plan(PlannerInfo *root, TidPath *best_path,
|
||||
List *tlist, List *scan_clauses);
|
||||
static SubqueryScan *create_subqueryscan_plan(PlannerInfo *root,
|
||||
@ -2590,6 +2591,9 @@ create_bitmap_scan_plan(PlannerInfo *root,
|
||||
&bitmapqualorig, &indexquals,
|
||||
&indexECs);
|
||||
|
||||
if (best_path->path.parallel_aware)
|
||||
bitmap_subplan_mark_shared(bitmapqualplan);
|
||||
|
||||
/*
|
||||
* The qpqual list must contain all restrictions not automatically handled
|
||||
* by the index, other than pseudoconstant clauses which will be handled
|
||||
@ -4756,6 +4760,24 @@ label_sort_with_costsize(PlannerInfo *root, Sort *plan, double limit_tuples)
|
||||
plan->plan.parallel_aware = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* bitmap_subplan_mark_shared
|
||||
* Set isshared flag in bitmap subplan so that it will be created in
|
||||
* shared memory.
|
||||
*/
|
||||
static void
|
||||
bitmap_subplan_mark_shared(Plan *plan)
|
||||
{
|
||||
if (IsA(plan, BitmapAnd))
|
||||
bitmap_subplan_mark_shared(
|
||||
linitial(((BitmapAnd *) plan)->bitmapplans));
|
||||
else if (IsA(plan, BitmapOr))
|
||||
((BitmapOr *) plan)->isshared = true;
|
||||
else if (IsA(plan, BitmapIndexScan))
|
||||
((BitmapIndexScan *) plan)->isshared = true;
|
||||
else
|
||||
elog(ERROR, "unrecognized node type: %d", nodeTag(plan));
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
|
Reference in New Issue
Block a user