Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Fine tuning a query - response (7) by Jessy Mahesh Kothapalli

$
0
0
Unequality operators query :-

SELECT   WC_SPARES_STOCK_F.ROW_WID, ETL_PROC_WID , PR_VIS_ORG_WID  , INVLOC_WID, PROD_WID, CLOSING as OPENING, 0 as SHIP, 0 as RECEIVE, CLOSING, StartDT.CALENDAR_DATE as StartDT,  EndDT.CALENDAR_DATE as EndDT , DEALER_NAME, BU_NAME, PROD_NAME,PROD_DESC,PROD_UOM, FABRIC_CD,TM_IND, LOCATION_NAME, StartDT.ROW_WID as START_DT_WID,  EndDT.ROW_WID as END_DT_WID,
PRODINV_CLOSING as PRODINV_OPENING , PRODINV_CLOSING,WEIGHTED_AVG
FROM WC_SPARES_STOCK_F, W_DAY_D StartDT, W_DAY_D EndDT 
WHERE (  
StartDT.ROW_WID > TXN_DT_WID 
AND StartDT.ROW_WID <= VALID_DT_WID
AND StartDT.ROW_WID <= EndDT.ROW_WID)

Explain Plan :-

  is eligible for synchronized scanning.  The result goes into Spool
     4 (all_amps), which is built locally on the AMPs.  The result
     spool file will not be cached in memory.  The size of Spool 4 is
     estimated with low confidence to be 862,271,585,302 rows (
     318,178,214,976,438 bytes).  The estimated time for this step is
     72 hours and 47 minutes. 
  6) We do an all-AMPs JOIN step from Spool 2 (Last Use) by way of an
     all-rows scan, which is joined to Spool 4 (Last Use) by way of an
     all-rows scan.  Spool 2 and Spool 4 are joined using a product
     join, with a join condition of ("ROW_WID <= ROW_WID").  The result
     goes into Spool 1 (all_amps), which is built locally on the AMPs. 
     The result spool file will not be cached in memory.  The size of
     Spool 1 is estimated with low confidence to be *** rows (***
     bytes).  The estimated time for this step is 725,506 hours and 56
     minutes. 
  7) 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.  The total estimated time is 725,579 hours and 44
     minutes. 


Equi join
SELECT   WC_SPARES_STOCK_F.ROW_WID, ETL_PROC_WID ,
 PR_VIS_ORG_WID  , INVLOC_WID, PROD_WID, CLOSING as OPENING,
  0 as SHIP, 0 as RECEIVE, CLOSING, StartDT.CALENDAR_DATE as StartDT,
EndDT.CALENDAR_DATE as EndDT , DEALER_NAME, BU_NAME, PROD_NAME,PROD_DESC,PROD_UOM, FABRIC_CD,
TM_IND, LOCATION_NAME, StartDT.ROW_WID as START_DT_WID,
 EndDT.ROW_WID as END_DT_WID,
PRODINV_CLOSING as PRODINV_OPENING , PRODINV_CLOSING,WEIGHTED_AVG
FROM WC_SPARES_STOCK_F 
INNER JOIN  W_DAY_D StartDT 
ON StartDT.ROW_WID = TXN_DT_WID
AND StartDT.ROW_WID = VALID_DT_WID
INNER JOIN W_DAY_D EndDT
ON  StartDT.ROW_WID = EndDT.ROW_WID


    memory.  The result goes into Spool 1 (all_amps), which is built
     locally on the AMPs.  The size of Spool 1 is estimated with low
     confidence to be 1,502,800 rows (680,768,400 bytes).  The
     estimated time for this step is 41.68 seconds. 
  6) 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.  The total estimated time is 41.89 seconds. 

 
How can I tune same (NON-EQUIALITY) Query please help me form this situation?
This is query (NON-EQUIALITY-above query) which we generated by OBIEE as per business logic, help me out from this situation 


Viewing all articles
Browse latest Browse all 27759

Trending Articles



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