!825 分区表BitmapHeapScan与BitmapHeapIndexScan代码优化。

Merge pull request !825 from Yuejia/optimize
This commit is contained in:
opengauss-bot
2021-03-16 23:03:21 +08:00
committed by Gitee
6 changed files with 26 additions and 7 deletions

View File

@ -76,6 +76,8 @@ static PruningResult* partitionEqualPruningWalker(PartitionType partType, Expr*
((pruningResult)->boundary->partitionKeyNum > 1 && (topValue) && PointerIsValid((topValue)[0]) && \
!(pruningResult)->boundary->maxClose[0])
#define IF_OPEN_PARTITION_PRUNING 0
static PartitionMap* GetRelPartitionMap(Relation relation)
{
return relation->partMap;
@ -630,18 +632,17 @@ PruningResult* partitionPruningForExpr(PlannerInfo* root, RangeTblEntry* rte, Re
else
result = partitionPruningWalker(expr, context);
if (result->exprPart != NULL || result->paramArg != NULL) {
#ifndef ENABLE_MULTIPLE_NODES
destroyPruningResult(result);
result = getFullPruningResult(rel);
return result;
#else
if (!IF_OPEN_PARTITION_PRUNING) {
destroyPruningResult(result);
result = getFullPruningResult(rel);
return result;
}
Param* paramArg = (Param *)copyObject(result->paramArg);
destroyPruningResult(result);
result = getFullPruningResult(rel);
result->expr = expr;
result->paramArg = paramArg;
return result;
#endif
}
/* Never happen, just to be self-contained */
if (!PointerIsValid(result)) {

View File

@ -1448,6 +1448,10 @@ void InitPlan(QueryDesc *queryDesc, int eflags)
}
planstate = ExecInitNode(plan, estate, eflags);
if (estate->pruningResult) {
destroyPruningResult(estate->pruningResult);
estate->pruningResult = NULL;
}
/*
* Get the tuple descriptor describing the type of tuples to return.
*/

View File

@ -170,6 +170,8 @@ EState* CreateExecutorState(void)
estate->es_material_of_subplan = NIL;
estate->es_recursive_next_iteration = false;
estate->pruningResult = NULL;
/*
* Return the executor state structure
*/

View File

@ -786,6 +786,10 @@ static void ExecInitPartitionForBitmapHeapScan(BitmapHeapScanState* scanstate, E
PruningResult* resultPlan = NULL;
if (plan->scan.pruningInfo->expr) {
resultPlan = GetPartitionInfo(plan->scan.pruningInfo, estate, currentRelation);
if (estate->pruningResult) {
destroyPruningResult(estate->pruningResult);
}
estate->pruningResult = resultPlan;
} else {
resultPlan = plan->scan.pruningInfo;
}

View File

@ -491,7 +491,13 @@ void ExecInitPartitionForBitmapIndexScan(BitmapIndexScanState* indexstate, EStat
indexstate->lockMode = lock;
PruningResult* resultPlan = NULL;
if (plan->scan.pruningInfo->expr) {
resultPlan = GetPartitionInfo(plan->scan.pruningInfo, estate, rel);
if (estate->pruningResult) {
resultPlan = estate->pruningResult;
} else {
resultPlan = GetPartitionInfo(plan->scan.pruningInfo, estate, rel);
destroyPruningResult(estate->pruningResult);
estate->pruningResult = resultPlan;
}
} else {
resultPlan = plan->scan.pruningInfo;
}

View File

@ -573,6 +573,8 @@ typedef struct EState {
#ifdef ENABLE_MOT
JitExec::JitContext* mot_jit_context; /* MOT JIT context required for executing LLVM jitted code */
#endif
PruningResult* pruningResult;
} EState;
/*