my fault ;)
looks much better :)
but...
I next comment wrote, that typically i will join 6 or more partitions. here is example view:
Create view WIDE as
Select
a0.ID as ID,
a0.DATA as DATA0,
a1.DATA as DATA1,
a2.DATA as DATA2,
a3.DATA as DATA3,
a4.DATA as DATA4,
a5.DATA as DATA5,
a6.DATA as DATA6,
a7.DATA as DATA7,
a8.DATA as DATA8,
a9.DATA as DATA9,
a10.DATA as DATA10,
a11.DATA as DATA11
from SRC a0
left join SRC a1 on a0.ID=a1.ID and a0.PART='01' and a1.PART='02'
left join SRC a2 on a0.ID=a2.ID and a0.PART='01' and a2.PART='03'
left join SRC a3 on a0.ID=a3.ID and a0.PART='01' and a3.PART='04'
left join SRC a4 on a0.ID=a4.ID and a0.PART='01' and a4.PART='05'
left join SRC a5 on a0.ID=a5.ID and a0.PART='01' and a5.PART='06'
left join SRC a6 on a0.ID=a6.ID and a0.PART='01' and a6.PART='07'
left join SRC a7 on a0.ID=a7.ID and a0.PART='01' and a7.PART='08'
left join SRC a8 on a0.ID=a8.ID and a0.PART='01' and a8.PART='09'
left join SRC a9 on a0.ID=a9.ID and a0.PART='01' and a9.PART='10'
left join SRC a10 on a0.ID=a10.ID and a0.PART='01' and a10.PART='11'
left join SRC a11on a0.ID=a11.ID and a0.PART='01' and a11.PART='12'
where a0.PART='01';
commit;
TD can efficiently remove not important references, but in mu opinion join method is still not efficient. TD wants to join table by table. it is very simple star schema, and, i think, TD should join all in one step (parallel sort, then merge).
I tried this scenario in ORACLE and i had similar problems. It has had significiant impact (ten or more times slower than expected).
Explanation (1)
---------------------------------------------------------------------------
1) First, we lock a distinct SAS."pseudo table" for read on a RowHash to prevent global deadlock for SAS.a0.
2) Next, we lock SAS.a0 in view wide for read.
3) We do an all-AMPs RETRIEVE step from SAS.a0 in view wide by way of an all-rows scan with no residual conditions into Spool 2 (group_amps), which is built locally on the AMPs. The size of Spool 2 is estimated with low confidence to be 2 rows (92 bytes). The estimated time for this step is 0.03 seconds.
4) Finally, we send out an END TRANSACTION step to all AMPs involved in processing the request.
-> The contents of Spool 2 are sent back to the user as the result of
statement 1. The total estimated time is 0.03 seconds.
explain select * from wide;
*** Help information returned. 134 rows.
*** Total elapsed time was 1 second.
Explanation
---------------------------------------------------------------------------
1) First, we lock a distinct SAS."pseudo table" for read on a RowHash to prevent global deadlock for SAS.a0.
2) Next, we lock SAS.a0 in view wide for read.
3) We do an all-AMPs RETRIEVE step from SAS.a0 in view wide by way of an all-rows scan with a condition of ("SAS.a0 in view wide.PART = '01'") into Spool 3 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '02') to all AMPs. Then we do a SORT to order Spool 3 by row hash. The size of Spool 3 is estimated with high confidence to be 2,000 rows (56,000 bytes). The estimated time for this step is 0.07 seconds.
4) We do an all-AMPs JOIN step from Spool 3 (Last Use) by way of a RowHash match scan, which is joined to SAS.a1 in view wide by way of a RowHash match scan with a condition of ("SAS.a1 in view wide.PART = '02'"). Spool 3 and SAS.a1 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a1.ID"). The result goes into Spool 4 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '05') to all AMPs. Then we do a SORT to order Spool 4 by row hash. The size of Spool 4 is estimated with low confidence to be 2,000 rows (72,000 bytes). The estimated time for this step is 0.09 seconds.
5) We do an all-AMPs JOIN step from Spool 4 (Last Use) by way of a RowHash match scan, which is joined to SAS.a4 in view wide by way of a RowHash match scan with a condition of ("SAS.a4 in view wide.PART = '05'"). Spool 4 and SAS.a4 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a4.ID"). The result goes into Spool 5 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '06') to all AMPs. Then we do a SORT to order Spool 5 by row hash. The size of Spool 5 is estimated with low confidence to be 2,000 rows (88,000 bytes). The estimated time for this step is 0.09 seconds.
6) We do an all-AMPs JOIN step from Spool 5 (Last Use) by way of a RowHash match scan, which is joined to SAS.a5 in view wide by way of a RowHash match scan with a condition of ("SAS.a5 in view wide.PART = '06'"). Spool 5 and SAS.a5 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a5.ID"). The result goes into Spool 6 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '07') to all AMPs. Then we do a SORT to order Spool 6 by row hash. The size of Spool 6 is estimated with low confidence to be 2,000 rows (104,000 bytes). The estimated time for this step is 0.09 seconds.
7) We do an all-AMPs JOIN step from Spool 6 (Last Use) by way of a RowHash match scan, which is joined to SAS.a6 in view wide by way of a RowHash match scan with a condition of ("SAS.a6 in view wide.PART = '07'"). Spool 6 and SAS.a6 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a6.ID"). The result goes into Spool 7 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '08') to all AMPs. Then we do a SORT to order Spool 7 by row hash. The size of Spool 7 is estimated with low confidence to be 2,000 rows (120,000 bytes). The estimated time for this step is 0.09 seconds.
8) We do an all-AMPs JOIN step from Spool 7 (Last Use) by way of a RowHash match scan, which is joined to SAS.a7 in view wide by way of a RowHash match scan with a condition of ("SAS.a7 in view wide.PART = '08'"). Spool 7 and SAS.a7 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a7.ID"). The result goes into Spool 8 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '09') to all AMPs. Then we do a SORT to order Spool 8 by row hash. The size of Spool 8 is estimated with low confidence to be 2,000 rows (136,000 bytes). The estimated time for this step is 0.09 seconds.
9) We do an all-AMPs JOIN step from Spool 8 (Last Use) by way of a RowHash match scan, which is joined to SAS.a8 in view wide by way of a RowHash match scan with a condition of ("SAS.a8 in view wide.PART = '09'"). Spool 8 and SAS.a8 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a8.ID"). The result goes into Spool 9 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '11') to all AMPs. Then we do a SORT to order Spool 9 by row hash. The size of Spool 9 is estimated with low confidence to be 2,000 rows (152,000 bytes). The estimated time for this step is 0.09 seconds.
10) We do an all-AMPs JOIN step from Spool 9 (Last Use) by way of a RowHash match scan, which is joined to SAS.a10 in view wide by way of a RowHash match scan with a condition of ("SAS.a10 in view wide.PART = '11'"). Spool 9 and SAS.a10 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a10.ID"). The result goes into Spool 10 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '03') to all AMPs. Then we do a SORT to order Spool 10 by row hash. The size of Spool 10 is estimated with low confidence to be 2,000 rows ( 168,000 bytes). The estimated time for this step is 0.09 seconds.
11) We do an all-AMPs JOIN step from Spool 10 (Last Use) by way of a RowHash match scan, which is joined to SAS.a2 in view wide by way of a RowHash match scan with a condition of ("SAS.a2 in view wide.PART = '03'"). Spool 10 and SAS.a2 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a2.ID"). The result goes into Spool 11 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '04') to all AMPs. Then we do a SORT to order Spool 11 by row hash. The size of Spool 11 is estimated with low confidence to be 2,009 rows ( 184,828 bytes). The estimated time for this step is 0.09 seconds.
12) We do an all-AMPs JOIN step from Spool 11 (Last Use) by way of a RowHash match scan, which is joined to SAS.a3 in view wide by way of a RowHash match scan with a condition of ("SAS.a3 in view wide.PART = '04'"). Spool 11 and SAS.a3 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a3.ID"). The result goes into Spool 12 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '10') to all AMPs. Then we do a SORT to order Spool 12 by row hash. The size of Spool 12 is estimated with low confidence to be 2,053 rows ( 205,300 bytes). The estimated time for this step is 0.10 seconds.
13) We do an all-AMPs JOIN step from Spool 12 (Last Use) by way of a RowHash match scan, which is joined to SAS.a9 in view wide by way of a RowHash match scan with a condition of ("SAS.a9 in view wide.PART = '10'"). Spool 12 and SAS.a9 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a9.ID"). The result goes into Spool 13 (all_amps), which is redistributed by the hash code of (SAS.a0.ID, '12') to all AMPs. Then we do a SORT to order Spool 13 by row hash. The size of Spool 13 is estimated with low confidence to be 2,125 rows ( 229,500 bytes). The estimated time for this step is 0.10 seconds.
14) We do an all-AMPs JOIN step from Spool 13 (Last Use) by way of a RowHash match scan, which is joined to SAS.a11 in view wide by way of a RowHash match scan with a condition of ("SAS.a11 in view wide.PART = '12'"). Spool 13 and SAS.a11 are left outer joined using a merge join, with condition(s) used for non-matching on left table ("PART = '01'"), with a join condition of ("ID = SAS.a11.ID"). The result goes into Spool 2 (group_amps), which is built locally on the AMPs. The size of Spool 2 is estimated with low confidence to be 2,211 rows (643,401 bytes). The estimated time for this step is 0.11 seconds.
15) Finally, we send out an END TRANSACTION step to all AMPs involved in processing the request.
-> The contents of Spool 2 are sent back to the user as the result of statement 1. The total estimated time is 1.09 seconds.
↧