| # simple select and root is colocated with first partition |
| N0 |
| SELECT * FROM t4_n0n1_n2n1 |
| --- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [N0] |
| exchangeSourceNodes: {2=[N0, N1]} |
| colocationGroup[-1]: {nodes=[N0], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N0=[]}} |
| colocationGroup[2]: {nodes=[N0], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N0=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.T4_N0N1_N2N1 in zone ZONE_4 |
| executionNodes: [N0, N1] |
| targetNodes: [N0] |
| colocationGroup[0]: {nodes=[N0, N1], sourceIds=[0], assignments={part_0=N0:2, part_1=N1:2}, partitionsWithConsistencyTokens={N0=[part_0:2], N1=[part_1:2]}} |
| partitions: [T4_N0N1_N2N1=[N0={0}, N1={1}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=100004) |
| TableScan |
| table: PUBLIC.T4_N0N1_N2N1 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100004) |
| --- |
| # simple select and root is colocated with first partition |
| N0 |
| SELECT * FROM t4_n0n1_n2n1 |
| READ_FROM_PRIMARY |
| --- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [N0] |
| exchangeSourceNodes: {2=[N0, N2]} |
| colocationGroup[-1]: {nodes=[N0], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N0=[]}} |
| colocationGroup[2]: {nodes=[N0], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N0=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.T4_N0N1_N2N1 in zone ZONE_4 |
| executionNodes: [N0, N2] |
| targetNodes: [N0] |
| colocationGroup[0]: {nodes=[N0, N2], sourceIds=[0], assignments={part_0=N0:2, part_1=N2:2}, partitionsWithConsistencyTokens={N0=[part_0:2], N2=[part_1:2]}} |
| partitions: [T4_N0N1_N2N1=[N0={0}, N2={1}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=100004) |
| TableScan |
| table: PUBLIC.T4_N0N1_N2N1 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100004) |
| --- |
| # root of the query is colocated with first partition |
| N0 |
| SELECT * FROM t1_n0n1_n1n2 |
| --- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [N0] |
| exchangeSourceNodes: {2=[N0, N1]} |
| colocationGroup[-1]: {nodes=[N0], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N0=[]}} |
| colocationGroup[2]: {nodes=[N0], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N0=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.T1_N0N1_N1N2 in zone ZONE_1 |
| executionNodes: [N0, N1] |
| targetNodes: [N0] |
| colocationGroup[0]: {nodes=[N0, N1], sourceIds=[0], assignments={part_0=N0:2, part_1=N1:2}, partitionsWithConsistencyTokens={N0=[part_0:2], N1=[part_1:2]}} |
| partitions: [T1_N0N1_N1N2=[N0={0}, N1={1}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=100001) |
| TableScan |
| table: PUBLIC.T1_N0N1_N1N2 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100001) |
| --- |
| # root of the query is colocated with both partitions |
| N1 |
| SELECT * FROM t1_n0n1_n1n2 |
| --- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [N1] |
| exchangeSourceNodes: {2=[N1]} |
| colocationGroup[-1]: {nodes=[N1], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N1=[]}} |
| colocationGroup[2]: {nodes=[N1], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N1=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.T1_N0N1_N1N2 in zone ZONE_1 |
| executionNodes: [N1] |
| targetNodes: [N1] |
| colocationGroup[0]: {nodes=[N1], sourceIds=[0], assignments={part_0=N1:2, part_1=N1:2}, partitionsWithConsistencyTokens={N1=[part_0:2, part_1:2]}} |
| partitions: [T1_N0N1_N1N2=[N1={0, 1}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=100001) |
| TableScan |
| table: PUBLIC.T1_N0N1_N1N2 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100001) |
| --- |
| # root of the query is colocated with both partitions |
| N1 |
| SELECT * FROM t1_n0n1_n1n2 |
| READ_FROM_PRIMARY |
| --- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [N1] |
| exchangeSourceNodes: {2=[N0, N1]} |
| colocationGroup[-1]: {nodes=[N1], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N1=[]}} |
| colocationGroup[2]: {nodes=[N1], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N1=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.T1_N0N1_N1N2 in zone ZONE_1 |
| executionNodes: [N0, N1] |
| targetNodes: [N1] |
| colocationGroup[0]: {nodes=[N0, N1], sourceIds=[0], assignments={part_0=N0:2, part_1=N1:2}, partitionsWithConsistencyTokens={N0=[part_0:2], N1=[part_1:2]}} |
| partitions: [T1_N0N1_N1N2=[N0={0}, N1={1}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=100001) |
| TableScan |
| table: PUBLIC.T1_N0N1_N1N2 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100001) |
| --- |
| # root of the query is colocated with second partition |
| N2 |
| SELECT * FROM t1_n0n1_n1n2 |
| --- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [N2] |
| exchangeSourceNodes: {2=[N0, N2]} |
| colocationGroup[-1]: {nodes=[N2], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N2=[]}} |
| colocationGroup[2]: {nodes=[N2], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N2=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.T1_N0N1_N1N2 in zone ZONE_1 |
| executionNodes: [N0, N2] |
| targetNodes: [N2] |
| colocationGroup[0]: {nodes=[N0, N2], sourceIds=[0], assignments={part_0=N0:2, part_1=N2:2}, partitionsWithConsistencyTokens={N0=[part_0:2], N2=[part_1:2]}} |
| partitions: [T1_N0N1_N1N2=[N0={0}, N2={1}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=100001) |
| TableScan |
| table: PUBLIC.T1_N0N1_N1N2 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100001) |
| --- |
| # root of the query is colocated with second partition |
| N2 |
| SELECT * FROM t1_n0n1_n1n2 |
| READ_FROM_PRIMARY |
| --- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [N2] |
| exchangeSourceNodes: {2=[N0, N1]} |
| colocationGroup[-1]: {nodes=[N2], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N2=[]}} |
| colocationGroup[2]: {nodes=[N2], sourceIds=[-1, 2], assignments={}, partitionsWithConsistencyTokens={N2=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.T1_N0N1_N1N2 in zone ZONE_1 |
| executionNodes: [N0, N1] |
| targetNodes: [N2] |
| colocationGroup[0]: {nodes=[N0, N1], sourceIds=[0], assignments={part_0=N0:2, part_1=N1:2}, partitionsWithConsistencyTokens={N0=[part_0:2], N1=[part_1:2]}} |
| partitions: [T1_N0N1_N1N2=[N0={0}, N1={1}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=100001) |
| TableScan |
| table: PUBLIC.T1_N0N1_N1N2 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100001) |
| --- |
| # although root is colocated with one of the partitions, algorithm prefers to colocate join stage |
| N0 |
| SELECT * FROM t2_n0n1n2 as t1, t3_n1n2 as t2 WHERE t1.id = t2.id AND t1.c1 = 5 |
| --- |
| Fragment#2 root |
| distribution: single |
| executionNodes: [N0] |
| exchangeSourceNodes: {3=[N1]} |
| colocationGroup[-1]: {nodes=[N0], sourceIds=[-1, 3], assignments={}, partitionsWithConsistencyTokens={N0=[]}} |
| colocationGroup[3]: {nodes=[N0], sourceIds=[-1, 3], assignments={}, partitionsWithConsistencyTokens={N0=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID0, C10, C20, ID, C1, C2] |
| sourceFragmentId: 3 |
| est: (rows=1) |
| |
| Fragment#3 |
| distribution: table PUBLIC.T3_N1N2 in zone ZONE_3 |
| executionNodes: [N1] |
| targetNodes: [N0] |
| exchangeSourceNodes: {4=[N1]} |
| colocationGroup[0]: {nodes=[N1], sourceIds=[0, 4], assignments={part_0=N1:1}, partitionsWithConsistencyTokens={N1=[part_0:1]}} |
| colocationGroup[4]: {nodes=[N1], sourceIds=[0, 4], assignments={part_0=N1:1}, partitionsWithConsistencyTokens={N1=[part_0:1]}} |
| partitions: [T3_N1N2=[N1={0}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 2 |
| est: (rows=15000) |
| Project |
| fieldNames: [ID0, C10, C20, ID, C1, C2] |
| projection: [ID$0, C1$0, C2$0, ID, C1, C2] |
| est: (rows=15000) |
| HashJoin |
| predicate: =(ID$0, ID) |
| fieldNames: [ID, C1, C2, ID$0, C1$0, C2$0] |
| type: inner |
| est: (rows=15000) |
| TableScan |
| table: PUBLIC.T3_N1N2 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100003) |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 4 |
| est: (rows=1) |
| |
| Fragment#4 |
| distribution: table PUBLIC.T2_N0N1N2 in zone ZONE_2 |
| executionNodes: [N1] |
| targetNodes: [N1] |
| colocationGroup[1]: {nodes=[N1], sourceIds=[1], assignments={part_0=N1:1}, partitionsWithConsistencyTokens={N1=[part_0:1]}} |
| partitions: [T2_N0N1N2=[N1={0}]] |
| tree: |
| Sender |
| distribution: table PUBLIC.T3_N1N2 in zone ZONE_3 by [ID] |
| targetFragmentId: 3 |
| est: (rows=33301) |
| TableScan |
| table: PUBLIC.T2_N0N1N2 |
| predicate: =(C1, 5) |
| fieldNames: [ID, C1, C2] |
| est: (rows=33301) |
| --- |
| # everything is colocated |
| N1 |
| SELECT * FROM t2_n0n1n2 as t1, t3_n1n2 as t2 WHERE t1.id = t2.id AND t1.c1 = 5 |
| --- |
| Fragment#2 root |
| distribution: single |
| executionNodes: [N1] |
| exchangeSourceNodes: {3=[N1]} |
| colocationGroup[-1]: {nodes=[N1], sourceIds=[-1, 3], assignments={}, partitionsWithConsistencyTokens={N1=[]}} |
| colocationGroup[3]: {nodes=[N1], sourceIds=[-1, 3], assignments={}, partitionsWithConsistencyTokens={N1=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID0, C10, C20, ID, C1, C2] |
| sourceFragmentId: 3 |
| est: (rows=1) |
| |
| Fragment#3 |
| distribution: table PUBLIC.T3_N1N2 in zone ZONE_3 |
| executionNodes: [N1] |
| targetNodes: [N1] |
| exchangeSourceNodes: {4=[N1]} |
| colocationGroup[0]: {nodes=[N1], sourceIds=[0, 4], assignments={part_0=N1:1}, partitionsWithConsistencyTokens={N1=[part_0:1]}} |
| colocationGroup[4]: {nodes=[N1], sourceIds=[0, 4], assignments={part_0=N1:1}, partitionsWithConsistencyTokens={N1=[part_0:1]}} |
| partitions: [T3_N1N2=[N1={0}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 2 |
| est: (rows=15000) |
| Project |
| fieldNames: [ID0, C10, C20, ID, C1, C2] |
| projection: [ID$0, C1$0, C2$0, ID, C1, C2] |
| est: (rows=15000) |
| HashJoin |
| predicate: =(ID$0, ID) |
| fieldNames: [ID, C1, C2, ID$0, C1$0, C2$0] |
| type: inner |
| est: (rows=15000) |
| TableScan |
| table: PUBLIC.T3_N1N2 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100003) |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 4 |
| est: (rows=1) |
| |
| Fragment#4 |
| distribution: table PUBLIC.T2_N0N1N2 in zone ZONE_2 |
| executionNodes: [N1] |
| targetNodes: [N1] |
| colocationGroup[1]: {nodes=[N1], sourceIds=[1], assignments={part_0=N1:1}, partitionsWithConsistencyTokens={N1=[part_0:1]}} |
| partitions: [T2_N0N1N2=[N1={0}]] |
| tree: |
| Sender |
| distribution: table PUBLIC.T3_N1N2 in zone ZONE_3 by [ID] |
| targetFragmentId: 3 |
| est: (rows=33301) |
| TableScan |
| table: PUBLIC.T2_N0N1N2 |
| predicate: =(C1, 5) |
| fieldNames: [ID, C1, C2] |
| est: (rows=33301) |
| --- |
| # everything is colocated, but from different root |
| N2 |
| SELECT * FROM t2_n0n1n2 as t1, t3_n1n2 as t2 WHERE t1.id = t2.id AND t1.c1 = 5 |
| --- |
| Fragment#2 root |
| distribution: single |
| executionNodes: [N2] |
| exchangeSourceNodes: {3=[N2]} |
| colocationGroup[-1]: {nodes=[N2], sourceIds=[-1, 3], assignments={}, partitionsWithConsistencyTokens={N2=[]}} |
| colocationGroup[3]: {nodes=[N2], sourceIds=[-1, 3], assignments={}, partitionsWithConsistencyTokens={N2=[]}} |
| tree: |
| Receiver |
| fieldNames: [ID0, C10, C20, ID, C1, C2] |
| sourceFragmentId: 3 |
| est: (rows=1) |
| |
| Fragment#3 |
| distribution: table PUBLIC.T3_N1N2 in zone ZONE_3 |
| executionNodes: [N2] |
| targetNodes: [N2] |
| exchangeSourceNodes: {4=[N2]} |
| colocationGroup[0]: {nodes=[N2], sourceIds=[0, 4], assignments={part_0=N2:1}, partitionsWithConsistencyTokens={N2=[part_0:1]}} |
| colocationGroup[4]: {nodes=[N2], sourceIds=[0, 4], assignments={part_0=N2:1}, partitionsWithConsistencyTokens={N2=[part_0:1]}} |
| partitions: [T3_N1N2=[N2={0}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 2 |
| est: (rows=15000) |
| Project |
| fieldNames: [ID0, C10, C20, ID, C1, C2] |
| projection: [ID$0, C1$0, C2$0, ID, C1, C2] |
| est: (rows=15000) |
| HashJoin |
| predicate: =(ID$0, ID) |
| fieldNames: [ID, C1, C2, ID$0, C1$0, C2$0] |
| type: inner |
| est: (rows=15000) |
| TableScan |
| table: PUBLIC.T3_N1N2 |
| fieldNames: [ID, C1, C2] |
| est: (rows=100003) |
| Receiver |
| fieldNames: [ID, C1, C2] |
| sourceFragmentId: 4 |
| est: (rows=1) |
| |
| Fragment#4 |
| distribution: table PUBLIC.T2_N0N1N2 in zone ZONE_2 |
| executionNodes: [N2] |
| targetNodes: [N2] |
| colocationGroup[1]: {nodes=[N2], sourceIds=[1], assignments={part_0=N2:1}, partitionsWithConsistencyTokens={N2=[part_0:1]}} |
| partitions: [T2_N0N1N2=[N2={0}]] |
| tree: |
| Sender |
| distribution: table PUBLIC.T3_N1N2 in zone ZONE_3 by [ID] |
| targetFragmentId: 3 |
| est: (rows=33301) |
| TableScan |
| table: PUBLIC.T2_N0N1N2 |
| predicate: =(C1, 5) |
| fieldNames: [ID, C1, C2] |
| est: (rows=33301) |
| --- |