mirror of https://github.com/citusdata/citus.git
Use stricter qual for pruning if both >/< and >=/<= are present.
Previously, if both =< and < (>= and < respectively) were specified, we always used the latter restriction. Instead use the stricter one.support-6.1-faster-pruning
parent
bb456d4002
commit
7a0f02f186
|
@ -1157,11 +1157,21 @@ PruneWithBoundaries(DistTableCacheEntry *cacheEntry, ClauseWalkerContext *contex
|
||||||
hasLowerBound = true;
|
hasLowerBound = true;
|
||||||
}
|
}
|
||||||
if (prune->greaterConsts)
|
if (prune->greaterConsts)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Use the more restrictive one, if both greater and greaterEqual
|
||||||
|
* constraints are specified.
|
||||||
|
*/
|
||||||
|
if (!hasLowerBound ||
|
||||||
|
PerformValueCompare(compareFunctionCall,
|
||||||
|
prune->greaterConsts->constvalue,
|
||||||
|
lowerBound) >= 0)
|
||||||
{
|
{
|
||||||
lowerBound = prune->greaterConsts->constvalue;
|
lowerBound = prune->greaterConsts->constvalue;
|
||||||
lowerBoundInclusive = false;
|
lowerBoundInclusive = false;
|
||||||
hasLowerBound = true;
|
hasLowerBound = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (prune->lessEqualConsts)
|
if (prune->lessEqualConsts)
|
||||||
{
|
{
|
||||||
upperBound = prune->lessEqualConsts->constvalue;
|
upperBound = prune->lessEqualConsts->constvalue;
|
||||||
|
@ -1169,11 +1179,21 @@ PruneWithBoundaries(DistTableCacheEntry *cacheEntry, ClauseWalkerContext *contex
|
||||||
hasUpperBound = true;
|
hasUpperBound = true;
|
||||||
}
|
}
|
||||||
if (prune->lessConsts)
|
if (prune->lessConsts)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Use the more restrictive one, if both less and lessEqual
|
||||||
|
* constraints are specified.
|
||||||
|
*/
|
||||||
|
if (!hasUpperBound ||
|
||||||
|
PerformValueCompare(compareFunctionCall,
|
||||||
|
prune->lessConsts->constvalue,
|
||||||
|
upperBound) <= 0)
|
||||||
{
|
{
|
||||||
upperBound = prune->lessConsts->constvalue;
|
upperBound = prune->lessConsts->constvalue;
|
||||||
upperBoundInclusive = false;
|
upperBoundInclusive = false;
|
||||||
hasUpperBound = true;
|
hasUpperBound = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Assert(hasLowerBound || hasUpperBound);
|
Assert(hasLowerBound || hasUpperBound);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue