mirror of https://gitee.com/bigwinds/arangodb
enable more indexes
This commit is contained in:
parent
cb57738d1d
commit
a1f812b28b
|
@ -1149,7 +1149,7 @@ void ExecutionPlan::replaceNode (ExecutionNode* oldNode,
|
||||||
|
|
||||||
std::vector<ExecutionNode*> deps = oldNode->getDependencies();
|
std::vector<ExecutionNode*> deps = oldNode->getDependencies();
|
||||||
// Intentional copy
|
// Intentional copy
|
||||||
|
|
||||||
for (auto* x : deps) {
|
for (auto* x : deps) {
|
||||||
newNode->addDependency(x);
|
newNode->addDependency(x);
|
||||||
oldNode->removeDependency(x);
|
oldNode->removeDependency(x);
|
||||||
|
@ -1157,7 +1157,7 @@ void ExecutionPlan::replaceNode (ExecutionNode* oldNode,
|
||||||
|
|
||||||
auto oldNodeParents = oldNode->getParents(); // Intentional copy
|
auto oldNodeParents = oldNode->getParents(); // Intentional copy
|
||||||
for (auto* oldNodeParent : oldNodeParents) {
|
for (auto* oldNodeParent : oldNodeParents) {
|
||||||
if(! oldNodeParent->replaceDependency(oldNode, newNode)){
|
if (! oldNodeParent->replaceDependency(oldNode, newNode)){
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||||
"Could not replace dependencies of an old node.");
|
"Could not replace dependencies of an old node.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,26 +151,26 @@ namespace triagens {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// make operations on sharded collections use distribute
|
// make operations on sharded collections use distribute
|
||||||
distributeInCluster_pass10 = 1000,
|
distributeInCluster_pass10 = 1000,
|
||||||
|
|
||||||
// make operations on sharded collections use scatter / gather / remote
|
// make operations on sharded collections use scatter / gather / remote
|
||||||
scatterInCluster_pass10 = 1010,
|
scatterInCluster_pass10 = 1010,
|
||||||
|
|
||||||
// move FilterNodes & Calculation nodes inbetween
|
// move FilterNodes & Calculation nodes inbetween
|
||||||
// scatter(remote) <-> gather(remote) so they're
|
// scatter(remote) <-> gather(remote) so they're
|
||||||
// distributed to the cluster nodes.
|
// distributed to the cluster nodes.
|
||||||
distributeFilternCalcToCluster_pass10 = 1020,
|
distributeFilternCalcToCluster_pass10 = 1020,
|
||||||
|
|
||||||
// move SortNodes into the distribution.
|
// move SortNodes into the distribution.
|
||||||
// adjust gathernode to also contain the sort criterions.
|
// adjust gathernode to also contain the sort criterions.
|
||||||
distributeSortToCluster_pass10 = 1030,
|
distributeSortToCluster_pass10 = 1030,
|
||||||
|
|
||||||
// try to get rid of a RemoteNode->ScatterNode combination which has
|
// try to get rid of a RemoteNode->ScatterNode combination which has
|
||||||
// only a SingletonNode and possibly some CalculationNodes as dependencies
|
// only a SingletonNode and possibly some CalculationNodes as dependencies
|
||||||
removeUnnecessaryRemoteScatter_pass10 = 1040,
|
removeUnnecessaryRemoteScatter_pass10 = 1040,
|
||||||
|
|
||||||
//recognise that a RemoveNode can be moved to the shards
|
//recognise that a RemoveNode can be moved to the shards
|
||||||
undistributeRemoveAfterEnumColl_pass10 = 1050
|
undistributeRemoveAfterEnumColl_pass10 = 1050
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -196,7 +196,7 @@ namespace triagens {
|
||||||
struct Rule {
|
struct Rule {
|
||||||
std::string name;
|
std::string name;
|
||||||
RuleFunction func;
|
RuleFunction func;
|
||||||
RuleLevel level;
|
RuleLevel const level;
|
||||||
bool const canBeDisabled;
|
bool const canBeDisabled;
|
||||||
|
|
||||||
Rule () = delete;
|
Rule () = delete;
|
||||||
|
@ -346,12 +346,19 @@ namespace triagens {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- constructors / destructors
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief constructor, this will initialize the rules database
|
/// @brief constructor, this will initialize the rules database
|
||||||
|
/// the .cpp file includes Aql/OptimizerRules.h
|
||||||
|
/// and add all methods there to the rules database
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Optimizer (size_t); // the .cpp file includes Aql/OptimizerRules.h
|
explicit Optimizer (size_t);
|
||||||
// and add all methods there to the rules database
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief destructor
|
/// @brief destructor
|
||||||
|
@ -360,6 +367,12 @@ namespace triagens {
|
||||||
~Optimizer () {
|
~Optimizer () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- public methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief do the optimization, this does the optimization, the resulting
|
/// @brief do the optimization, this does the optimization, the resulting
|
||||||
/// plans are all estimated, sorted by that estimate and can then be got
|
/// plans are all estimated, sorted by that estimate and can then be got
|
||||||
|
@ -440,6 +453,21 @@ namespace triagens {
|
||||||
|
|
||||||
static std::vector<std::string> translateRules (std::vector<int> const&);
|
static std::vector<std::string> translateRules (std::vector<int> const&);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief returns the previous rule (sorted by rule levels)
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static RuleLevel previousRule (RuleLevel level) {
|
||||||
|
auto it = _rules.find(level);
|
||||||
|
if (it == _rules.begin()) {
|
||||||
|
// already at start
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
--it;
|
||||||
|
return (*it).second.level;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- private methods
|
// --SECTION-- private methods
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -1054,7 +1054,10 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
|
||||||
node->collection(), node->outVariable(), idx, rangeInfo, false);
|
node->collection(), node->outVariable(), idx, rangeInfo, false);
|
||||||
newPlan->registerNode(newNode);
|
newPlan->registerNode(newNode);
|
||||||
newPlan->replaceNode(newPlan->getNodeById(node->id()), newNode);
|
newPlan->replaceNode(newPlan->getNodeById(node->id()), newNode);
|
||||||
_opt->addPlan(newPlan, _level, true);
|
// re-inject the new plan with the previous rule so it gets passed through
|
||||||
|
// use-index-range optimization again
|
||||||
|
// this allows to enable even more indexes
|
||||||
|
_opt->addPlan(newPlan, Optimizer::previousRule(_level), true);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
delete newPlan;
|
delete newPlan;
|
||||||
|
|
Loading…
Reference in New Issue