mirror of https://github.com/citusdata/citus.git
Apply feedback - add fastPath field to plan
parent
13a9b55695
commit
5a1e752726
|
@ -79,8 +79,7 @@ static DistributedPlan * CreateDistributedPlan(uint64 planId, Query *originalQue
|
||||||
bool hasUnresolvedParams,
|
bool hasUnresolvedParams,
|
||||||
PlannerRestrictionContext *
|
PlannerRestrictionContext *
|
||||||
plannerRestrictionContext);
|
plannerRestrictionContext);
|
||||||
static void FinalizeDistributedPlan(DistributedPlan *plan, Query *originalQuery,
|
static void FinalizeDistributedPlan(DistributedPlan *plan, Query *originalQuery);
|
||||||
bool fastPathRouterQuery);
|
|
||||||
static void RecordSubPlansUsedInPlan(DistributedPlan *plan, Query *originalQuery);
|
static void RecordSubPlansUsedInPlan(DistributedPlan *plan, Query *originalQuery);
|
||||||
static DeferredErrorMessage * DeferErrorIfPartitionTableNotSingleReplicated(Oid
|
static DeferredErrorMessage * DeferErrorIfPartitionTableNotSingleReplicated(Oid
|
||||||
relationId);
|
relationId);
|
||||||
|
@ -685,8 +684,6 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
|
||||||
{
|
{
|
||||||
DistributedPlan *distributedPlan = NULL;
|
DistributedPlan *distributedPlan = NULL;
|
||||||
bool hasCtes = originalQuery->cteList != NIL;
|
bool hasCtes = originalQuery->cteList != NIL;
|
||||||
bool fastPathRouterQuery =
|
|
||||||
plannerRestrictionContext->fastPathRestrictionContext->fastPathRouterQuery;
|
|
||||||
|
|
||||||
if (IsModifyCommand(originalQuery))
|
if (IsModifyCommand(originalQuery))
|
||||||
{
|
{
|
||||||
|
@ -722,7 +719,7 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
|
||||||
|
|
||||||
if (distributedPlan->planningError == NULL)
|
if (distributedPlan->planningError == NULL)
|
||||||
{
|
{
|
||||||
FinalizeDistributedPlan(distributedPlan, originalQuery, fastPathRouterQuery);
|
FinalizeDistributedPlan(distributedPlan, originalQuery);
|
||||||
|
|
||||||
return distributedPlan;
|
return distributedPlan;
|
||||||
}
|
}
|
||||||
|
@ -744,7 +741,7 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
|
||||||
plannerRestrictionContext);
|
plannerRestrictionContext);
|
||||||
if (distributedPlan->planningError == NULL)
|
if (distributedPlan->planningError == NULL)
|
||||||
{
|
{
|
||||||
FinalizeDistributedPlan(distributedPlan, originalQuery, fastPathRouterQuery);
|
FinalizeDistributedPlan(distributedPlan, originalQuery);
|
||||||
|
|
||||||
return distributedPlan;
|
return distributedPlan;
|
||||||
}
|
}
|
||||||
|
@ -838,7 +835,7 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
|
||||||
plannerRestrictionContext);
|
plannerRestrictionContext);
|
||||||
distributedPlan->subPlanList = subPlanList;
|
distributedPlan->subPlanList = subPlanList;
|
||||||
|
|
||||||
FinalizeDistributedPlan(distributedPlan, originalQuery, fastPathRouterQuery);
|
FinalizeDistributedPlan(distributedPlan, originalQuery);
|
||||||
|
|
||||||
return distributedPlan;
|
return distributedPlan;
|
||||||
}
|
}
|
||||||
|
@ -850,7 +847,7 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
|
||||||
*/
|
*/
|
||||||
if (IsModifyCommand(originalQuery))
|
if (IsModifyCommand(originalQuery))
|
||||||
{
|
{
|
||||||
FinalizeDistributedPlan(distributedPlan, originalQuery, fastPathRouterQuery);
|
FinalizeDistributedPlan(distributedPlan, originalQuery);
|
||||||
|
|
||||||
return distributedPlan;
|
return distributedPlan;
|
||||||
}
|
}
|
||||||
|
@ -883,7 +880,7 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
|
||||||
/* distributed plan currently should always succeed or error out */
|
/* distributed plan currently should always succeed or error out */
|
||||||
Assert(distributedPlan && distributedPlan->planningError == NULL);
|
Assert(distributedPlan && distributedPlan->planningError == NULL);
|
||||||
|
|
||||||
FinalizeDistributedPlan(distributedPlan, originalQuery, fastPathRouterQuery);
|
FinalizeDistributedPlan(distributedPlan, originalQuery);
|
||||||
|
|
||||||
return distributedPlan;
|
return distributedPlan;
|
||||||
}
|
}
|
||||||
|
@ -894,14 +891,13 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
|
||||||
* currently only implements some optimizations for intermediate result(s) pruning.
|
* currently only implements some optimizations for intermediate result(s) pruning.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
FinalizeDistributedPlan(DistributedPlan *plan, Query *originalQuery,
|
FinalizeDistributedPlan(DistributedPlan *plan, Query *originalQuery)
|
||||||
bool fastPathRouterQuery)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Fast path queries, we cannot have any subplans by their definition,
|
* Fast path queries, we cannot have any subplans by their definition,
|
||||||
* so skip expensive traversals.
|
* so skip expensive traversals.
|
||||||
*/
|
*/
|
||||||
if (!fastPathRouterQuery)
|
if (!plan->fastPathRouterPlan)
|
||||||
{
|
{
|
||||||
RecordSubPlansUsedInPlan(plan, originalQuery);
|
RecordSubPlansUsedInPlan(plan, originalQuery);
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,9 @@ CreateRouterPlan(Query *originalQuery, Query *query,
|
||||||
plannerRestrictionContext);
|
plannerRestrictionContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
distributedPlan->fastPathRouterPlan =
|
||||||
|
plannerRestrictionContext->fastPathRestrictionContext->fastPathRouterQuery;
|
||||||
|
|
||||||
return distributedPlan;
|
return distributedPlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,7 @@ OutDistributedPlan(OUTFUNC_ARGS)
|
||||||
|
|
||||||
WRITE_NODE_FIELD(subPlanList);
|
WRITE_NODE_FIELD(subPlanList);
|
||||||
WRITE_NODE_FIELD(usedSubPlanNodeList);
|
WRITE_NODE_FIELD(usedSubPlanNodeList);
|
||||||
|
WRITE_BOOL_FIELD(fastPathRouterPlan);
|
||||||
|
|
||||||
WRITE_NODE_FIELD(planningError);
|
WRITE_NODE_FIELD(planningError);
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,7 @@ ReadDistributedPlan(READFUNC_ARGS)
|
||||||
|
|
||||||
READ_NODE_FIELD(subPlanList);
|
READ_NODE_FIELD(subPlanList);
|
||||||
READ_NODE_FIELD(usedSubPlanNodeList);
|
READ_NODE_FIELD(usedSubPlanNodeList);
|
||||||
|
READ_BOOL_FIELD(fastPathRouterPlan);
|
||||||
|
|
||||||
READ_NODE_FIELD(planningError);
|
READ_NODE_FIELD(planningError);
|
||||||
|
|
||||||
|
|
|
@ -310,6 +310,12 @@ typedef struct DistributedPlan
|
||||||
*/
|
*/
|
||||||
List *usedSubPlanNodeList;
|
List *usedSubPlanNodeList;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When the query is very simple such that we don't need to call
|
||||||
|
* standard_planner(). See FastPathRouterQuery() for the definition.
|
||||||
|
*/
|
||||||
|
bool fastPathRouterPlan;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NULL if this a valid plan, an error description otherwise. This will
|
* NULL if this a valid plan, an error description otherwise. This will
|
||||||
* e.g. be set if SQL features are present that a planner doesn't support,
|
* e.g. be set if SQL features are present that a planner doesn't support,
|
||||||
|
|
Loading…
Reference in New Issue