1
0
Fork 0

enable more indexes

This commit is contained in:
Jan Steemann 2014-11-26 19:49:28 +01:00 committed by Frank Celler
parent cb57738d1d
commit a1f812b28b
3 changed files with 43 additions and 12 deletions

View File

@ -1149,7 +1149,7 @@ void ExecutionPlan::replaceNode (ExecutionNode* oldNode,
std::vector<ExecutionNode*> deps = oldNode->getDependencies();
// Intentional copy
for (auto* x : deps) {
newNode->addDependency(x);
oldNode->removeDependency(x);
@ -1157,7 +1157,7 @@ void ExecutionPlan::replaceNode (ExecutionNode* oldNode,
auto oldNodeParents = oldNode->getParents(); // Intentional copy
for (auto* oldNodeParent : oldNodeParents) {
if(! oldNodeParent->replaceDependency(oldNode, newNode)){
if (! oldNodeParent->replaceDependency(oldNode, newNode)){
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
"Could not replace dependencies of an old node.");
}

View File

@ -151,26 +151,26 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////
// make operations on sharded collections use distribute
distributeInCluster_pass10 = 1000,
distributeInCluster_pass10 = 1000,
// make operations on sharded collections use scatter / gather / remote
scatterInCluster_pass10 = 1010,
scatterInCluster_pass10 = 1010,
// move FilterNodes & Calculation nodes inbetween
// scatter(remote) <-> gather(remote) so they're
// distributed to the cluster nodes.
distributeFilternCalcToCluster_pass10 = 1020,
distributeFilternCalcToCluster_pass10 = 1020,
// move SortNodes into the distribution.
// 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
// 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
undistributeRemoveAfterEnumColl_pass10 = 1050
undistributeRemoveAfterEnumColl_pass10 = 1050
};
public:
@ -196,7 +196,7 @@ namespace triagens {
struct Rule {
std::string name;
RuleFunction func;
RuleLevel level;
RuleLevel const level;
bool const canBeDisabled;
Rule () = delete;
@ -346,12 +346,19 @@ namespace triagens {
};
// -----------------------------------------------------------------------------
// --SECTION-- constructors / destructors
// -----------------------------------------------------------------------------
public:
////////////////////////////////////////////////////////////////////////////////
/// @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
// and add all methods there to the rules database
explicit Optimizer (size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief destructor
@ -360,6 +367,12 @@ namespace triagens {
~Optimizer () {
}
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief do the optimization, this does the optimization, the resulting
/// 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&);
////////////////////////////////////////////////////////////////////////////////
/// @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
// -----------------------------------------------------------------------------

View File

@ -1054,7 +1054,10 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
node->collection(), node->outVariable(), idx, rangeInfo, false);
newPlan->registerNode(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 (...) {
delete newPlan;