Sure Deiter,Please find the below explain plan.It is showing as 2 min .But when I execute it,it takes more than 45 mins..
1) First, we lock KEY_T in view
KEY_1 for access, and we lock
CUST_T in view
CUST_1 for access.
2) Next, we do an all-AMPs RETRIEVE step from
CUST_T in view
CUST_1 by way of an all-rows scan
with a condition of ("(CUST_T in view
CUST_1.CUST_ID <> 0) AND
((CUST_T in view
CUST_1.DOMN_ID )= 'W')")
into Spool 4 (all_amps), which is redistributed by the rowkey of (
CUST_T.FIRST_DT,
CUST_T.VISITOR_ID) to all AMPs.
Then we do a SORT to partition Spool 4 by rowkey. The size of
Spool 4 is estimated with low confidence to be 417,736,528 rows (
10,861,149,728 bytes). The estimated time for this step is 48.61
seconds.
3) We do an all-AMPs JOIN step from Spool 4 (Last Use) by way of a
RowHash match scan, which is joined to
KEY_T in view
KEY_1 by way of a RowHash match
scan with a condition of ("(KEY_T in
view KEY_1.DOMN_ID )=
'W'"). Spool 4 and KEY_T are joined
using a rowkey-based merge join, with a join condition of (
"(FIRST_DT =
KEY_T.DW_CREAT_DT)
AND ((VISITOR_ID =
KEY_T.VISITOR_ID) AND
((DOMN_ID )=
(KEY_T.DOMN_ID )))"). The
input table KEY_T will not be cached
in memory. The result goes into Spool 3 (all_amps), which is
built locally on the AMPs. The size of Spool 3 is estimated with
no confidence to be 54,250,291 rows (5,967,532,010 bytes). The
estimated time for this step is 21.80 seconds.
4) We do an all-AMPs SUM step to aggregate from Spool 3 (Last Use) by
way of an all-rows scan , grouping by field1 (
KEY_T.SRCE_VISITOR_ID
,CUST_T.CUST_ID). Aggregate
Intermediate Results are computed globally, then placed in Spool 5.
The aggregate spool file will not be cached in memory. The size
of Spool 5 is estimated with no confidence to be 54,250,291 rows (
20,181,108,252 bytes). The estimated time for this step is 1
minute and 13 seconds.
5) We do an all-AMPs RETRIEVE step from Spool 5 (Last Use) by way of
an all-rows scan into Spool 1 (group_amps), which is built locally
on the AMPs. The size of Spool 1 is estimated with no confidence
to be 54,250,291 rows (6,618,535,502 bytes). The estimated time
for this step is 2.22 seconds.
-> The contents of Spool 1 are sent back to the user as the result of
statement 1. The total estimated time is 2 minutes and 25 seconds.
Thanks
Sure Deiter,Please find the below explain plan.It is showing as 2 min .But when I execute it,it takes more than 45 mins..
1) First, we lock KEY_T in view
KEY_1 for access, and we lock
CUST_T in view
CUST_1 for access.
2) Next, we do an all-AMPs RETRIEVE step from
CUST_T in view
CUST_1 by way of an all-rows scan
with a condition of ("(CUST_T in view
CUST_1.CUST_ID <> 0) AND
((CUST_T in view
CUST_1.DOMN_ID )= 'W')")
into Spool 4 (all_amps), which is redistributed by the rowkey of (
CUST_T.FIRST_DT,
CUST_T.VISITOR_ID) to all AMPs.
Then we do a SORT to partition Spool 4 by rowkey. The size of
Spool 4 is estimated with low confidence to be 417,736,528 rows (
10,861,149,728 bytes). The estimated time for this step is 48.61
seconds.
3) We do an all-AMPs JOIN step from Spool 4 (Last Use) by way of a
RowHash match scan, which is joined to
KEY_T in view
KEY_1 by way of a RowHash match
scan with a condition of ("(KEY_T in
view KEY_1.DOMN_ID )=
'W'"). Spool 4 and KEY_T are joined
using a rowkey-based merge join, with a join condition of (
"(FIRST_DT =
KEY_T.DW_CREAT_DT)
AND ((VISITOR_ID =
KEY_T.VISITOR_ID) AND
((DOMN_ID )=
(KEY_T.DOMN_ID )))"). The
input table KEY_T will not be cached
in memory. The result goes into Spool 3 (all_amps), which is
built locally on the AMPs. The size of Spool 3 is estimated with
no confidence to be 54,250,291 rows (5,967,532,010 bytes). The
estimated time for this step is 21.80 seconds.
4) We do an all-AMPs SUM step to aggregate from Spool 3 (Last Use) by
way of an all-rows scan , grouping by field1 (
KEY_T.SRCE_VISITOR_ID
,CUST_T.CUST_ID). Aggregate
Intermediate Results are computed globally, then placed in Spool 5.
The aggregate spool file will not be cached in memory. The size
of Spool 5 is estimated with no confidence to be 54,250,291 rows (
20,181,108,252 bytes). The estimated time for this step is 1
minute and 13 seconds.
5) We do an all-AMPs RETRIEVE step from Spool 5 (Last Use) by way of
an all-rows scan into Spool 1 (group_amps), which is built locally
on the AMPs. The size of Spool 1 is estimated with no confidence
to be 54,250,291 rows (6,618,535,502 bytes). The estimated time
for this step is 2.22 seconds.
-> The contents of Spool 1 are sent back to the user as the result of
statement 1. The total estimated time is 2 minutes and 25 seconds.
Thanks