mirror of https://gitee.com/bigwinds/arangodb
Cost estimates: IndexRangeNodes without range have to be more expensive than ones with.
This commit is contained in:
parent
4b41b449f5
commit
02207d5f70
|
@ -638,6 +638,7 @@ double IndexRangeNode::estimateCost () {
|
|||
_dependencies.at(0)->getCost();
|
||||
|
||||
double cost = 1;
|
||||
size_t count = 0;
|
||||
|
||||
if (_index->_type == TRI_IDX_TYPE_HASH_INDEX) {
|
||||
return oldCost / 1000;
|
||||
|
@ -648,17 +649,24 @@ double IndexRangeNode::estimateCost () {
|
|||
if (x.is1ValueRangeInfo()) {
|
||||
if (!_index->_unique) {
|
||||
cost *= oldCost / 100;
|
||||
count ++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cost *= oldCost / 10;
|
||||
count ++;
|
||||
}
|
||||
}
|
||||
else if (!(x._low._undefined && x._high._undefined)){
|
||||
cost *= oldCost / 2;
|
||||
count ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count == 0) {
|
||||
// no ranges? so this is unlimited -> has to be more expensive
|
||||
cost *= oldCost;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,13 +70,13 @@ int triagens::aql::removeRedundantSorts (Optimizer* opt,
|
|||
auto other = static_cast<SortNode*>(current)->getSortInformation(plan);
|
||||
|
||||
switch (sortInfo.isCoveredBy(other)) {
|
||||
case triagens::aql::SortInformation::unequal:
|
||||
case SortInformation::unequal:
|
||||
break;
|
||||
case triagens::aql::SortInformation::otherSupersedes:
|
||||
case SortInformation::otherSupersedes:
|
||||
toUnlink.insert(current);
|
||||
break;
|
||||
case triagens::aql::SortInformation::weSupersede:
|
||||
case triagens::aql::SortInformation::allEqual:
|
||||
case SortInformation::weSupersede:
|
||||
case SortInformation::allEqual:
|
||||
// the sort at the start of the pipeline makes the sort at the end
|
||||
// superfluous, so we'll remove it
|
||||
toUnlink.insert(n);
|
||||
|
|
Loading…
Reference in New Issue