1
0
Fork 0

do not prefer primary indexes in that many situations

This commit is contained in:
Jan Steemann 2016-11-03 17:40:17 +01:00
parent e58080eb1b
commit 9f101ae20f
1 changed files with 9 additions and 2 deletions

View File

@ -65,8 +65,15 @@ bool SimpleAttributeEqualityMatcher::matchOne(
// we can use the index
// use slightly different cost calculation for IN than for EQ
calculateIndexCosts(index, itemsInIndex, estimatedItems, estimatedCost);
estimatedItems *= op->getMember(1)->numMembers();
estimatedCost *= op->getMember(1)->numMembers();
size_t values = 1;
auto m = op->getMember(1);
if (m->isArray() && m->numMembers() > 1) {
// attr IN [ a, b, c ] => this will produce multiple items, so count
// them!
values = m->numMembers();
}
estimatedItems *= values;
estimatedCost *= values;
return true;
}
}