Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Why the Optimiser does not run these STATS in parallel ? - forum topic by mjasrotia

$
0
0

I am ranking my Product Level Data on the basis of higher grains of Products (Product=>BrandFamily=>Category=>Manufacturer). If all the Rank functions are indeoendent then Why Teradata does not run these steps in Parallel and not in Sequence. I have pasted below the Query and Explain. Can any one tell me if there is a better way of running these in Parallel
I have just mentiioned 5  of these Ranks. I actually have 30 of these Rank Attributes. We need these for Analytical reasons. Any help would be really appreciated
Thanks...Manik

SELECT
Region_Id
,CATG_ID
,MFG_ID
,BRND_FMLY_ID
,Material_ID
,Prod_Id
,Tot_Vol
,Neg_Vol
,CASE
WHEN
ROW_NUMBER() OVER (PARTITION BY Region_Id , Catg_Id,Store_Id ORDER BY Store_Id) = 1
THEN 1
ELSE 0
END AS R_C_RC_Dense_Rnk	

,CASE
WHEN
ROW_NUMBER() OVER (PARTITION BY Region_Id , Mfg_Id,Store_Id ORDER BY Store_Id) = 1
THEN 1
ELSE 0
END AS R_M_RC_Dense_Rnk	

,CASE
WHEN
ROW_NUMBER() OVER (PARTITION BY Region_Id , BRND_FMLY_ID,Store_Id ORDER BY Store_Id) = 1
THEN 1
ELSE 0
END AS R_B_RC_Dense_Rnk	

,CASE
WHEN
ROW_NUMBER() OVER (PARTITION BY Region_Id , Material_Id ,Store_Id ORDER BY Store_Id) = 1
THEN 1
ELSE 0
END AS R_R_RC_Dense_Rnk	

,CASE
WHEN
ROW_NUMBER() OVER (PARTITION BY Region_Id , Prod_Id ,Store_Id ORDER BY Store_Id) = 1
THEN 1
ELSE 0
END AS R_I_RC_Dense_Rnk	

FROM MIM_TMP.RETAIL_SHIPMENT_DENSE

 

1) First, we lock a distinct MIM_TMP."pseudo table" for read on a
     RowHash to prevent global deadlock for
     MIM_TMP.RETAIL_SHIPMENT_DENSE. 
  2) Next, we lock MIM_TMP.RETAIL_SHIPMENT_DENSE for read. 
  3) We do an all-AMPs STAT FUNCTION step from
     MIM_TMP.RETAIL_SHIPMENT_DENSE by way of an all-rows scan with no
     residual conditions into Spool 5 (Last Use), which is
     redistributed by hash code to all AMPs.  The result rows are put
     into Spool 3 (all_amps), which is built locally on the AMPs.  The
     size is estimated with low confidence to be 11,373,072 rows (
     1,614,976,224 bytes). 
  4) We do an all-AMPs STAT FUNCTION step from Spool 3 (Last Use) by
     way of an all-rows scan into Spool 8 (Last Use), which is
     redistributed by hash code to all AMPs.  The result rows are put
     into Spool 7 (all_amps), which is built locally on the AMPs.  The
     size is estimated with low confidence to be 11,373,072 rows (
     1,705,960,800 bytes). 
  5) We do an all-AMPs STAT FUNCTION step from Spool 7 (Last Use) by
     way of an all-rows scan into Spool 11 (Last Use), which is
     redistributed by hash code to all AMPs.  The result rows are put
     into Spool 10 (all_amps), which is built locally on the AMPs.  The
     size is estimated with low confidence to be 11,373,072 rows (
     2,206,375,968 bytes). 
  6) We do an all-AMPs STAT FUNCTION step from Spool 10 (Last Use) by
     way of an all-rows scan into Spool 14 (Last Use), which is
     redistributed by hash code to all AMPs.  The result rows are put
     into Spool 13 (all_amps), which is built locally on the AMPs.  The
     size is estimated with low confidence to be 11,373,072 rows (
     1,751,453,088 bytes). 
  7) We do an all-AMPs STAT FUNCTION step from Spool 13 (Last Use) by
     way of an all-rows scan into Spool 17 (Last Use), which is
     redistributed by hash code to all AMPs.  The result rows are put
     into Spool 1 (group_amps), which is built locally on the AMPs. 
     The size is estimated with low confidence to be 11,373,072 rows (
     2,047,152,960 bytes). 
  8) Finally, we send out an END TRANSACTION step to all AMPs involved
     in processing the request.
  -> The contents of Spool 1 are sent back to the user as the result of
     statement 1. 

 
 

Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>