mirror of https://github.com/citusdata/citus.git
Use cached comparator in ShardIntervalsOverlap().
By far the most expensive part of ShardIntervalsOverlap() is computing the function to use to determine overlap. Luckily we already have that computed and cached. The plan time for the query in issue #607 goes from 8764 ms to 2889 ms with this change.pull/1938/head
parent
51aca7a80c
commit
1e07a94435
|
@ -3601,17 +3601,16 @@ FragmentInterval(RangeTableFragment *fragment)
|
|||
bool
|
||||
ShardIntervalsOverlap(ShardInterval *firstInterval, ShardInterval *secondInterval)
|
||||
{
|
||||
Oid typeId = InvalidOid;
|
||||
FmgrInfo *comparisonFunction = NULL;
|
||||
bool nonOverlap = false;
|
||||
DistTableCacheEntry *intervalRelation =
|
||||
DistributedTableCacheEntry(firstInterval->relationId);
|
||||
FmgrInfo *comparisonFunction = intervalRelation->shardIntervalCompareFunction;
|
||||
|
||||
Datum firstMin = 0;
|
||||
Datum firstMax = 0;
|
||||
Datum secondMin = 0;
|
||||
Datum secondMax = 0;
|
||||
|
||||
typeId = firstInterval->valueTypeId;
|
||||
comparisonFunction = GetFunctionInfo(typeId, BTREE_AM_OID, BTORDER_PROC);
|
||||
|
||||
firstMin = firstInterval->minValue;
|
||||
firstMax = firstInterval->maxValue;
|
||||
|
|
Loading…
Reference in New Issue