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

@ -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.");
} }

View File

@ -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
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -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;