mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-04 11:40:57 +08:00
Started support for parallel index scan [skip ci]
This commit is contained in:
@@ -103,7 +103,13 @@ ivfflatcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
|
||||
if (ratio > 1)
|
||||
ratio = 1;
|
||||
|
||||
// cost estimates for parallel workers applied outside of amcostestimate
|
||||
elog(INFO, "parallel_workers = %d, parallel aware = %d", path->path.parallel_workers, path->path.parallel_aware);
|
||||
|
||||
costs.indexTotalCost *= ratio;
|
||||
costs.numIndexPages *= ratio;
|
||||
|
||||
elog(INFO, "ivfflatcostestimate = %f", costs.indexTotalCost);
|
||||
|
||||
/* Startup cost and total cost are same */
|
||||
*indexStartupCost = costs.indexTotalCost;
|
||||
@@ -151,6 +157,25 @@ ivfflatvalidate(Oid opclassoid)
|
||||
return true;
|
||||
}
|
||||
|
||||
static Size
|
||||
ivfflatestimateparallelscan()
|
||||
{
|
||||
elog(INFO, "ivfflatestimateparallelscan");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ivfflatinitparallelscan(void *target)
|
||||
{
|
||||
elog(INFO, "ivfflatinitparallelscan");
|
||||
}
|
||||
|
||||
static void
|
||||
ivfflatparallelrescan(IndexScanDesc scan)
|
||||
{
|
||||
elog(INFO, "ivfflatparallelrescan");
|
||||
}
|
||||
|
||||
/*
|
||||
* Define index handler
|
||||
*
|
||||
@@ -178,7 +203,7 @@ ivfflathandler(PG_FUNCTION_ARGS)
|
||||
amroutine->amstorage = false;
|
||||
amroutine->amclusterable = false;
|
||||
amroutine->ampredlocks = false;
|
||||
amroutine->amcanparallel = false;
|
||||
amroutine->amcanparallel = true;
|
||||
amroutine->amcaninclude = false;
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
amroutine->amusemaintenanceworkmem = false; /* not used during VACUUM */
|
||||
@@ -212,9 +237,9 @@ ivfflathandler(PG_FUNCTION_ARGS)
|
||||
amroutine->amrestrpos = NULL;
|
||||
|
||||
/* Interface functions to support parallel index scans */
|
||||
amroutine->amestimateparallelscan = NULL;
|
||||
amroutine->aminitparallelscan = NULL;
|
||||
amroutine->amparallelrescan = NULL;
|
||||
amroutine->amestimateparallelscan = ivfflatestimateparallelscan;
|
||||
amroutine->aminitparallelscan = ivfflatinitparallelscan;
|
||||
amroutine->amparallelrescan = ivfflatparallelrescan;
|
||||
|
||||
PG_RETURN_POINTER(amroutine);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user