!825 分区表BitmapHeapScan与BitmapHeapIndexScan代码优化。
Merge pull request !825 from Yuejia/optimize
This commit is contained in:
@ -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)) {
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user