mirror of https://github.com/citusdata/citus.git
Merge pull request #5359 from citusdata/marcocitus/remove-append-3
commit
9571311c65
|
@ -1020,7 +1020,7 @@ SinglePartitionJoin(JoinOrderNode *currentJoinNode, TableEntry *candidateTable,
|
||||||
currentPartitionMethod,
|
currentPartitionMethod,
|
||||||
currentAnchorTable);
|
currentAnchorTable);
|
||||||
}
|
}
|
||||||
else
|
else if (candidatePartitionMethod == DISTRIBUTE_BY_RANGE)
|
||||||
{
|
{
|
||||||
return MakeJoinOrderNode(candidateTable, SINGLE_RANGE_PARTITION_JOIN,
|
return MakeJoinOrderNode(candidateTable, SINGLE_RANGE_PARTITION_JOIN,
|
||||||
currentPartitionColumnList,
|
currentPartitionColumnList,
|
||||||
|
@ -1059,7 +1059,7 @@ SinglePartitionJoin(JoinOrderNode *currentJoinNode, TableEntry *candidateTable,
|
||||||
candidatePartitionMethod,
|
candidatePartitionMethod,
|
||||||
candidateTable);
|
candidateTable);
|
||||||
}
|
}
|
||||||
else
|
else if (currentPartitionMethod == DISTRIBUTE_BY_RANGE)
|
||||||
{
|
{
|
||||||
return MakeJoinOrderNode(candidateTable,
|
return MakeJoinOrderNode(candidateTable,
|
||||||
SINGLE_RANGE_PARTITION_JOIN,
|
SINGLE_RANGE_PARTITION_JOIN,
|
||||||
|
|
|
@ -234,6 +234,12 @@ TargetListOnPartitionColumn(Query *query, List *targetEntryList)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* append-distributed tables do not have a strict partition column */
|
||||||
|
if (IsCitusTableType(relationId, APPEND_DISTRIBUTED))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (isPartitionColumn)
|
if (isPartitionColumn)
|
||||||
{
|
{
|
||||||
FieldSelect *compositeField = CompositeFieldRecursive(targetExpression,
|
FieldSelect *compositeField = CompositeFieldRecursive(targetExpression,
|
||||||
|
|
|
@ -171,10 +171,6 @@ static Task * QueryPushdownTaskCreate(Query *originalQuery, int shardIndex,
|
||||||
TaskType taskType,
|
TaskType taskType,
|
||||||
bool modifyRequiresCoordinatorEvaluation,
|
bool modifyRequiresCoordinatorEvaluation,
|
||||||
DeferredErrorMessage **planningError);
|
DeferredErrorMessage **planningError);
|
||||||
static bool ShardIntervalsEqual(FmgrInfo *comparisonFunction,
|
|
||||||
Oid collation,
|
|
||||||
ShardInterval *firstInterval,
|
|
||||||
ShardInterval *secondInterval);
|
|
||||||
static List * SqlTaskList(Job *job);
|
static List * SqlTaskList(Job *job);
|
||||||
static bool DependsOnHashPartitionJob(Job *job);
|
static bool DependsOnHashPartitionJob(Job *job);
|
||||||
static uint32 AnchorRangeTableId(List *rangeTableList);
|
static uint32 AnchorRangeTableId(List *rangeTableList);
|
||||||
|
@ -228,8 +224,6 @@ static List * MergeTaskList(MapMergeJob *mapMergeJob, List *mapTaskList,
|
||||||
uint32 taskIdIndex);
|
uint32 taskIdIndex);
|
||||||
static StringInfo ColumnNameArrayString(uint32 columnCount, uint64 generatingJobId);
|
static StringInfo ColumnNameArrayString(uint32 columnCount, uint64 generatingJobId);
|
||||||
static StringInfo ColumnTypeArrayString(List *targetEntryList);
|
static StringInfo ColumnTypeArrayString(List *targetEntryList);
|
||||||
static bool CoPlacedShardIntervals(ShardInterval *firstInterval,
|
|
||||||
ShardInterval *secondInterval);
|
|
||||||
|
|
||||||
static List * FetchEqualityAttrNumsForRTEOpExpr(OpExpr *opExpr);
|
static List * FetchEqualityAttrNumsForRTEOpExpr(OpExpr *opExpr);
|
||||||
static List * FetchEqualityAttrNumsForRTEBoolExpr(BoolExpr *boolExpr);
|
static List * FetchEqualityAttrNumsForRTEBoolExpr(BoolExpr *boolExpr);
|
||||||
|
@ -2451,16 +2445,6 @@ ErrorIfUnsupportedShardDistribution(Query *query)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CitusTableCacheEntry *distTableEntry = GetCitusTableCacheEntry(relationId);
|
|
||||||
if (distTableEntry->hasOverlappingShardInterval)
|
|
||||||
{
|
|
||||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
|
||||||
errmsg("cannot push down this subquery"),
|
|
||||||
errdetail("Currently append partitioned relations "
|
|
||||||
"with overlapping shard intervals are "
|
|
||||||
"not supported")));
|
|
||||||
}
|
|
||||||
|
|
||||||
appendDistributedRelationCount++;
|
appendDistributedRelationCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2648,56 +2632,24 @@ QueryPushdownTaskCreate(Query *originalQuery, int shardIndex,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CoPartitionedTables checks if given two distributed tables have 1-to-1 shard
|
* CoPartitionedTables checks if given two distributed tables are co-located.
|
||||||
* placement matching. It first checks for the shard count, if tables don't have
|
|
||||||
* same amount shard then it returns false. Note that, if any table does not
|
|
||||||
* have any shard, it returns true. If two tables have same amount of shards,
|
|
||||||
* we check colocationIds for hash distributed tables and shardInterval's min
|
|
||||||
* max values for append and range distributed tables.
|
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
CoPartitionedTables(Oid firstRelationId, Oid secondRelationId)
|
CoPartitionedTables(Oid firstRelationId, Oid secondRelationId)
|
||||||
{
|
{
|
||||||
if (firstRelationId == secondRelationId)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CitusTableCacheEntry *firstTableCache = GetCitusTableCacheEntry(firstRelationId);
|
CitusTableCacheEntry *firstTableCache = GetCitusTableCacheEntry(firstRelationId);
|
||||||
CitusTableCacheEntry *secondTableCache = GetCitusTableCacheEntry(secondRelationId);
|
CitusTableCacheEntry *secondTableCache = GetCitusTableCacheEntry(secondRelationId);
|
||||||
|
|
||||||
ShardInterval **sortedFirstIntervalArray = firstTableCache->sortedShardIntervalArray;
|
if (firstTableCache->partitionMethod == DISTRIBUTE_BY_APPEND ||
|
||||||
ShardInterval **sortedSecondIntervalArray =
|
secondTableCache->partitionMethod == DISTRIBUTE_BY_APPEND)
|
||||||
secondTableCache->sortedShardIntervalArray;
|
|
||||||
uint32 firstListShardCount = firstTableCache->shardIntervalArrayLength;
|
|
||||||
uint32 secondListShardCount = secondTableCache->shardIntervalArrayLength;
|
|
||||||
FmgrInfo *comparisonFunction = firstTableCache->shardIntervalCompareFunction;
|
|
||||||
|
|
||||||
/* reference tables are always & only copartitioned with reference tables */
|
|
||||||
if (IsCitusTableTypeCacheEntry(firstTableCache, CITUS_TABLE_WITH_NO_DIST_KEY) &&
|
|
||||||
IsCitusTableTypeCacheEntry(secondTableCache, CITUS_TABLE_WITH_NO_DIST_KEY))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (IsCitusTableTypeCacheEntry(firstTableCache, CITUS_TABLE_WITH_NO_DIST_KEY) ||
|
|
||||||
IsCitusTableTypeCacheEntry(secondTableCache, CITUS_TABLE_WITH_NO_DIST_KEY))
|
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Append-distributed tables can have overlapping shards. Therefore they are
|
||||||
|
* never co-partitioned, not even with themselves.
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstListShardCount != secondListShardCount)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if there are not any shards just return true */
|
|
||||||
if (firstListShardCount == 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert(comparisonFunction != NULL);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the tables have the same colocation ID - if so, we know
|
* Check if the tables have the same colocation ID - if so, we know
|
||||||
* they're colocated.
|
* they're colocated.
|
||||||
|
@ -2708,130 +2660,16 @@ CoPartitionedTables(Oid firstRelationId, Oid secondRelationId)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (firstRelationId == secondRelationId)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* For hash distributed tables two tables are accepted as colocated only if
|
* Even without an explicit co-location ID, non-append tables can be considered
|
||||||
* they have the same colocationId. Otherwise they may have same minimum and
|
* co-located with themselves.
|
||||||
* maximum values for each shard interval, yet hash function may result with
|
|
||||||
* different values for the same value. int vs bigint can be given as an
|
|
||||||
* example.
|
|
||||||
*/
|
*/
|
||||||
if (IsCitusTableTypeCacheEntry(firstTableCache, HASH_DISTRIBUTED) ||
|
|
||||||
IsCitusTableTypeCacheEntry(secondTableCache, HASH_DISTRIBUTED))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Don't compare unequal types
|
|
||||||
*/
|
|
||||||
Oid collation = firstTableCache->partitionColumn->varcollid;
|
|
||||||
if (firstTableCache->partitionColumn->vartype !=
|
|
||||||
secondTableCache->partitionColumn->vartype ||
|
|
||||||
collation != secondTableCache->partitionColumn->varcollid)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If not known to be colocated check if the remaining shards are
|
|
||||||
* anyway. Do so by comparing the shard interval arrays that are sorted on
|
|
||||||
* interval minimum values. Then it compares every shard interval in order
|
|
||||||
* and if any pair of shard intervals are not equal or they are not located
|
|
||||||
* in the same node it returns false.
|
|
||||||
*/
|
|
||||||
for (uint32 intervalIndex = 0; intervalIndex < firstListShardCount; intervalIndex++)
|
|
||||||
{
|
|
||||||
ShardInterval *firstInterval = sortedFirstIntervalArray[intervalIndex];
|
|
||||||
ShardInterval *secondInterval = sortedSecondIntervalArray[intervalIndex];
|
|
||||||
|
|
||||||
bool shardIntervalsEqual = ShardIntervalsEqual(comparisonFunction,
|
|
||||||
collation,
|
|
||||||
firstInterval,
|
|
||||||
secondInterval);
|
|
||||||
if (!shardIntervalsEqual || !CoPlacedShardIntervals(firstInterval,
|
|
||||||
secondInterval))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CoPlacedShardIntervals checks whether the given intervals located in the same nodes.
|
|
||||||
*/
|
|
||||||
static bool
|
|
||||||
CoPlacedShardIntervals(ShardInterval *firstInterval, ShardInterval *secondInterval)
|
|
||||||
{
|
|
||||||
List *firstShardPlacementList = ShardPlacementListWithoutOrphanedPlacements(
|
|
||||||
firstInterval->shardId);
|
|
||||||
List *secondShardPlacementList = ShardPlacementListWithoutOrphanedPlacements(
|
|
||||||
secondInterval->shardId);
|
|
||||||
ListCell *firstShardPlacementCell = NULL;
|
|
||||||
ListCell *secondShardPlacementCell = NULL;
|
|
||||||
|
|
||||||
/* Shards must have same number of placements */
|
|
||||||
if (list_length(firstShardPlacementList) != list_length(secondShardPlacementList))
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
firstShardPlacementList = SortList(firstShardPlacementList, CompareShardPlacements);
|
|
||||||
secondShardPlacementList = SortList(secondShardPlacementList, CompareShardPlacements);
|
|
||||||
|
|
||||||
forboth(firstShardPlacementCell, firstShardPlacementList, secondShardPlacementCell,
|
|
||||||
secondShardPlacementList)
|
|
||||||
{
|
|
||||||
ShardPlacement *firstShardPlacement = (ShardPlacement *) lfirst(
|
|
||||||
firstShardPlacementCell);
|
|
||||||
ShardPlacement *secondShardPlacement = (ShardPlacement *) lfirst(
|
|
||||||
secondShardPlacementCell);
|
|
||||||
|
|
||||||
if (firstShardPlacement->nodeId != secondShardPlacement->nodeId)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ShardIntervalsEqual checks if given shard intervals have equal min/max values.
|
|
||||||
*/
|
|
||||||
static bool
|
|
||||||
ShardIntervalsEqual(FmgrInfo *comparisonFunction, Oid collation,
|
|
||||||
ShardInterval *firstInterval, ShardInterval *secondInterval)
|
|
||||||
{
|
|
||||||
bool shardIntervalsEqual = false;
|
|
||||||
|
|
||||||
Datum firstMin = firstInterval->minValue;
|
|
||||||
Datum firstMax = firstInterval->maxValue;
|
|
||||||
Datum secondMin = secondInterval->minValue;
|
|
||||||
Datum secondMax = secondInterval->maxValue;
|
|
||||||
|
|
||||||
if (firstInterval->minValueExists && firstInterval->maxValueExists &&
|
|
||||||
secondInterval->minValueExists && secondInterval->maxValueExists)
|
|
||||||
{
|
|
||||||
Datum minDatum = FunctionCall2Coll(comparisonFunction, collation, firstMin,
|
|
||||||
secondMin);
|
|
||||||
Datum maxDatum = FunctionCall2Coll(comparisonFunction, collation, firstMax,
|
|
||||||
secondMax);
|
|
||||||
int firstComparison = DatumGetInt32(minDatum);
|
|
||||||
int secondComparison = DatumGetInt32(maxDatum);
|
|
||||||
|
|
||||||
if (firstComparison == 0 && secondComparison == 0)
|
|
||||||
{
|
|
||||||
shardIntervalsEqual = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return shardIntervalsEqual;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ typedef struct AttributeEquivalenceClassMember
|
||||||
|
|
||||||
|
|
||||||
static bool ContextContainsLocalRelation(RelationRestrictionContext *restrictionContext);
|
static bool ContextContainsLocalRelation(RelationRestrictionContext *restrictionContext);
|
||||||
|
static bool ContextContainsAppendRelation(RelationRestrictionContext *restrictionContext);
|
||||||
static int RangeTableOffsetCompat(PlannerInfo *root, AppendRelInfo *appendRelInfo);
|
static int RangeTableOffsetCompat(PlannerInfo *root, AppendRelInfo *appendRelInfo);
|
||||||
static Var * FindUnionAllVar(PlannerInfo *root, List *translatedVars, Oid relationOid,
|
static Var * FindUnionAllVar(PlannerInfo *root, List *translatedVars, Oid relationOid,
|
||||||
Index relationRteIndex, Index *partitionKeyIndex);
|
Index relationRteIndex, Index *partitionKeyIndex);
|
||||||
|
@ -236,6 +237,29 @@ ContextContainsLocalRelation(RelationRestrictionContext *restrictionContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ContextContainsAppendRelation determines whether the given
|
||||||
|
* RelationRestrictionContext contains any append-distributed tables.
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
|
ContextContainsAppendRelation(RelationRestrictionContext *restrictionContext)
|
||||||
|
{
|
||||||
|
ListCell *relationRestrictionCell = NULL;
|
||||||
|
|
||||||
|
foreach(relationRestrictionCell, restrictionContext->relationRestrictionList)
|
||||||
|
{
|
||||||
|
RelationRestriction *relationRestriction = lfirst(relationRestrictionCell);
|
||||||
|
|
||||||
|
if (IsCitusTableType(relationRestriction->relationId, APPEND_DISTRIBUTED))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SafeToPushdownUnionSubquery returns true if all the relations are returns
|
* SafeToPushdownUnionSubquery returns true if all the relations are returns
|
||||||
* partition keys in the same ordinal position and there is no reference table
|
* partition keys in the same ordinal position and there is no reference table
|
||||||
|
@ -504,6 +528,12 @@ RestrictionEquivalenceForPartitionKeys(PlannerRestrictionContext *restrictionCon
|
||||||
/* there is a single distributed relation, no need to continue */
|
/* there is a single distributed relation, no need to continue */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (ContextContainsAppendRelation(
|
||||||
|
restrictionContext->relationRestrictionContext))
|
||||||
|
{
|
||||||
|
/* we never consider append-distributed tables co-located */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
List *attributeEquivalenceList = GenerateAllAttributeEquivalences(restrictionContext);
|
List *attributeEquivalenceList = GenerateAllAttributeEquivalences(restrictionContext);
|
||||||
|
|
||||||
|
@ -1906,6 +1936,17 @@ AllRelationsInRestrictionContextColocated(RelationRestrictionContext *restrictio
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsCitusTableType(relationId, APPEND_DISTRIBUTED))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* If we got to this point, it means there are multiple distributed
|
||||||
|
* relations and at least one of them is append-distributed. Since
|
||||||
|
* we do not consider append-distributed tables to be co-located,
|
||||||
|
* we can immediately return false.
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int colocationId = TableColocationId(relationId);
|
int colocationId = TableColocationId(relationId);
|
||||||
|
|
||||||
if (initialColocationId == INVALID_COLOCATION_ID)
|
if (initialColocationId == INVALID_COLOCATION_ID)
|
||||||
|
|
|
@ -324,6 +324,9 @@ SELECT create_distributed_table('range2', 'id', 'range');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
CALL public.create_range_partitioned_shards('range2', '{0,3}','{2,5}');
|
CALL public.create_range_partitioned_shards('range2', '{0,3}','{2,5}');
|
||||||
|
-- Mark tables co-located
|
||||||
|
UPDATE pg_dist_partition SET colocationid = 30001
|
||||||
|
WHERE logicalrelid = 'range1'::regclass OR logicalrelid = 'range2'::regclass;
|
||||||
-- Move shard placement and DON'T clean it up, now range1 and range2 are
|
-- Move shard placement and DON'T clean it up, now range1 and range2 are
|
||||||
-- colocated, but only range2 has an orphaned shard.
|
-- colocated, but only range2 has an orphaned shard.
|
||||||
SELECT citus_move_shard_placement(92448600, 'localhost', :worker_2_port, 'localhost', :worker_1_port, 'block_writes');
|
SELECT citus_move_shard_placement(92448600, 'localhost', :worker_2_port, 'localhost', :worker_1_port, 'block_writes');
|
||||||
|
@ -339,7 +342,7 @@ SELECT shardid, shardstate, nodeport FROM pg_dist_shard_placement WHERE shardid
|
||||||
92448600 | 1 | 57637
|
92448600 | 1 | 57637
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
-- Make sure that tables are detected as colocated
|
-- Make sure co-located join works
|
||||||
SELECT * FROM range1 JOIN range2 ON range1.id = range2.id;
|
SELECT * FROM range1 JOIN range2 ON range1.id = range2.id;
|
||||||
id | id
|
id | id
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
|
@ -1070,11 +1070,14 @@ Aggregate
|
||||||
Task Count: 4
|
Task Count: 4
|
||||||
Tasks Shown: None, not supported for re-partition queries
|
Tasks Shown: None, not supported for re-partition queries
|
||||||
-> MapMergeJob
|
-> MapMergeJob
|
||||||
Map Task Count: 1
|
Map Task Count: 4
|
||||||
Merge Task Count: 4
|
Merge Task Count: 4
|
||||||
-> MapMergeJob
|
-> MapMergeJob
|
||||||
Map Task Count: 2
|
Map Task Count: 2
|
||||||
Merge Task Count: 1
|
Merge Task Count: 4
|
||||||
|
-> MapMergeJob
|
||||||
|
Map Task Count: 1
|
||||||
|
Merge Task Count: 4
|
||||||
-> MapMergeJob
|
-> MapMergeJob
|
||||||
Map Task Count: 1
|
Map Task Count: 1
|
||||||
Merge Task Count: 4
|
Merge Task Count: 4
|
||||||
|
@ -1102,12 +1105,16 @@ EXPLAIN (COSTS FALSE, FORMAT JSON)
|
||||||
"Tasks Shown": "None, not supported for re-partition queries",
|
"Tasks Shown": "None, not supported for re-partition queries",
|
||||||
"Dependent Jobs": [
|
"Dependent Jobs": [
|
||||||
{
|
{
|
||||||
"Map Task Count": 1,
|
"Map Task Count": 4,
|
||||||
"Merge Task Count": 4,
|
"Merge Task Count": 4,
|
||||||
"Dependent Jobs": [
|
"Dependent Jobs": [
|
||||||
{
|
{
|
||||||
"Map Task Count": 2,
|
"Map Task Count": 2,
|
||||||
"Merge Task Count": 1
|
"Merge Task Count": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Map Task Count": 1,
|
||||||
|
"Merge Task Count": 4
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -1154,12 +1161,16 @@ EXPLAIN (COSTS FALSE, FORMAT XML)
|
||||||
<Tasks-Shown>None, not supported for re-partition queries</Tasks-Shown>
|
<Tasks-Shown>None, not supported for re-partition queries</Tasks-Shown>
|
||||||
<Dependent-Jobs>
|
<Dependent-Jobs>
|
||||||
<MapMergeJob>
|
<MapMergeJob>
|
||||||
<Map-Task-Count>1</Map-Task-Count>
|
<Map-Task-Count>4</Map-Task-Count>
|
||||||
<Merge-Task-Count>4</Merge-Task-Count>
|
<Merge-Task-Count>4</Merge-Task-Count>
|
||||||
<Dependent-Jobs>
|
<Dependent-Jobs>
|
||||||
<MapMergeJob>
|
<MapMergeJob>
|
||||||
<Map-Task-Count>2</Map-Task-Count>
|
<Map-Task-Count>2</Map-Task-Count>
|
||||||
<Merge-Task-Count>1</Merge-Task-Count>
|
<Merge-Task-Count>4</Merge-Task-Count>
|
||||||
|
</MapMergeJob>
|
||||||
|
<MapMergeJob>
|
||||||
|
<Map-Task-Count>1</Map-Task-Count>
|
||||||
|
<Merge-Task-Count>4</Merge-Task-Count>
|
||||||
</MapMergeJob>
|
</MapMergeJob>
|
||||||
</Dependent-Jobs>
|
</Dependent-Jobs>
|
||||||
</MapMergeJob>
|
</MapMergeJob>
|
||||||
|
|
|
@ -169,7 +169,7 @@ LOG: join order: [ "orders" ][ dual partition join "customer_hash" ]
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT count(*) FROM orders_hash, customer_append
|
SELECT count(*) FROM orders_hash, customer_append
|
||||||
WHERE c_custkey = o_custkey;
|
WHERE c_custkey = o_custkey;
|
||||||
LOG: join order: [ "orders_hash" ][ single range partition join "customer_append" ]
|
LOG: join order: [ "orders_hash" ][ dual partition join "customer_append" ]
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
|
|
|
@ -53,7 +53,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
revenue DESC,
|
revenue DESC,
|
||||||
o_orderdate;
|
o_orderdate;
|
||||||
LOG: join order: [ "orders" ][ local partition join "lineitem" ][ single range partition join "customer_append" ]
|
LOG: join order: [ "orders" ][ local partition join "lineitem" ][ dual partition join "customer_append" ]
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
|
@ -97,16 +97,14 @@ GROUP BY
|
||||||
c_comment
|
c_comment
|
||||||
ORDER BY
|
ORDER BY
|
||||||
revenue DESC;
|
revenue DESC;
|
||||||
LOG: join order: [ "orders" ][ local partition join "lineitem" ][ single range partition join "customer_append" ][ reference join "nation" ]
|
LOG: join order: [ "orders" ][ local partition join "lineitem" ][ dual partition join "customer_append" ][ reference join "nation" ]
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
Sort Key: (sum(remote_scan.revenue)) DESC
|
Sort Key: remote_scan.revenue DESC
|
||||||
-> HashAggregate
|
|
||||||
Group Key: remote_scan.c_custkey, remote_scan.c_name, remote_scan.c_acctbal, remote_scan.c_phone, remote_scan.n_name, remote_scan.c_address, remote_scan.c_comment
|
|
||||||
-> Custom Scan (Citus Adaptive)
|
-> Custom Scan (Citus Adaptive)
|
||||||
explain statements for distributed queries are not enabled
|
explain statements for distributed queries are not enabled
|
||||||
(6 rows)
|
(4 rows)
|
||||||
|
|
||||||
-- Query #19 from the TPC-H decision support benchmark (modified)
|
-- Query #19 from the TPC-H decision support benchmark (modified)
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
|
@ -139,7 +137,7 @@ WHERE
|
||||||
AND l_shipmode in ('AIR', 'AIR REG', 'TRUCK')
|
AND l_shipmode in ('AIR', 'AIR REG', 'TRUCK')
|
||||||
AND l_shipinstruct = 'DELIVER IN PERSON'
|
AND l_shipinstruct = 'DELIVER IN PERSON'
|
||||||
);
|
);
|
||||||
LOG: join order: [ "lineitem" ][ single range partition join "part_append" ]
|
LOG: join order: [ "lineitem" ][ dual partition join "part_append" ]
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
|
@ -159,7 +157,7 @@ WHERE
|
||||||
c_custkey = o_custkey
|
c_custkey = o_custkey
|
||||||
GROUP BY
|
GROUP BY
|
||||||
l_partkey;
|
l_partkey;
|
||||||
LOG: join order: [ "lineitem" ][ local partition join "orders" ][ single range partition join "part_append" ][ single range partition join "customer_append" ]
|
LOG: join order: [ "lineitem" ][ local partition join "orders" ][ dual partition join "part_append" ][ dual partition join "customer_append" ]
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
HashAggregate
|
HashAggregate
|
||||||
|
|
|
@ -101,7 +101,7 @@ EXPLAIN (COSTS OFF)
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
FROM array_partitioned_table table1, array_partitioned_table table2
|
FROM array_partitioned_table table1, array_partitioned_table table2
|
||||||
WHERE table1.array_column = table2.array_column;
|
WHERE table1.array_column = table2.array_column;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
DEBUG: join prunable for intervals [{},{AZZXSP27F21T6,AZZXSP27F21T6}] and [{BA1000U2AMO4ZGX,BZZXSP27F21T6},{CA1000U2AMO4ZGX,CZZXSP27F21T6}]
|
DEBUG: join prunable for intervals [{},{AZZXSP27F21T6,AZZXSP27F21T6}] and [{BA1000U2AMO4ZGX,BZZXSP27F21T6},{CA1000U2AMO4ZGX,CZZXSP27F21T6}]
|
||||||
DEBUG: join prunable for intervals [{BA1000U2AMO4ZGX,BZZXSP27F21T6},{CA1000U2AMO4ZGX,CZZXSP27F21T6}] and [{},{AZZXSP27F21T6,AZZXSP27F21T6}]
|
DEBUG: join prunable for intervals [{BA1000U2AMO4ZGX,BZZXSP27F21T6},{CA1000U2AMO4ZGX,CZZXSP27F21T6}] and [{},{AZZXSP27F21T6,AZZXSP27F21T6}]
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
|
@ -115,7 +115,7 @@ EXPLAIN (COSTS OFF)
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
FROM composite_partitioned_table table1, composite_partitioned_table table2
|
FROM composite_partitioned_table table1, composite_partitioned_table table2
|
||||||
WHERE table1.composite_column = table2.composite_column;
|
WHERE table1.composite_column = table2.composite_column;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
DEBUG: join prunable for intervals [(a,3,b),(b,4,c)] and [(c,5,d),(d,6,e)]
|
DEBUG: join prunable for intervals [(a,3,b),(b,4,c)] and [(c,5,d),(d,6,e)]
|
||||||
DEBUG: join prunable for intervals [(c,5,d),(d,6,e)] and [(a,3,b),(b,4,c)]
|
DEBUG: join prunable for intervals [(c,5,d),(d,6,e)] and [(a,3,b),(b,4,c)]
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
|
@ -130,7 +130,7 @@ EXPLAIN (COSTS OFF)
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
FROM varchar_partitioned_table table1, varchar_partitioned_table table2
|
FROM varchar_partitioned_table table1, varchar_partitioned_table table2
|
||||||
WHERE table1.varchar_column = table2.varchar_column;
|
WHERE table1.varchar_column = table2.varchar_column;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
DEBUG: join prunable for intervals [AA1000U2AMO4ZGX,AZZXSP27F21T6] and [BA1000U2AMO4ZGX,BZZXSP27F21T6]
|
DEBUG: join prunable for intervals [AA1000U2AMO4ZGX,AZZXSP27F21T6] and [BA1000U2AMO4ZGX,BZZXSP27F21T6]
|
||||||
DEBUG: join prunable for intervals [BA1000U2AMO4ZGX,BZZXSP27F21T6] and [AA1000U2AMO4ZGX,AZZXSP27F21T6]
|
DEBUG: join prunable for intervals [BA1000U2AMO4ZGX,BZZXSP27F21T6] and [AA1000U2AMO4ZGX,AZZXSP27F21T6]
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
|
|
|
@ -57,7 +57,7 @@ CREATE TABLE varchar_partitioned_table
|
||||||
(
|
(
|
||||||
varchar_column varchar(100)
|
varchar_column varchar(100)
|
||||||
);
|
);
|
||||||
SELECT create_distributed_table('varchar_partitioned_table', 'varchar_column', 'append');
|
SELECT create_distributed_table('varchar_partitioned_table', 'varchar_column', 'range');
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ CREATE TABLE array_partitioned_table
|
||||||
(
|
(
|
||||||
array_column text[]
|
array_column text[]
|
||||||
);
|
);
|
||||||
SELECT create_distributed_table('array_partitioned_table', 'array_column', 'append');
|
SELECT create_distributed_table('array_partitioned_table', 'array_column', 'range');
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ CREATE TABLE composite_partitioned_table
|
||||||
(
|
(
|
||||||
composite_column composite_type
|
composite_column composite_type
|
||||||
);
|
);
|
||||||
SELECT create_distributed_table('composite_partitioned_table', 'composite_column', 'append');
|
SELECT create_distributed_table('composite_partitioned_table', 'composite_column', 'range');
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -152,38 +152,35 @@ EXPLAIN (COSTS OFF)
|
||||||
SELECT count(*) FROM varchar_partitioned_table WHERE varchar_column = 'BA2';
|
SELECT count(*) FROM varchar_partitioned_table WHERE varchar_column = 'BA2';
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Aggregate
|
Custom Scan (Citus Adaptive)
|
||||||
-> Custom Scan (Citus Adaptive)
|
|
||||||
Task Count: 1
|
Task Count: 1
|
||||||
Tasks Shown: All
|
Tasks Shown: All
|
||||||
-> Task
|
-> Task
|
||||||
Error: Could not get remote plan.
|
Error: Could not get remote plan.
|
||||||
(6 rows)
|
(5 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT count(*) FROM array_partitioned_table
|
SELECT count(*) FROM array_partitioned_table
|
||||||
WHERE array_column > '{BA1000U2AMO4ZGX, BZZXSP27F21T6}';
|
WHERE array_column > '{BA1000U2AMO4ZGX, BZZXSP27F21T6}';
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Aggregate
|
Custom Scan (Citus Adaptive)
|
||||||
-> Custom Scan (Citus Adaptive)
|
|
||||||
Task Count: 1
|
Task Count: 1
|
||||||
Tasks Shown: All
|
Tasks Shown: All
|
||||||
-> Task
|
-> Task
|
||||||
Error: Could not get remote plan.
|
Error: Could not get remote plan.
|
||||||
(6 rows)
|
(5 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT count(*) FROM composite_partitioned_table
|
SELECT count(*) FROM composite_partitioned_table
|
||||||
WHERE composite_column < '(b,5,c)'::composite_type;
|
WHERE composite_column < '(b,5,c)'::composite_type;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Aggregate
|
Custom Scan (Citus Adaptive)
|
||||||
-> Custom Scan (Citus Adaptive)
|
|
||||||
Task Count: 1
|
Task Count: 1
|
||||||
Tasks Shown: All
|
Tasks Shown: All
|
||||||
-> Task
|
-> Task
|
||||||
Error: Could not get remote plan.
|
Error: Could not get remote plan.
|
||||||
(6 rows)
|
(5 rows)
|
||||||
|
|
||||||
SET client_min_messages TO NOTICE;
|
SET client_min_messages TO NOTICE;
|
||||||
|
|
|
@ -66,24 +66,62 @@ ORDER BY
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
DEBUG: join prunable for intervals [-2147483648,-1] and [0,2147483647]
|
DEBUG: join prunable for intervals [-2147483648,-1] and [0,2147483647]
|
||||||
DEBUG: join prunable for intervals [0,2147483647] and [-2147483648,-1]
|
DEBUG: join prunable for intervals [0,2147483647] and [-2147483648,-1]
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
DETAIL: Creating dependency on merge taskId 3
|
DETAIL: Creating dependency on merge taskId 3
|
||||||
DEBUG: pruning merge fetch taskId 3
|
DEBUG: pruning merge fetch taskId 2
|
||||||
|
DETAIL: Creating dependency on merge taskId 3
|
||||||
|
DEBUG: pruning merge fetch taskId 4
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [6001,7000]
|
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1001,2000]
|
|
||||||
DEBUG: pruning merge fetch taskId 1
|
|
||||||
DETAIL: Creating dependency on merge taskId 5
|
|
||||||
DEBUG: pruning merge fetch taskId 3
|
|
||||||
DETAIL: Creating dependency on merge taskId 8
|
|
||||||
DEBUG: pruning merge fetch taskId 5
|
DEBUG: pruning merge fetch taskId 5
|
||||||
DETAIL: Creating dependency on merge taskId 11
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
|
DEBUG: pruning merge fetch taskId 7
|
||||||
|
DETAIL: Creating dependency on merge taskId 9
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
|
DETAIL: Creating dependency on merge taskId 9
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
|
DEBUG: pruning merge fetch taskId 1
|
||||||
|
DETAIL: Creating dependency on merge taskId 13
|
||||||
|
DEBUG: pruning merge fetch taskId 2
|
||||||
|
DETAIL: Creating dependency on merge taskId 4
|
||||||
|
DEBUG: pruning merge fetch taskId 4
|
||||||
|
DETAIL: Creating dependency on merge taskId 18
|
||||||
|
DEBUG: pruning merge fetch taskId 5
|
||||||
|
DETAIL: Creating dependency on merge taskId 8
|
||||||
|
DEBUG: pruning merge fetch taskId 7
|
||||||
|
DETAIL: Creating dependency on merge taskId 23
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
|
DETAIL: Creating dependency on merge taskId 28
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 16
|
||||||
l_partkey | o_orderkey | count
|
l_partkey | o_orderkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
18 | 12005 | 1
|
18 | 12005 | 1
|
||||||
|
|
|
@ -14,28 +14,47 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
o_custkey = c_custkey;
|
o_custkey = c_custkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
DETAIL: Creating dependency on merge taskId 3
|
DETAIL: Creating dependency on merge taskId 3
|
||||||
DEBUG: pruning merge fetch taskId 3
|
DEBUG: pruning merge fetch taskId 2
|
||||||
|
DETAIL: Creating dependency on merge taskId 4
|
||||||
|
DEBUG: pruning merge fetch taskId 4
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
DEBUG: pruning merge fetch taskId 5
|
DEBUG: pruning merge fetch taskId 5
|
||||||
|
DETAIL: Creating dependency on merge taskId 8
|
||||||
|
DEBUG: pruning merge fetch taskId 7
|
||||||
DETAIL: Creating dependency on merge taskId 9
|
DETAIL: Creating dependency on merge taskId 9
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 16
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
-> Custom Scan (Citus Adaptive)
|
-> Custom Scan (Citus Adaptive)
|
||||||
Task Count: 3
|
Task Count: 4
|
||||||
Tasks Shown: None, not supported for re-partition queries
|
Tasks Shown: None, not supported for re-partition queries
|
||||||
-> MapMergeJob
|
-> MapMergeJob
|
||||||
Map Task Count: 2
|
Map Task Count: 2
|
||||||
Merge Task Count: 3
|
Merge Task Count: 4
|
||||||
(7 rows)
|
-> MapMergeJob
|
||||||
|
Map Task Count: 3
|
||||||
|
Merge Task Count: 4
|
||||||
|
(10 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -44,18 +63,34 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
o_custkey = c_custkey;
|
o_custkey = c_custkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
DETAIL: Creating dependency on merge taskId 3
|
DETAIL: Creating dependency on merge taskId 3
|
||||||
DEBUG: pruning merge fetch taskId 3
|
DEBUG: pruning merge fetch taskId 2
|
||||||
|
DETAIL: Creating dependency on merge taskId 4
|
||||||
|
DEBUG: pruning merge fetch taskId 4
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
DEBUG: pruning merge fetch taskId 5
|
DEBUG: pruning merge fetch taskId 5
|
||||||
|
DETAIL: Creating dependency on merge taskId 8
|
||||||
|
DEBUG: pruning merge fetch taskId 7
|
||||||
DETAIL: Creating dependency on merge taskId 9
|
DETAIL: Creating dependency on merge taskId 9
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 16
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
2985
|
2985
|
||||||
|
@ -72,28 +107,47 @@ WHERE
|
||||||
o_custkey = c_custkey AND
|
o_custkey = c_custkey AND
|
||||||
o_orderkey < 0;
|
o_orderkey < 0;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
DETAIL: Creating dependency on merge taskId 3
|
DETAIL: Creating dependency on merge taskId 3
|
||||||
DEBUG: pruning merge fetch taskId 3
|
DEBUG: pruning merge fetch taskId 2
|
||||||
|
DETAIL: Creating dependency on merge taskId 4
|
||||||
|
DEBUG: pruning merge fetch taskId 4
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
DEBUG: pruning merge fetch taskId 5
|
DEBUG: pruning merge fetch taskId 5
|
||||||
|
DETAIL: Creating dependency on merge taskId 8
|
||||||
|
DEBUG: pruning merge fetch taskId 7
|
||||||
DETAIL: Creating dependency on merge taskId 9
|
DETAIL: Creating dependency on merge taskId 9
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 16
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
-> Custom Scan (Citus Adaptive)
|
-> Custom Scan (Citus Adaptive)
|
||||||
Task Count: 3
|
Task Count: 4
|
||||||
Tasks Shown: None, not supported for re-partition queries
|
Tasks Shown: None, not supported for re-partition queries
|
||||||
-> MapMergeJob
|
-> MapMergeJob
|
||||||
Map Task Count: 2
|
Map Task Count: 2
|
||||||
Merge Task Count: 3
|
Merge Task Count: 4
|
||||||
(7 rows)
|
-> MapMergeJob
|
||||||
|
Map Task Count: 3
|
||||||
|
Merge Task Count: 4
|
||||||
|
(10 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -103,18 +157,34 @@ WHERE
|
||||||
o_custkey = c_custkey AND
|
o_custkey = c_custkey AND
|
||||||
o_orderkey < 0 AND o_orderkey > 0;
|
o_orderkey < 0 AND o_orderkey > 0;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
DETAIL: Creating dependency on merge taskId 3
|
DETAIL: Creating dependency on merge taskId 3
|
||||||
DEBUG: pruning merge fetch taskId 3
|
DEBUG: pruning merge fetch taskId 2
|
||||||
|
DETAIL: Creating dependency on merge taskId 4
|
||||||
|
DEBUG: pruning merge fetch taskId 4
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
DEBUG: pruning merge fetch taskId 5
|
DEBUG: pruning merge fetch taskId 5
|
||||||
|
DETAIL: Creating dependency on merge taskId 8
|
||||||
|
DEBUG: pruning merge fetch taskId 7
|
||||||
DETAIL: Creating dependency on merge taskId 9
|
DETAIL: Creating dependency on merge taskId 9
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 16
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
0
|
||||||
|
@ -139,8 +209,11 @@ DEBUG: Router planner does not support append-partitioned tables.
|
||||||
Tasks Shown: None, not supported for re-partition queries
|
Tasks Shown: None, not supported for re-partition queries
|
||||||
-> MapMergeJob
|
-> MapMergeJob
|
||||||
Map Task Count: 2
|
Map Task Count: 2
|
||||||
Merge Task Count: 3
|
Merge Task Count: 4
|
||||||
(7 rows)
|
-> MapMergeJob
|
||||||
|
Map Task Count: 0
|
||||||
|
Merge Task Count: 0
|
||||||
|
(10 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -359,7 +432,10 @@ DEBUG: Router planner does not support append-partitioned tables.
|
||||||
-> MapMergeJob
|
-> MapMergeJob
|
||||||
Map Task Count: 0
|
Map Task Count: 0
|
||||||
Merge Task Count: 0
|
Merge Task Count: 0
|
||||||
(6 rows)
|
-> MapMergeJob
|
||||||
|
Map Task Count: 0
|
||||||
|
Merge Task Count: 0
|
||||||
|
(9 rows)
|
||||||
|
|
||||||
-- execute once, to verify that's handled
|
-- execute once, to verify that's handled
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -389,7 +465,10 @@ DEBUG: Router planner does not support append-partitioned tables.
|
||||||
-> MapMergeJob
|
-> MapMergeJob
|
||||||
Map Task Count: 0
|
Map Task Count: 0
|
||||||
Merge Task Count: 0
|
Merge Task Count: 0
|
||||||
(6 rows)
|
-> MapMergeJob
|
||||||
|
Map Task Count: 0
|
||||||
|
Merge Task Count: 0
|
||||||
|
(9 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
@ -13,7 +13,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, l_suppkey
|
l_partkey, l_suppkey
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ single range partition join "part_append" ]
|
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ dual partition join "part_append" ]
|
||||||
DEBUG: push down of limit count: 10
|
DEBUG: push down of limit count: 10
|
||||||
l_partkey | l_suppkey | count
|
l_partkey | l_suppkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -41,7 +41,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, l_suppkey
|
l_partkey, l_suppkey
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ single range partition join "part_append" ]
|
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ dual partition join "part_append" ]
|
||||||
DEBUG: push down of limit count: 10
|
DEBUG: push down of limit count: 10
|
||||||
l_partkey | l_suppkey | count
|
l_partkey | l_suppkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -69,7 +69,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, l_suppkey
|
l_partkey, l_suppkey
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ single range partition join "part_append" ]
|
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ dual partition join "part_append" ]
|
||||||
DEBUG: push down of limit count: 10
|
DEBUG: push down of limit count: 10
|
||||||
l_partkey | l_suppkey | count
|
l_partkey | l_suppkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -96,7 +96,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, l_suppkey
|
l_partkey, l_suppkey
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
LOG: join order: [ "lineitem" ][ single range partition join "part_append" ][ cartesian product reference join "supplier" ]
|
LOG: join order: [ "lineitem" ][ dual partition join "part_append" ][ cartesian product reference join "supplier" ]
|
||||||
DEBUG: push down of limit count: 10
|
DEBUG: push down of limit count: 10
|
||||||
l_partkey | l_suppkey | count
|
l_partkey | l_suppkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -124,7 +124,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, l_suppkey
|
l_partkey, l_suppkey
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ single range partition join "part_append" ]
|
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ dual partition join "part_append" ]
|
||||||
DEBUG: push down of limit count: 10
|
DEBUG: push down of limit count: 10
|
||||||
l_partkey | l_suppkey | count
|
l_partkey | l_suppkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -152,7 +152,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, l_suppkey
|
l_partkey, l_suppkey
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ single range partition join "part_append" ]
|
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ dual partition join "part_append" ]
|
||||||
DEBUG: push down of limit count: 10
|
DEBUG: push down of limit count: 10
|
||||||
l_partkey | l_suppkey | count
|
l_partkey | l_suppkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -180,7 +180,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, l_suppkey
|
l_partkey, l_suppkey
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ single range partition join "part_append" ]
|
LOG: join order: [ "lineitem" ][ reference join "supplier" ][ dual partition join "part_append" ]
|
||||||
DEBUG: push down of limit count: 10
|
DEBUG: push down of limit count: 10
|
||||||
l_partkey | l_suppkey | count
|
l_partkey | l_suppkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -208,7 +208,7 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, l_suppkey
|
l_partkey, l_suppkey
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
LOG: join order: [ "lineitem" ][ single range partition join "part_append" ][ reference join "supplier" ]
|
LOG: join order: [ "lineitem" ][ dual partition join "part_append" ][ reference join "supplier" ]
|
||||||
DEBUG: push down of limit count: 10
|
DEBUG: push down of limit count: 10
|
||||||
l_partkey | l_suppkey | count
|
l_partkey | l_suppkey | count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
|
@ -24,18 +24,38 @@ DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: no sharding pruning constraints on customer_append found
|
DEBUG: no sharding pruning constraints on customer_append found
|
||||||
DEBUG: shard count after pruning for customer_append: 3
|
DEBUG: shard count after pruning for customer_append: 3
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
DETAIL: Creating dependency on merge taskId 3
|
DETAIL: Creating dependency on merge taskId 3
|
||||||
DEBUG: pruning merge fetch taskId 3
|
DEBUG: pruning merge fetch taskId 2
|
||||||
|
DETAIL: Creating dependency on merge taskId 4
|
||||||
|
DEBUG: pruning merge fetch taskId 4
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
DEBUG: pruning merge fetch taskId 5
|
DEBUG: pruning merge fetch taskId 5
|
||||||
|
DETAIL: Creating dependency on merge taskId 8
|
||||||
|
DEBUG: pruning merge fetch taskId 7
|
||||||
DETAIL: Creating dependency on merge taskId 9
|
DETAIL: Creating dependency on merge taskId 9
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 16
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
@ -56,24 +76,44 @@ WHERE
|
||||||
o_custkey = c_custkey AND
|
o_custkey = c_custkey AND
|
||||||
o_orderkey = l_orderkey;
|
o_orderkey = l_orderkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no sharding pruning constraints on customer_append found
|
||||||
|
DEBUG: shard count after pruning for customer_append: 3
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: no sharding pruning constraints on lineitem found
|
DEBUG: no sharding pruning constraints on lineitem found
|
||||||
DEBUG: shard count after pruning for lineitem: 2
|
DEBUG: shard count after pruning for lineitem: 2
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: no sharding pruning constraints on customer_append found
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
DEBUG: shard count after pruning for customer_append: 3
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [6001,7000]
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1001,2000]
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
|
DETAIL: Creating dependency on merge taskId 4
|
||||||
|
DEBUG: pruning merge fetch taskId 2
|
||||||
DETAIL: Creating dependency on merge taskId 3
|
DETAIL: Creating dependency on merge taskId 3
|
||||||
DEBUG: pruning merge fetch taskId 3
|
DEBUG: pruning merge fetch taskId 4
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 8
|
||||||
DEBUG: pruning merge fetch taskId 5
|
DEBUG: pruning merge fetch taskId 5
|
||||||
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
|
DEBUG: pruning merge fetch taskId 7
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
DETAIL: Creating dependency on merge taskId 9
|
DETAIL: Creating dependency on merge taskId 9
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
|
DETAIL: Creating dependency on merge taskId 16
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 12
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
|
|
@ -1931,26 +1931,34 @@ DEBUG: query has a single distribution column value: 2
|
||||||
SELECT * FROM articles_hash ar join authors_range au on (ar.author_id = au.id)
|
SELECT * FROM articles_hash ar join authors_range au on (ar.author_id = au.id)
|
||||||
WHERE ar.author_id = 3;
|
WHERE ar.author_id = 3;
|
||||||
DEBUG: found no worker with all shard placements
|
DEBUG: found no worker with all shard placements
|
||||||
DEBUG: join prunable for intervals [1,10] and [11,20]
|
DEBUG: join prunable for task partitionId 0 and 1
|
||||||
DEBUG: join prunable for intervals [1,10] and [21,30]
|
DEBUG: join prunable for task partitionId 0 and 2
|
||||||
DEBUG: join prunable for intervals [1,10] and [31,40]
|
DEBUG: join prunable for task partitionId 0 and 3
|
||||||
DEBUG: join prunable for intervals [11,20] and [1,10]
|
DEBUG: join prunable for task partitionId 1 and 0
|
||||||
DEBUG: join prunable for intervals [11,20] and [21,30]
|
DEBUG: join prunable for task partitionId 1 and 2
|
||||||
DEBUG: join prunable for intervals [11,20] and [31,40]
|
DEBUG: join prunable for task partitionId 1 and 3
|
||||||
DEBUG: join prunable for intervals [21,30] and [1,10]
|
DEBUG: join prunable for task partitionId 2 and 0
|
||||||
DEBUG: join prunable for intervals [21,30] and [11,20]
|
DEBUG: join prunable for task partitionId 2 and 1
|
||||||
DEBUG: join prunable for intervals [21,30] and [31,40]
|
DEBUG: join prunable for task partitionId 2 and 3
|
||||||
DEBUG: join prunable for intervals [31,40] and [1,10]
|
DEBUG: join prunable for task partitionId 3 and 0
|
||||||
DEBUG: join prunable for intervals [31,40] and [11,20]
|
DEBUG: join prunable for task partitionId 3 and 1
|
||||||
DEBUG: join prunable for intervals [31,40] and [21,30]
|
DEBUG: join prunable for task partitionId 3 and 2
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
DETAIL: Creating dependency on merge taskId 2
|
DETAIL: Creating dependency on merge taskId 2
|
||||||
DEBUG: pruning merge fetch taskId 3
|
DEBUG: pruning merge fetch taskId 2
|
||||||
|
DETAIL: Creating dependency on merge taskId 5
|
||||||
|
DEBUG: pruning merge fetch taskId 4
|
||||||
DETAIL: Creating dependency on merge taskId 4
|
DETAIL: Creating dependency on merge taskId 4
|
||||||
DEBUG: pruning merge fetch taskId 5
|
DEBUG: pruning merge fetch taskId 5
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 10
|
||||||
DEBUG: pruning merge fetch taskId 7
|
DEBUG: pruning merge fetch taskId 7
|
||||||
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
|
DEBUG: pruning merge fetch taskId 8
|
||||||
|
DETAIL: Creating dependency on merge taskId 15
|
||||||
|
DEBUG: pruning merge fetch taskId 10
|
||||||
DETAIL: Creating dependency on merge taskId 8
|
DETAIL: Creating dependency on merge taskId 8
|
||||||
|
DEBUG: pruning merge fetch taskId 11
|
||||||
|
DETAIL: Creating dependency on merge taskId 20
|
||||||
id | author_id | title | word_count | name | id
|
id | author_id | title | word_count | name | id
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
|
@ -823,8 +823,7 @@ FROM
|
||||||
l_orderkey = o_orderkey
|
l_orderkey = o_orderkey
|
||||||
GROUP BY
|
GROUP BY
|
||||||
l_orderkey) AS unit_prices;
|
l_orderkey) AS unit_prices;
|
||||||
ERROR: cannot push down this subquery
|
ERROR: shard counts of co-located tables do not match
|
||||||
DETAIL: Shards of relations in subquery need to have 1-to-1 shard partitioning
|
|
||||||
-- Check that we can prune shards in subqueries with VARCHAR partition columns
|
-- Check that we can prune shards in subqueries with VARCHAR partition columns
|
||||||
CREATE TABLE subquery_pruning_varchar_test_table
|
CREATE TABLE subquery_pruning_varchar_test_table
|
||||||
(
|
(
|
||||||
|
|
|
@ -22,10 +22,10 @@ SELECT master_create_distributed_table('test_table_2', 'id', 'append');
|
||||||
\copy test_table_2 FROM STDIN DELIMITER ','
|
\copy test_table_2 FROM STDIN DELIMITER ','
|
||||||
SET citus.log_multi_join_order to TRUE;
|
SET citus.log_multi_join_order to TRUE;
|
||||||
SET client_min_messages to DEBUG1;
|
SET client_min_messages to DEBUG1;
|
||||||
-- Since we both have same amount of shards and they are colocated on the same node
|
SET citus.enable_repartition_joins TO on;
|
||||||
-- local join logic will be triggered.
|
-- when joining append tables we always get dual re-partition joins
|
||||||
SELECT count(*) FROM test_table_1, test_table_2 WHERE test_table_1.id = test_table_2.id;
|
SELECT count(*) FROM test_table_1, test_table_2 WHERE test_table_1.id = test_table_2.id;
|
||||||
LOG: join order: [ "test_table_1" ][ local partition join "test_table_2" ]
|
LOG: join order: [ "test_table_1" ][ dual partition join "test_table_2" ]
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
6
|
6
|
||||||
|
@ -41,7 +41,7 @@ SET citus.shard_replication_factor to 1;
|
||||||
-- for interval [8,10] repartition join logic will be triggered.
|
-- for interval [8,10] repartition join logic will be triggered.
|
||||||
SET citus.enable_repartition_joins to ON;
|
SET citus.enable_repartition_joins to ON;
|
||||||
SELECT count(*) FROM test_table_1, test_table_2 WHERE test_table_1.id = test_table_2.id;
|
SELECT count(*) FROM test_table_1, test_table_2 WHERE test_table_1.id = test_table_2.id;
|
||||||
LOG: join order: [ "test_table_1" ][ single range partition join "test_table_2" ]
|
LOG: join order: [ "test_table_1" ][ dual partition join "test_table_2" ]
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
9
|
9
|
||||||
|
|
|
@ -0,0 +1,233 @@
|
||||||
|
CREATE SCHEMA subquery_append;
|
||||||
|
SET search_path TO subquery_append;
|
||||||
|
CREATE TABLE append_table (key text, value int, extra int default 0);
|
||||||
|
CREATE INDEX ON append_table (key);
|
||||||
|
SELECT create_distributed_table('append_table', 'key', 'append');
|
||||||
|
create_distributed_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT 1 FROM master_create_empty_shard('append_table');
|
||||||
|
?column?
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT 1 FROM master_create_empty_shard('append_table');
|
||||||
|
?column?
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
CREATE TABLE ref_table (value int);
|
||||||
|
CREATE INDEX ON ref_table (value);
|
||||||
|
SELECT create_reference_table('ref_table');
|
||||||
|
create_reference_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
\COPY append_table (key,value) FROM STDIN WITH CSV
|
||||||
|
\COPY append_table (key,value) FROM STDIN WITH CSV
|
||||||
|
\COPY ref_table FROM STDIN WITH CSV
|
||||||
|
-- exercise some optimizer pushdown features with subqueries
|
||||||
|
SELECT count(*) FROM (SELECT random() FROM append_table) u;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
12
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM (SELECT DISTINCT key FROM append_table) sub ORDER BY 1 LIMIT 3;
|
||||||
|
key
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc
|
||||||
|
bcd
|
||||||
|
cde
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
SELECT DISTINCT key FROM (SELECT key FROM append_table) sub ORDER BY 1 LIMIT 3;
|
||||||
|
key
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc
|
||||||
|
bcd
|
||||||
|
cde
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
SELECT key, max(v) FROM (SELECT key, value + 1 AS v FROM append_table) sub GROUP BY key ORDER BY 1,2 LIMIT 3;
|
||||||
|
key | max
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc | 235
|
||||||
|
bcd | 235
|
||||||
|
cde | 346
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
SELECT v, max(key) FROM (SELECT key, value + 1 AS v FROM append_table) sub GROUP BY v ORDER BY 1,2 LIMIT 3;
|
||||||
|
v | max
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1 | jkl
|
||||||
|
2 | ijk
|
||||||
|
124 | hij
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
SELECT key, row_number() OVER (ORDER BY value) FROM (SELECT key, value, random() FROM append_table) sub ORDER BY 1,2 LIMIT 3;
|
||||||
|
key | row_number
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc | 6
|
||||||
|
abc | 9
|
||||||
|
bcd | 4
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
SELECT key, row_number() OVER (ORDER BY value PARTITION BY key) FROM (SELECT key, value, random() FROM append_table) sub ORDER BY 1,2 LIMIT 3;
|
||||||
|
ERROR: syntax error at or near "PARTITION"
|
||||||
|
SELECT key, row_number() OVER (ORDER BY value) FROM (SELECT key, value, random() FROM append_table) sub ORDER BY 1,2 LIMIT 3;
|
||||||
|
key | row_number
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc | 6
|
||||||
|
abc | 9
|
||||||
|
bcd | 4
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
SELECT key, row_number() OVER (PARTITION BY key) FROM (SELECT key, value, random() FROM append_table) sub ORDER BY 1,2 LIMIT 3;
|
||||||
|
key | row_number
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc | 1
|
||||||
|
abc | 2
|
||||||
|
bcd | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
-- try some joins in subqueries
|
||||||
|
SELECT key, count(*) FROM (SELECT *, random() FROM append_table a JOIN append_table b USING (key)) u GROUP BY key ORDER BY 1,2 LIMIT 3;
|
||||||
|
ERROR: the query contains a join that requires repartitioning
|
||||||
|
HINT: Set citus.enable_repartition_joins to on to enable repartitioning
|
||||||
|
SELECT key, count(*) FROM (SELECT *, random() FROM append_table a JOIN ref_table b USING (value)) u GROUP BY key ORDER BY 1,2 LIMIT 3;
|
||||||
|
key | count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc | 1
|
||||||
|
abc | 1
|
||||||
|
bcd | 2
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
SELECT key, value FROM append_table a WHERE value IN (SELECT * FROM ref_table) ORDER BY 1,2;
|
||||||
|
key | value
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc | 123
|
||||||
|
abc | 234
|
||||||
|
bcd | 123
|
||||||
|
bcd | 234
|
||||||
|
cde | 345
|
||||||
|
efg | 123
|
||||||
|
efg | 234
|
||||||
|
hij | 123
|
||||||
|
hij | 234
|
||||||
|
(9 rows)
|
||||||
|
|
||||||
|
SELECT key, value FROM append_table a WHERE key IN (SELECT key FROM append_table WHERE value > 100) ORDER BY 1,2;
|
||||||
|
ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
|
||||||
|
SELECT key, value FROM append_table a WHERE value = (SELECT max(value) FROM ref_table) ORDER BY 1,2;
|
||||||
|
key | value
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
cde | 345
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT key, value FROM append_table a WHERE value = (SELECT max(value) FROM ref_table r WHERE a.value = r.value) ORDER BY 1,2;
|
||||||
|
key | value
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc | 123
|
||||||
|
abc | 234
|
||||||
|
bcd | 123
|
||||||
|
bcd | 234
|
||||||
|
cde | 345
|
||||||
|
efg | 123
|
||||||
|
efg | 234
|
||||||
|
hij | 123
|
||||||
|
hij | 234
|
||||||
|
(9 rows)
|
||||||
|
|
||||||
|
SELECT key, (SELECT max(value) FROM ref_table r WHERE r.value = a.value) FROM append_table a ORDER BY 1,2;
|
||||||
|
key | max
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
abc | 123
|
||||||
|
abc | 234
|
||||||
|
bcd | 123
|
||||||
|
bcd | 234
|
||||||
|
cde | 345
|
||||||
|
def |
|
||||||
|
efg | 123
|
||||||
|
efg | 234
|
||||||
|
hij | 123
|
||||||
|
hij | 234
|
||||||
|
ijk |
|
||||||
|
jkl |
|
||||||
|
(12 rows)
|
||||||
|
|
||||||
|
-- Test delete
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM append_table a WHERE a.value IN (SELECT s FROM generate_series(1,100) s);
|
||||||
|
SELECT count(*) FROM append_table;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
11
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
DELETE FROM append_table a USING ref_table r WHERE a.value = r.value;
|
||||||
|
SELECT count(*) FROM append_table;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
DELETE FROM append_table WHERE value < 2;
|
||||||
|
SELECT count(*) FROM append_table;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
DELETE FROM append_table;
|
||||||
|
SELECT count(*) FROM append_table;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
0
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
DELETE FROM append_table a USING append_table b WHERE a.key = b.key;
|
||||||
|
ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
|
||||||
|
END;
|
||||||
|
-- Test update
|
||||||
|
BEGIN;
|
||||||
|
UPDATE append_table a SET extra = 1 WHERE a.value IN (SELECT s FROM generate_series(1,100) s);
|
||||||
|
SELECT count(*) FROM append_table WHERE extra = 1;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
UPDATE append_table a SET extra = 1 FROM ref_table r WHERE a.value = r.value;
|
||||||
|
SELECT count(*) FROM append_table WHERE extra = 1;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
10
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
UPDATE append_table SET extra = 1 WHERE value < 2;
|
||||||
|
SELECT count(*) FROM append_table WHERE extra = 1;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
11
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
UPDATE append_table SET extra = 1;
|
||||||
|
SELECT count(*) FROM append_table WHERE extra = 1;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
12
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
UPDATE append_table a sET extra = 1 FROM append_table b WHERE a.key = b.key;
|
||||||
|
ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
|
||||||
|
END;
|
||||||
|
DROP SCHEMA subquery_append CASCADE;
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
DETAIL: drop cascades to table append_table
|
||||||
|
drop cascades to table ref_table
|
|
@ -141,7 +141,7 @@ CREATE TABLE events (
|
||||||
event_type character varying(255),
|
event_type character varying(255),
|
||||||
event_time bigint
|
event_time bigint
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('events', 'composite_id', 'range');
|
SELECT create_distributed_table('events', 'composite_id', 'range');
|
||||||
|
|
||||||
SELECT master_create_empty_shard('events') AS new_shard_id
|
SELECT master_create_empty_shard('events') AS new_shard_id
|
||||||
\gset
|
\gset
|
||||||
|
@ -181,7 +181,11 @@ CREATE TABLE users (
|
||||||
composite_id user_composite_type,
|
composite_id user_composite_type,
|
||||||
lastseen bigint
|
lastseen bigint
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('users', 'composite_id', 'range');
|
SELECT create_distributed_table('users', 'composite_id', 'range');
|
||||||
|
|
||||||
|
-- we will guarantee co-locatedness for these tables
|
||||||
|
UPDATE pg_dist_partition SET colocationid = 20001
|
||||||
|
WHERE logicalrelid = 'events'::regclass OR logicalrelid = 'users'::regclass;
|
||||||
|
|
||||||
SELECT master_create_empty_shard('users') AS new_shard_id
|
SELECT master_create_empty_shard('users') AS new_shard_id
|
||||||
\gset
|
\gset
|
||||||
|
@ -228,7 +232,7 @@ CREATE TABLE lineitem_subquery (
|
||||||
l_shipmode char(10) not null,
|
l_shipmode char(10) not null,
|
||||||
l_comment varchar(44) not null,
|
l_comment varchar(44) not null,
|
||||||
PRIMARY KEY(l_orderkey, l_linenumber) );
|
PRIMARY KEY(l_orderkey, l_linenumber) );
|
||||||
SELECT master_create_distributed_table('lineitem_subquery', 'l_orderkey', 'range');
|
SELECT create_distributed_table('lineitem_subquery', 'l_orderkey', 'range');
|
||||||
|
|
||||||
CREATE TABLE orders_subquery (
|
CREATE TABLE orders_subquery (
|
||||||
o_orderkey bigint not null,
|
o_orderkey bigint not null,
|
||||||
|
@ -241,7 +245,11 @@ CREATE TABLE orders_subquery (
|
||||||
o_shippriority integer not null,
|
o_shippriority integer not null,
|
||||||
o_comment varchar(79) not null,
|
o_comment varchar(79) not null,
|
||||||
PRIMARY KEY(o_orderkey) );
|
PRIMARY KEY(o_orderkey) );
|
||||||
SELECT master_create_distributed_table('orders_subquery', 'o_orderkey', 'range');
|
SELECT create_distributed_table('orders_subquery', 'o_orderkey', 'range');
|
||||||
|
|
||||||
|
-- we will guarantee co-locatedness for these tabes
|
||||||
|
UPDATE pg_dist_partition SET colocationid = 20002
|
||||||
|
WHERE logicalrelid = 'orders_subquery'::regclass OR logicalrelid = 'lineitem_subquery'::regclass;
|
||||||
|
|
||||||
SET citus.enable_router_execution TO 'false';
|
SET citus.enable_router_execution TO 'false';
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ CREATE TABLE multi_outer_join_left
|
||||||
l_mktsegment char(10) not null,
|
l_mktsegment char(10) not null,
|
||||||
l_comment varchar(117) not null
|
l_comment varchar(117) not null
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('multi_outer_join_left', 'l_custkey', 'append');
|
SELECT create_distributed_table('multi_outer_join_left', 'l_custkey', 'hash');
|
||||||
|
|
||||||
CREATE TABLE multi_outer_join_right
|
CREATE TABLE multi_outer_join_right
|
||||||
(
|
(
|
||||||
|
@ -29,7 +29,7 @@ CREATE TABLE multi_outer_join_right
|
||||||
r_mktsegment char(10) not null,
|
r_mktsegment char(10) not null,
|
||||||
r_comment varchar(117) not null
|
r_comment varchar(117) not null
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('multi_outer_join_right', 'r_custkey', 'append');
|
SELECT create_distributed_table('multi_outer_join_right', 'r_custkey', 'hash');
|
||||||
|
|
||||||
CREATE TABLE multi_outer_join_right_reference
|
CREATE TABLE multi_outer_join_right_reference
|
||||||
(
|
(
|
||||||
|
@ -55,7 +55,7 @@ CREATE TABLE multi_outer_join_third
|
||||||
t_mktsegment char(10) not null,
|
t_mktsegment char(10) not null,
|
||||||
t_comment varchar(117) not null
|
t_comment varchar(117) not null
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('multi_outer_join_third', 't_custkey', 'append');
|
SELECT create_distributed_table('multi_outer_join_third', 't_custkey', 'hash');
|
||||||
|
|
||||||
CREATE TABLE multi_outer_join_third_reference
|
CREATE TABLE multi_outer_join_third_reference
|
||||||
(
|
(
|
||||||
|
@ -70,18 +70,8 @@ CREATE TABLE multi_outer_join_third_reference
|
||||||
);
|
);
|
||||||
SELECT create_reference_table('multi_outer_join_third_reference');
|
SELECT create_reference_table('multi_outer_join_third_reference');
|
||||||
|
|
||||||
|
|
||||||
-- Make sure we do not crash if both tables have no shards
|
|
||||||
SELECT
|
|
||||||
min(l_custkey), max(l_custkey)
|
|
||||||
FROM
|
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_third b ON (l_custkey = t_custkey);
|
|
||||||
|
|
||||||
-- Left table is a large table
|
|
||||||
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-1-10.data' with delimiter '|'
|
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-1-10.data' with delimiter '|'
|
||||||
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|'
|
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|'
|
||||||
|
|
||||||
-- Right table is a small table
|
|
||||||
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|'
|
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|'
|
||||||
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|'
|
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|'
|
||||||
|
|
||||||
|
@ -187,8 +177,8 @@ FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
||||||
|
|
||||||
-- empty tables
|
-- empty tables
|
||||||
SELECT * FROM master_apply_delete_command('DELETE FROM multi_outer_join_left');
|
TRUNCATE multi_outer_join_left;
|
||||||
SELECT * FROM master_apply_delete_command('DELETE FROM multi_outer_join_right');
|
TRUNCATE multi_outer_join_right;
|
||||||
|
|
||||||
-- reload shards with 1-1 matching
|
-- reload shards with 1-1 matching
|
||||||
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-subset-11-20.data' with delimiter '|'
|
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-subset-11-20.data' with delimiter '|'
|
||||||
|
@ -482,7 +472,8 @@ FROM
|
||||||
(multi_outer_join_right r1
|
(multi_outer_join_right r1
|
||||||
LEFT OUTER JOIN multi_outer_join_left l1 ON (l1.l_custkey = r1.r_custkey)) AS
|
LEFT OUTER JOIN multi_outer_join_left l1 ON (l1.l_custkey = r1.r_custkey)) AS
|
||||||
test(c_custkey, c_nationkey)
|
test(c_custkey, c_nationkey)
|
||||||
INNER JOIN multi_outer_join_third t1 ON (test.c_custkey = t1.t_custkey);
|
INNER JOIN multi_outer_join_third t1 ON (test.c_custkey = t1.t_custkey)
|
||||||
|
ORDER BY 1;
|
||||||
|
|
||||||
-- simple test to ensure anti-joins work with hash-partitioned tables
|
-- simple test to ensure anti-joins work with hash-partitioned tables
|
||||||
CREATE TABLE left_values(val int);
|
CREATE TABLE left_values(val int);
|
||||||
|
|
|
@ -50,7 +50,7 @@ test: union_pushdown
|
||||||
test: set_operation_and_local_tables
|
test: set_operation_and_local_tables
|
||||||
|
|
||||||
test: subqueries_deep subquery_view subquery_partitioning subqueries_not_supported
|
test: subqueries_deep subquery_view subquery_partitioning subqueries_not_supported
|
||||||
test: subquery_in_targetlist subquery_in_where subquery_complex_target_list
|
test: subquery_in_targetlist subquery_in_where subquery_complex_target_list subquery_append
|
||||||
test: subquery_prepared_statements
|
test: subquery_prepared_statements
|
||||||
test: non_colocated_leaf_subquery_joins non_colocated_subquery_joins non_colocated_join_order
|
test: non_colocated_leaf_subquery_joins non_colocated_subquery_joins non_colocated_join_order
|
||||||
test: cte_inline recursive_view_local_table values
|
test: cte_inline recursive_view_local_table values
|
||||||
|
|
|
@ -8,7 +8,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
RETURNS NULL ON NULL INPUT;
|
RETURNS NULL ON NULL INPUT;
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
RETURNS NULL ON NULL INPUT;
|
RETURNS NULL ON NULL INPUT;
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
RETURNS NULL ON NULL INPUT;
|
RETURNS NULL ON NULL INPUT;
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
IMMUTABLE;
|
IMMUTABLE;
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
RETURNS NULL ON NULL INPUT;
|
RETURNS NULL ON NULL INPUT;
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
RETURNS NULL ON NULL INPUT;
|
RETURNS NULL ON NULL INPUT;
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
);
|
);
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
);
|
);
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
);
|
);
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
);
|
);
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
);
|
);
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
CREATE OPERATOR FAMILY cats_2_op_fam USING hash;
|
CREATE OPERATOR FAMILY cats_2_op_fam USING hash;
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
FUNCTION 1 cmp_user_composite_type_function(user_composite_type, user_composite_type);
|
FUNCTION 1 cmp_user_composite_type_function(user_composite_type, user_composite_type);
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ SELECT run_command_on_master_and_workers($f$
|
||||||
FUNCTION 1 test_composite_type_hash(user_composite_type);
|
FUNCTION 1 test_composite_type_hash(user_composite_type);
|
||||||
$f$);
|
$f$);
|
||||||
run_command_on_master_and_workers
|
run_command_on_master_and_workers
|
||||||
-----------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -195,9 +195,9 @@ CREATE TABLE events (
|
||||||
event_type character varying(255),
|
event_type character varying(255),
|
||||||
event_time bigint
|
event_time bigint
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('events', 'composite_id', 'range');
|
SELECT create_distributed_table('events', 'composite_id', 'range');
|
||||||
master_create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -222,12 +222,15 @@ CREATE TABLE users (
|
||||||
composite_id user_composite_type,
|
composite_id user_composite_type,
|
||||||
lastseen bigint
|
lastseen bigint
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('users', 'composite_id', 'range');
|
SELECT create_distributed_table('users', 'composite_id', 'range');
|
||||||
master_create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- we will guarantee co-locatedness for these tables
|
||||||
|
UPDATE pg_dist_partition SET colocationid = 20001
|
||||||
|
WHERE logicalrelid = 'events'::regclass OR logicalrelid = 'users'::regclass;
|
||||||
SELECT master_create_empty_shard('users') AS new_shard_id
|
SELECT master_create_empty_shard('users') AS new_shard_id
|
||||||
\gset
|
\gset
|
||||||
UPDATE pg_dist_shard SET shardminvalue = '(1,1)', shardmaxvalue = '(1,2000000000)'
|
UPDATE pg_dist_shard SET shardminvalue = '(1,1)', shardmaxvalue = '(1,2000000000)'
|
||||||
|
@ -264,9 +267,9 @@ CREATE TABLE lineitem_subquery (
|
||||||
l_shipmode char(10) not null,
|
l_shipmode char(10) not null,
|
||||||
l_comment varchar(44) not null,
|
l_comment varchar(44) not null,
|
||||||
PRIMARY KEY(l_orderkey, l_linenumber) );
|
PRIMARY KEY(l_orderkey, l_linenumber) );
|
||||||
SELECT master_create_distributed_table('lineitem_subquery', 'l_orderkey', 'range');
|
SELECT create_distributed_table('lineitem_subquery', 'l_orderkey', 'range');
|
||||||
master_create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -281,12 +284,15 @@ CREATE TABLE orders_subquery (
|
||||||
o_shippriority integer not null,
|
o_shippriority integer not null,
|
||||||
o_comment varchar(79) not null,
|
o_comment varchar(79) not null,
|
||||||
PRIMARY KEY(o_orderkey) );
|
PRIMARY KEY(o_orderkey) );
|
||||||
SELECT master_create_distributed_table('orders_subquery', 'o_orderkey', 'range');
|
SELECT create_distributed_table('orders_subquery', 'o_orderkey', 'range');
|
||||||
master_create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- we will guarantee co-locatedness for these tabes
|
||||||
|
UPDATE pg_dist_partition SET colocationid = 20002
|
||||||
|
WHERE logicalrelid = 'orders_subquery'::regclass OR logicalrelid = 'lineitem_subquery'::regclass;
|
||||||
SET citus.enable_router_execution TO 'false';
|
SET citus.enable_router_execution TO 'false';
|
||||||
-- Check that we don't crash if there are not any shards.
|
-- Check that we don't crash if there are not any shards.
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -303,7 +309,7 @@ FROM
|
||||||
GROUP BY
|
GROUP BY
|
||||||
l_orderkey) AS unit_prices;
|
l_orderkey) AS unit_prices;
|
||||||
avg
|
avg
|
||||||
-----
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ CREATE TABLE multi_outer_join_left
|
||||||
l_mktsegment char(10) not null,
|
l_mktsegment char(10) not null,
|
||||||
l_comment varchar(117) not null
|
l_comment varchar(117) not null
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('multi_outer_join_left', 'l_custkey', 'append');
|
SELECT create_distributed_table('multi_outer_join_left', 'l_custkey', 'hash');
|
||||||
master_create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ CREATE TABLE multi_outer_join_right
|
||||||
r_mktsegment char(10) not null,
|
r_mktsegment char(10) not null,
|
||||||
r_comment varchar(117) not null
|
r_comment varchar(117) not null
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('multi_outer_join_right', 'r_custkey', 'append');
|
SELECT create_distributed_table('multi_outer_join_right', 'r_custkey', 'hash');
|
||||||
master_create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ CREATE TABLE multi_outer_join_right_reference
|
||||||
);
|
);
|
||||||
SELECT create_reference_table('multi_outer_join_right_reference');
|
SELECT create_reference_table('multi_outer_join_right_reference');
|
||||||
create_reference_table
|
create_reference_table
|
||||||
------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ CREATE TABLE multi_outer_join_third
|
||||||
t_mktsegment char(10) not null,
|
t_mktsegment char(10) not null,
|
||||||
t_comment varchar(117) not null
|
t_comment varchar(117) not null
|
||||||
);
|
);
|
||||||
SELECT master_create_distributed_table('multi_outer_join_third', 't_custkey', 'append');
|
SELECT create_distributed_table('multi_outer_join_third', 't_custkey', 'hash');
|
||||||
master_create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -82,24 +82,12 @@ CREATE TABLE multi_outer_join_third_reference
|
||||||
);
|
);
|
||||||
SELECT create_reference_table('multi_outer_join_third_reference');
|
SELECT create_reference_table('multi_outer_join_third_reference');
|
||||||
create_reference_table
|
create_reference_table
|
||||||
------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- Make sure we do not crash if both tables have no shards
|
|
||||||
SELECT
|
|
||||||
min(l_custkey), max(l_custkey)
|
|
||||||
FROM
|
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_third b ON (l_custkey = t_custkey);
|
|
||||||
min | max
|
|
||||||
-----+-----
|
|
||||||
|
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- Left table is a large table
|
|
||||||
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-1-10.data' with delimiter '|'
|
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-1-10.data' with delimiter '|'
|
||||||
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|'
|
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|'
|
||||||
-- Right table is a small table
|
|
||||||
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|'
|
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|'
|
||||||
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|'
|
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|'
|
||||||
-- Make sure we do not crash if one table has no shards
|
-- Make sure we do not crash if one table has no shards
|
||||||
|
@ -107,13 +95,17 @@ SELECT
|
||||||
min(l_custkey), max(l_custkey)
|
min(l_custkey), max(l_custkey)
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_third b ON (l_custkey = t_custkey);
|
multi_outer_join_left a LEFT JOIN multi_outer_join_third b ON (l_custkey = t_custkey);
|
||||||
ERROR: shard counts of co-located tables do not match
|
min | max
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1 | 20
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
min(t_custkey), max(t_custkey)
|
min(t_custkey), max(t_custkey)
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_third a LEFT JOIN multi_outer_join_right_reference b ON (r_custkey = t_custkey);
|
multi_outer_join_third a LEFT JOIN multi_outer_join_right_reference b ON (r_custkey = t_custkey);
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -126,7 +118,7 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b ON (l_custkey = r_custkey);
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b ON (l_custkey = r_custkey);
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
1 | 20
|
1 | 20
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -136,7 +128,7 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b ON (l_nationkey = r_nationkey);
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b ON (l_nationkey = r_nationkey);
|
||||||
count
|
count
|
||||||
-------
|
---------------------------------------------------------------------
|
||||||
28
|
28
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -148,7 +140,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
r_custkey IS NULL;
|
r_custkey IS NULL;
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
16 | 20
|
16 | 20
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -160,7 +152,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
r_custkey IS NULL OR r_custkey = 5;
|
r_custkey IS NULL OR r_custkey = 5;
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
5 | 20
|
5 | 20
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -173,7 +165,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
r_custkey = 5 or r_custkey > 15;
|
r_custkey = 5 or r_custkey > 15;
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
5 | 5
|
5 | 5
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -184,7 +176,7 @@ FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b
|
||||||
ON (l_custkey = r_custkey AND r_custkey = 5);
|
ON (l_custkey = r_custkey AND r_custkey = 5);
|
||||||
count | count
|
count | count
|
||||||
-------+-------
|
---------------------------------------------------------------------
|
||||||
20 | 1
|
20 | 1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -195,7 +187,7 @@ FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b
|
||||||
ON (l_custkey = r_custkey AND r_custkey = -1 /* nonexistant */);
|
ON (l_custkey = r_custkey AND r_custkey = -1 /* nonexistant */);
|
||||||
count | count
|
count | count
|
||||||
-------+-------
|
---------------------------------------------------------------------
|
||||||
20 | 0
|
20 | 0
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -206,7 +198,7 @@ FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right_reference b
|
||||||
ON (l_custkey = r_custkey AND l_custkey = -1 /* nonexistant */);
|
ON (l_custkey = r_custkey AND l_custkey = -1 /* nonexistant */);
|
||||||
count | count
|
count | count
|
||||||
-------+-------
|
---------------------------------------------------------------------
|
||||||
20 | 0
|
20 | 0
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -215,14 +207,18 @@ SELECT
|
||||||
min(r_custkey), max(r_custkey)
|
min(r_custkey), max(r_custkey)
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a RIGHT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
multi_outer_join_left a RIGHT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
||||||
ERROR: shard counts of co-located tables do not match
|
min | max
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1 | 15
|
||||||
|
(1 row)
|
||||||
|
|
||||||
-- Reverse right join should be same as left join
|
-- Reverse right join should be same as left join
|
||||||
SELECT
|
SELECT
|
||||||
min(l_custkey), max(l_custkey)
|
min(l_custkey), max(l_custkey)
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_right_reference a RIGHT JOIN multi_outer_join_left b ON (l_custkey = r_custkey);
|
multi_outer_join_right_reference a RIGHT JOIN multi_outer_join_left b ON (l_custkey = r_custkey);
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
1 | 20
|
1 | 20
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -234,23 +230,13 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
1 | 20
|
1 | 20
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- empty tables
|
-- empty tables
|
||||||
SELECT * FROM master_apply_delete_command('DELETE FROM multi_outer_join_left');
|
TRUNCATE multi_outer_join_left;
|
||||||
master_apply_delete_command
|
TRUNCATE multi_outer_join_right;
|
||||||
-----------------------------
|
|
||||||
2
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
SELECT * FROM master_apply_delete_command('DELETE FROM multi_outer_join_right');
|
|
||||||
master_apply_delete_command
|
|
||||||
-----------------------------
|
|
||||||
2
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- reload shards with 1-1 matching
|
-- reload shards with 1-1 matching
|
||||||
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-subset-11-20.data' with delimiter '|'
|
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-subset-11-20.data' with delimiter '|'
|
||||||
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|'
|
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|'
|
||||||
|
@ -263,7 +249,7 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
11 | 30
|
11 | 30
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -281,7 +267,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
r_custkey IS NULL;
|
r_custkey IS NULL;
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
23 | 29
|
23 | 29
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -293,7 +279,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
r_custkey IS NULL OR r_custkey = 15;
|
r_custkey IS NULL OR r_custkey = 15;
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
23 | 29
|
23 | 29
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -306,7 +292,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
r_custkey = 21 or r_custkey < 10;
|
r_custkey = 21 or r_custkey < 10;
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
21 | 21
|
21 | 21
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -317,7 +303,7 @@ FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right b
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right b
|
||||||
ON (l_custkey = r_custkey AND r_custkey = 21);
|
ON (l_custkey = r_custkey AND r_custkey = 21);
|
||||||
count | count
|
count | count
|
||||||
-------+-------
|
---------------------------------------------------------------------
|
||||||
17 | 1
|
17 | 1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -327,7 +313,7 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a RIGHT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
multi_outer_join_left a RIGHT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
11 | 30
|
11 | 30
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -337,7 +323,7 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_right a RIGHT JOIN multi_outer_join_left b ON (l_custkey = r_custkey);
|
multi_outer_join_right a RIGHT JOIN multi_outer_join_left b ON (l_custkey = r_custkey);
|
||||||
min | max
|
min | max
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
11 | 30
|
11 | 30
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -352,7 +338,7 @@ FROM
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
l_custkey
|
l_custkey
|
||||||
-----------
|
---------------------------------------------------------------------
|
||||||
11
|
11
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -369,7 +355,7 @@ WHERE
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
l_custkey
|
l_custkey
|
||||||
-----------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -382,7 +368,7 @@ FROM
|
||||||
LEFT JOIN multi_outer_join_third_reference t1 ON (r1.r_custkey = t1.t_custkey)
|
LEFT JOIN multi_outer_join_third_reference t1 ON (r1.r_custkey = t1.t_custkey)
|
||||||
ORDER BY l_custkey, r_custkey, t_custkey;
|
ORDER BY l_custkey, r_custkey, t_custkey;
|
||||||
l_custkey | r_custkey | t_custkey
|
l_custkey | r_custkey | t_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
11 | 11 | 11
|
11 | 11 | 11
|
||||||
12 | 12 | 12
|
12 | 12 | 12
|
||||||
14 | 14 | 14
|
14 | 14 | 14
|
||||||
|
@ -421,7 +407,7 @@ FROM
|
||||||
LEFT JOIN multi_outer_join_left l1 ON (r1.r_custkey = l1.l_custkey)
|
LEFT JOIN multi_outer_join_left l1 ON (r1.r_custkey = l1.l_custkey)
|
||||||
ORDER BY t_custkey, r_custkey, l_custkey;
|
ORDER BY t_custkey, r_custkey, l_custkey;
|
||||||
t_custkey | r_custkey | l_custkey
|
t_custkey | r_custkey | l_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
11 | 11 | 11
|
11 | 11 | 11
|
||||||
12 | 12 | 12
|
12 | 12 | 12
|
||||||
13 | 13 |
|
13 | 13 |
|
||||||
|
@ -452,7 +438,7 @@ WHERE
|
||||||
l_custkey is NULL
|
l_custkey is NULL
|
||||||
ORDER BY t_custkey, r_custkey, l_custkey;
|
ORDER BY t_custkey, r_custkey, l_custkey;
|
||||||
t_custkey | r_custkey | l_custkey
|
t_custkey | r_custkey | l_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
13 | 13 |
|
13 | 13 |
|
||||||
15 | 15 |
|
15 | 15 |
|
||||||
19 | 19 |
|
19 | 19 |
|
||||||
|
@ -467,7 +453,7 @@ FROM
|
||||||
RIGHT JOIN multi_outer_join_left l1 ON (r1.r_custkey = l1.l_custkey)
|
RIGHT JOIN multi_outer_join_left l1 ON (r1.r_custkey = l1.l_custkey)
|
||||||
ORDER BY 1,2,3;
|
ORDER BY 1,2,3;
|
||||||
t_custkey | r_custkey | l_custkey
|
t_custkey | r_custkey | l_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
11 | 11 | 11
|
11 | 11 | 11
|
||||||
12 | 12 | 12
|
12 | 12 | 12
|
||||||
14 | 14 | 14
|
14 | 14 | 14
|
||||||
|
@ -495,7 +481,7 @@ FROM
|
||||||
FULL JOIN multi_outer_join_right r1 ON (l1.l_custkey = r1.r_custkey)
|
FULL JOIN multi_outer_join_right r1 ON (l1.l_custkey = r1.r_custkey)
|
||||||
ORDER BY 1 DESC, 2 DESC;
|
ORDER BY 1 DESC, 2 DESC;
|
||||||
l_custkey | r_custkey
|
l_custkey | r_custkey
|
||||||
-----------+-----------
|
---------------------------------------------------------------------
|
||||||
| 19
|
| 19
|
||||||
| 15
|
| 15
|
||||||
| 13
|
| 13
|
||||||
|
@ -528,7 +514,7 @@ WHERE
|
||||||
r_custkey is NULL
|
r_custkey is NULL
|
||||||
ORDER BY 1 DESC, 2 DESC;
|
ORDER BY 1 DESC, 2 DESC;
|
||||||
l_custkey | r_custkey
|
l_custkey | r_custkey
|
||||||
-----------+-----------
|
---------------------------------------------------------------------
|
||||||
29 |
|
29 |
|
||||||
25 |
|
25 |
|
||||||
23 |
|
23 |
|
||||||
|
@ -544,7 +530,7 @@ WHERE
|
||||||
l_custkey is NULL
|
l_custkey is NULL
|
||||||
ORDER BY 1 DESC, 2 DESC;
|
ORDER BY 1 DESC, 2 DESC;
|
||||||
l_custkey | r_custkey
|
l_custkey | r_custkey
|
||||||
-----------+-----------
|
---------------------------------------------------------------------
|
||||||
| 19
|
| 19
|
||||||
| 15
|
| 15
|
||||||
| 13
|
| 13
|
||||||
|
@ -560,7 +546,7 @@ WHERE
|
||||||
l_custkey is NULL or r_custkey is NULL
|
l_custkey is NULL or r_custkey is NULL
|
||||||
ORDER BY 1 DESC, 2 DESC;
|
ORDER BY 1 DESC, 2 DESC;
|
||||||
l_custkey | r_custkey
|
l_custkey | r_custkey
|
||||||
-----------+-----------
|
---------------------------------------------------------------------
|
||||||
| 19
|
| 19
|
||||||
| 15
|
| 15
|
||||||
| 13
|
| 13
|
||||||
|
@ -576,7 +562,40 @@ FROM
|
||||||
multi_outer_join_left l1
|
multi_outer_join_left l1
|
||||||
FULL JOIN multi_outer_join_third t1 ON (l1.l_custkey = t1.t_custkey)
|
FULL JOIN multi_outer_join_third t1 ON (l1.l_custkey = t1.t_custkey)
|
||||||
ORDER BY 1 DESC, 2 DESC;
|
ORDER BY 1 DESC, 2 DESC;
|
||||||
ERROR: shard counts of co-located tables do not match
|
l_custkey | t_custkey
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
| 19
|
||||||
|
| 15
|
||||||
|
| 13
|
||||||
|
| 10
|
||||||
|
| 9
|
||||||
|
| 8
|
||||||
|
| 7
|
||||||
|
| 6
|
||||||
|
| 5
|
||||||
|
| 4
|
||||||
|
| 3
|
||||||
|
| 2
|
||||||
|
| 1
|
||||||
|
30 | 30
|
||||||
|
29 | 29
|
||||||
|
28 | 28
|
||||||
|
27 | 27
|
||||||
|
26 | 26
|
||||||
|
25 | 25
|
||||||
|
24 | 24
|
||||||
|
23 | 23
|
||||||
|
22 | 22
|
||||||
|
21 | 21
|
||||||
|
20 | 20
|
||||||
|
18 | 18
|
||||||
|
17 | 17
|
||||||
|
16 | 16
|
||||||
|
14 | 14
|
||||||
|
12 | 12
|
||||||
|
11 | 11
|
||||||
|
(30 rows)
|
||||||
|
|
||||||
-- inner join + single shard left join should work
|
-- inner join + single shard left join should work
|
||||||
SELECT
|
SELECT
|
||||||
l_custkey, r_custkey, t_custkey
|
l_custkey, r_custkey, t_custkey
|
||||||
|
@ -586,7 +605,7 @@ FROM
|
||||||
LEFT JOIN multi_outer_join_third_reference t1 ON (r1.r_custkey = t1.t_custkey)
|
LEFT JOIN multi_outer_join_third_reference t1 ON (r1.r_custkey = t1.t_custkey)
|
||||||
ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
||||||
l_custkey | r_custkey | t_custkey
|
l_custkey | r_custkey | t_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
30 | 30 | 30
|
30 | 30 | 30
|
||||||
28 | 28 | 28
|
28 | 28 | 28
|
||||||
27 | 27 | 27
|
27 | 27 | 27
|
||||||
|
@ -612,7 +631,7 @@ FROM
|
||||||
LEFT JOIN multi_outer_join_right r1 ON (l1.l_custkey = r1.r_custkey)
|
LEFT JOIN multi_outer_join_right r1 ON (l1.l_custkey = r1.r_custkey)
|
||||||
ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
||||||
l_custkey | t_custkey | r_custkey
|
l_custkey | t_custkey | r_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
30 | 30 | 30
|
30 | 30 | 30
|
||||||
29 | 29 |
|
29 | 29 |
|
||||||
28 | 28 | 28
|
28 | 28 | 28
|
||||||
|
@ -642,7 +661,7 @@ FROM
|
||||||
ORDER BY
|
ORDER BY
|
||||||
t_custkey, l_custkey, r_custkey;
|
t_custkey, l_custkey, r_custkey;
|
||||||
t_custkey | l_custkey | r_custkey
|
t_custkey | l_custkey | r_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
11 | 11 | 11
|
11 | 11 | 11
|
||||||
12 | 12 | 12
|
12 | 12 | 12
|
||||||
14 | 14 | 14
|
14 | 14 | 14
|
||||||
|
@ -671,7 +690,7 @@ FROM
|
||||||
LEFT JOIN multi_outer_join_right r1 ON (l1.l_custkey = r1.r_custkey)
|
LEFT JOIN multi_outer_join_right r1 ON (l1.l_custkey = r1.r_custkey)
|
||||||
ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
||||||
l_custkey | t_custkey | r_custkey
|
l_custkey | t_custkey | r_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
30 | 30 | 30
|
30 | 30 | 30
|
||||||
29 | 29 |
|
29 | 29 |
|
||||||
28 | 28 | 28
|
28 | 28 | 28
|
||||||
|
@ -702,7 +721,7 @@ WHERE
|
||||||
r_custkey is NULL
|
r_custkey is NULL
|
||||||
ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
||||||
l_custkey | t_custkey | r_custkey
|
l_custkey | t_custkey | r_custkey
|
||||||
-----------+-----------+-----------
|
---------------------------------------------------------------------
|
||||||
29 | 29 |
|
29 | 29 |
|
||||||
25 | 25 |
|
25 | 25 |
|
||||||
23 | 23 |
|
23 | 23 |
|
||||||
|
@ -718,7 +737,7 @@ FROM
|
||||||
INNER JOIN multi_outer_join_third_reference t1 ON (test.c_custkey = t1.t_custkey)
|
INNER JOIN multi_outer_join_third_reference t1 ON (test.c_custkey = t1.t_custkey)
|
||||||
ORDER BY 1 DESC;
|
ORDER BY 1 DESC;
|
||||||
t_custkey
|
t_custkey
|
||||||
-----------
|
---------------------------------------------------------------------
|
||||||
30
|
30
|
||||||
28
|
28
|
||||||
27
|
27
|
||||||
|
@ -756,7 +775,7 @@ GROUP BY l1.l_custkey
|
||||||
ORDER BY cnt DESC, l1.l_custkey DESC
|
ORDER BY cnt DESC, l1.l_custkey DESC
|
||||||
LIMIT 20;
|
LIMIT 20;
|
||||||
l_custkey | cnt
|
l_custkey | cnt
|
||||||
-----------+-----
|
---------------------------------------------------------------------
|
||||||
30 | 1
|
30 | 1
|
||||||
29 | 1
|
29 | 1
|
||||||
28 | 1
|
28 | 1
|
||||||
|
@ -782,36 +801,79 @@ SELECT
|
||||||
min(l_custkey), max(l_custkey)
|
min(l_custkey), max(l_custkey)
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
||||||
ERROR: cannot push down this subquery
|
min | max
|
||||||
DETAIL: Currently append partitioned relations with overlapping shard intervals are not supported
|
---------------------------------------------------------------------
|
||||||
|
1 | 1000
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
min(l_custkey), max(l_custkey)
|
min(l_custkey), max(l_custkey)
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a RIGHT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
multi_outer_join_left a RIGHT JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
||||||
ERROR: cannot push down this subquery
|
min | max
|
||||||
DETAIL: Currently append partitioned relations with overlapping shard intervals are not supported
|
---------------------------------------------------------------------
|
||||||
|
11 | 30
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
min(l_custkey), max(l_custkey)
|
min(l_custkey), max(l_custkey)
|
||||||
FROM
|
FROM
|
||||||
multi_outer_join_left a FULL JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
multi_outer_join_left a FULL JOIN multi_outer_join_right b ON (l_custkey = r_custkey);
|
||||||
ERROR: cannot push down this subquery
|
min | max
|
||||||
DETAIL: Currently append partitioned relations with overlapping shard intervals are not supported
|
---------------------------------------------------------------------
|
||||||
|
1 | 1000
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
t_custkey
|
t_custkey
|
||||||
FROM
|
FROM
|
||||||
(multi_outer_join_right r1
|
(multi_outer_join_right r1
|
||||||
LEFT OUTER JOIN multi_outer_join_left l1 ON (l1.l_custkey = r1.r_custkey)) AS
|
LEFT OUTER JOIN multi_outer_join_left l1 ON (l1.l_custkey = r1.r_custkey)) AS
|
||||||
test(c_custkey, c_nationkey)
|
test(c_custkey, c_nationkey)
|
||||||
INNER JOIN multi_outer_join_third t1 ON (test.c_custkey = t1.t_custkey);
|
INNER JOIN multi_outer_join_third t1 ON (test.c_custkey = t1.t_custkey)
|
||||||
ERROR: cannot push down this subquery
|
ORDER BY 1;
|
||||||
DETAIL: Currently append partitioned relations with overlapping shard intervals are not supported
|
t_custkey
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
11
|
||||||
|
11
|
||||||
|
12
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
14
|
||||||
|
15
|
||||||
|
16
|
||||||
|
16
|
||||||
|
17
|
||||||
|
17
|
||||||
|
18
|
||||||
|
18
|
||||||
|
19
|
||||||
|
20
|
||||||
|
20
|
||||||
|
21
|
||||||
|
21
|
||||||
|
22
|
||||||
|
22
|
||||||
|
24
|
||||||
|
24
|
||||||
|
26
|
||||||
|
26
|
||||||
|
27
|
||||||
|
27
|
||||||
|
28
|
||||||
|
28
|
||||||
|
30
|
||||||
|
30
|
||||||
|
(31 rows)
|
||||||
|
|
||||||
-- simple test to ensure anti-joins work with hash-partitioned tables
|
-- simple test to ensure anti-joins work with hash-partitioned tables
|
||||||
CREATE TABLE left_values(val int);
|
CREATE TABLE left_values(val int);
|
||||||
SET citus.shard_count to 16;
|
SET citus.shard_count to 16;
|
||||||
SET citus.shard_replication_factor to 1;
|
SET citus.shard_replication_factor to 1;
|
||||||
SELECT create_distributed_table('left_values', 'val');
|
SELECT create_distributed_table('left_values', 'val');
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
--------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -819,7 +881,7 @@ SELECT create_distributed_table('left_values', 'val');
|
||||||
CREATE TABLE right_values(val int);
|
CREATE TABLE right_values(val int);
|
||||||
SELECT create_distributed_table('right_values', 'val');
|
SELECT create_distributed_table('right_values', 'val');
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
--------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -833,7 +895,7 @@ WHERE
|
||||||
r.val IS NULL
|
r.val IS NULL
|
||||||
ORDER BY 1 DESC, 2 DESC;
|
ORDER BY 1 DESC, 2 DESC;
|
||||||
val | val
|
val | val
|
||||||
-----+-----
|
---------------------------------------------------------------------
|
||||||
5 |
|
5 |
|
||||||
1 |
|
1 |
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
|
@ -128,12 +128,16 @@ CREATE TABLE range2(id int);
|
||||||
SELECT create_distributed_table('range2', 'id', 'range');
|
SELECT create_distributed_table('range2', 'id', 'range');
|
||||||
CALL public.create_range_partitioned_shards('range2', '{0,3}','{2,5}');
|
CALL public.create_range_partitioned_shards('range2', '{0,3}','{2,5}');
|
||||||
|
|
||||||
|
-- Mark tables co-located
|
||||||
|
UPDATE pg_dist_partition SET colocationid = 30001
|
||||||
|
WHERE logicalrelid = 'range1'::regclass OR logicalrelid = 'range2'::regclass;
|
||||||
|
|
||||||
-- Move shard placement and DON'T clean it up, now range1 and range2 are
|
-- Move shard placement and DON'T clean it up, now range1 and range2 are
|
||||||
-- colocated, but only range2 has an orphaned shard.
|
-- colocated, but only range2 has an orphaned shard.
|
||||||
SELECT citus_move_shard_placement(92448600, 'localhost', :worker_2_port, 'localhost', :worker_1_port, 'block_writes');
|
SELECT citus_move_shard_placement(92448600, 'localhost', :worker_2_port, 'localhost', :worker_1_port, 'block_writes');
|
||||||
SELECT shardid, shardstate, nodeport FROM pg_dist_shard_placement WHERE shardid = 92448600 ORDER BY placementid;
|
SELECT shardid, shardstate, nodeport FROM pg_dist_shard_placement WHERE shardid = 92448600 ORDER BY placementid;
|
||||||
|
|
||||||
-- Make sure that tables are detected as colocated
|
-- Make sure co-located join works
|
||||||
SELECT * FROM range1 JOIN range2 ON range1.id = range2.id;
|
SELECT * FROM range1 JOIN range2 ON range1.id = range2.id;
|
||||||
|
|
||||||
-- Make sure we can create a foreign key on community edition, because
|
-- Make sure we can create a foreign key on community edition, because
|
||||||
|
|
|
@ -38,7 +38,7 @@ CREATE TABLE varchar_partitioned_table
|
||||||
(
|
(
|
||||||
varchar_column varchar(100)
|
varchar_column varchar(100)
|
||||||
);
|
);
|
||||||
SELECT create_distributed_table('varchar_partitioned_table', 'varchar_column', 'append');
|
SELECT create_distributed_table('varchar_partitioned_table', 'varchar_column', 'range');
|
||||||
|
|
||||||
-- Create logical shards and shard placements with shardid 100,101
|
-- Create logical shards and shard placements with shardid 100,101
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ CREATE TABLE array_partitioned_table
|
||||||
(
|
(
|
||||||
array_column text[]
|
array_column text[]
|
||||||
);
|
);
|
||||||
SELECT create_distributed_table('array_partitioned_table', 'array_column', 'append');
|
SELECT create_distributed_table('array_partitioned_table', 'array_column', 'range');
|
||||||
SET client_min_messages TO DEBUG2;
|
SET client_min_messages TO DEBUG2;
|
||||||
|
|
||||||
-- Create logical shard with shardid 102, 103
|
-- Create logical shard with shardid 102, 103
|
||||||
|
@ -105,7 +105,7 @@ CREATE TABLE composite_partitioned_table
|
||||||
(
|
(
|
||||||
composite_column composite_type
|
composite_column composite_type
|
||||||
);
|
);
|
||||||
SELECT create_distributed_table('composite_partitioned_table', 'composite_column', 'append');
|
SELECT create_distributed_table('composite_partitioned_table', 'composite_column', 'range');
|
||||||
SET client_min_messages TO DEBUG2;
|
SET client_min_messages TO DEBUG2;
|
||||||
|
|
||||||
-- Create logical shard with shardid 104, 105
|
-- Create logical shard with shardid 104, 105
|
||||||
|
|
|
@ -36,9 +36,9 @@ SELECT master_create_distributed_table('test_table_2', 'id', 'append');
|
||||||
|
|
||||||
SET citus.log_multi_join_order to TRUE;
|
SET citus.log_multi_join_order to TRUE;
|
||||||
SET client_min_messages to DEBUG1;
|
SET client_min_messages to DEBUG1;
|
||||||
|
SET citus.enable_repartition_joins TO on;
|
||||||
|
|
||||||
-- Since we both have same amount of shards and they are colocated on the same node
|
-- when joining append tables we always get dual re-partition joins
|
||||||
-- local join logic will be triggered.
|
|
||||||
SELECT count(*) FROM test_table_1, test_table_2 WHERE test_table_1.id = test_table_2.id;
|
SELECT count(*) FROM test_table_1, test_table_2 WHERE test_table_1.id = test_table_2.id;
|
||||||
|
|
||||||
-- Add two shards placement of interval [8,10] to test_table_1
|
-- Add two shards placement of interval [8,10] to test_table_1
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
CREATE SCHEMA subquery_append;
|
||||||
|
SET search_path TO subquery_append;
|
||||||
|
|
||||||
|
CREATE TABLE append_table (key text, value int, extra int default 0);
|
||||||
|
CREATE INDEX ON append_table (key);
|
||||||
|
|
||||||
|
SELECT create_distributed_table('append_table', 'key', 'append');
|
||||||
|
SELECT 1 FROM master_create_empty_shard('append_table');
|
||||||
|
SELECT 1 FROM master_create_empty_shard('append_table');
|
||||||
|
|
||||||
|
CREATE TABLE ref_table (value int);
|
||||||
|
CREATE INDEX ON ref_table (value);
|
||||||
|
SELECT create_reference_table('ref_table');
|
||||||
|
|
||||||
|
\COPY append_table (key,value) FROM STDIN WITH CSV
|
||||||
|
abc,234
|
||||||
|
bcd,123
|
||||||
|
bcd,234
|
||||||
|
cde,345
|
||||||
|
def,456
|
||||||
|
efg,234
|
||||||
|
\.
|
||||||
|
|
||||||
|
\COPY append_table (key,value) FROM STDIN WITH CSV
|
||||||
|
abc,123
|
||||||
|
efg,123
|
||||||
|
hij,123
|
||||||
|
hij,234
|
||||||
|
ijk,1
|
||||||
|
jkl,0
|
||||||
|
\.
|
||||||
|
|
||||||
|
\COPY ref_table FROM STDIN WITH CSV
|
||||||
|
123
|
||||||
|
234
|
||||||
|
345
|
||||||
|
\.
|
||||||
|
|
||||||
|
-- exercise some optimizer pushdown features with subqueries
|
||||||
|
SELECT count(*) FROM (SELECT random() FROM append_table) u;
|
||||||
|
|
||||||
|
SELECT * FROM (SELECT DISTINCT key FROM append_table) sub ORDER BY 1 LIMIT 3;
|
||||||
|
SELECT DISTINCT key FROM (SELECT key FROM append_table) sub ORDER BY 1 LIMIT 3;
|
||||||
|
|
||||||
|
SELECT key, max(v) FROM (SELECT key, value + 1 AS v FROM append_table) sub GROUP BY key ORDER BY 1,2 LIMIT 3;
|
||||||
|
SELECT v, max(key) FROM (SELECT key, value + 1 AS v FROM append_table) sub GROUP BY v ORDER BY 1,2 LIMIT 3;
|
||||||
|
|
||||||
|
SELECT key, row_number() OVER (ORDER BY value) FROM (SELECT key, value, random() FROM append_table) sub ORDER BY 1,2 LIMIT 3;
|
||||||
|
SELECT key, row_number() OVER (ORDER BY value PARTITION BY key) FROM (SELECT key, value, random() FROM append_table) sub ORDER BY 1,2 LIMIT 3;
|
||||||
|
|
||||||
|
SELECT key, row_number() OVER (ORDER BY value) FROM (SELECT key, value, random() FROM append_table) sub ORDER BY 1,2 LIMIT 3;
|
||||||
|
SELECT key, row_number() OVER (PARTITION BY key) FROM (SELECT key, value, random() FROM append_table) sub ORDER BY 1,2 LIMIT 3;
|
||||||
|
|
||||||
|
-- try some joins in subqueries
|
||||||
|
SELECT key, count(*) FROM (SELECT *, random() FROM append_table a JOIN append_table b USING (key)) u GROUP BY key ORDER BY 1,2 LIMIT 3;
|
||||||
|
SELECT key, count(*) FROM (SELECT *, random() FROM append_table a JOIN ref_table b USING (value)) u GROUP BY key ORDER BY 1,2 LIMIT 3;
|
||||||
|
SELECT key, value FROM append_table a WHERE value IN (SELECT * FROM ref_table) ORDER BY 1,2;
|
||||||
|
SELECT key, value FROM append_table a WHERE key IN (SELECT key FROM append_table WHERE value > 100) ORDER BY 1,2;
|
||||||
|
SELECT key, value FROM append_table a WHERE value = (SELECT max(value) FROM ref_table) ORDER BY 1,2;
|
||||||
|
SELECT key, value FROM append_table a WHERE value = (SELECT max(value) FROM ref_table r WHERE a.value = r.value) ORDER BY 1,2;
|
||||||
|
SELECT key, (SELECT max(value) FROM ref_table r WHERE r.value = a.value) FROM append_table a ORDER BY 1,2;
|
||||||
|
|
||||||
|
-- Test delete
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM append_table a WHERE a.value IN (SELECT s FROM generate_series(1,100) s);
|
||||||
|
SELECT count(*) FROM append_table;
|
||||||
|
DELETE FROM append_table a USING ref_table r WHERE a.value = r.value;
|
||||||
|
SELECT count(*) FROM append_table;
|
||||||
|
DELETE FROM append_table WHERE value < 2;
|
||||||
|
SELECT count(*) FROM append_table;
|
||||||
|
DELETE FROM append_table;
|
||||||
|
SELECT count(*) FROM append_table;
|
||||||
|
DELETE FROM append_table a USING append_table b WHERE a.key = b.key;
|
||||||
|
END;
|
||||||
|
|
||||||
|
-- Test update
|
||||||
|
BEGIN;
|
||||||
|
UPDATE append_table a SET extra = 1 WHERE a.value IN (SELECT s FROM generate_series(1,100) s);
|
||||||
|
SELECT count(*) FROM append_table WHERE extra = 1;
|
||||||
|
UPDATE append_table a SET extra = 1 FROM ref_table r WHERE a.value = r.value;
|
||||||
|
SELECT count(*) FROM append_table WHERE extra = 1;
|
||||||
|
UPDATE append_table SET extra = 1 WHERE value < 2;
|
||||||
|
SELECT count(*) FROM append_table WHERE extra = 1;
|
||||||
|
UPDATE append_table SET extra = 1;
|
||||||
|
SELECT count(*) FROM append_table WHERE extra = 1;
|
||||||
|
UPDATE append_table a sET extra = 1 FROM append_table b WHERE a.key = b.key;
|
||||||
|
END;
|
||||||
|
|
||||||
|
DROP SCHEMA subquery_append CASCADE;
|
Loading…
Reference in New Issue