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

Fine tuning a query - response (9) by kk_newuser

$
0
0

Hi Mahesh,
 
> collect the stats on where clause columns as explain show the low confidence on each step.
> You can add the where clause columns to Primary index if its unique and usage is more . or create the Secondary Index on those columns which can create and drop at any time.
> Mention the table alias properly before the column names in where caluse as its doing product Join.
 
Try this,
 

SELECT   WC_SPARES_STOCK_F.ROW_WID, ETL_PROC_WID , PR_VIS_ORG_WID  , INVLOC_WID, PROD_WID, CLOSING asOPENING, 0 asSHIP, 0 asRECEIVE, CLOSING, StartDT.CALENDAR_DATE asStartDT,  EndDT.CALENDAR_DATE asEndDT , DEALER_NAME, BU_NAME, PROD_NAME,PROD_DESC,PROD_UOM, FABRIC_CD,TM_IND, LOCATION_NAME, StartDT.ROW_WID asSTART_DT_WID,  EndDT.ROW_WID asEND_DT_WID,

PRODINV_CLOSING asPRODINV_OPENING , PRODINV_CLOSING,WEIGHTED_AVG

FROMWC_SPARES_STOCK_F as STK 

Inner Join W_DAY_D StartDT on 

StartDT.ROW_WID > STK.TXN_DT_WID 

and StartDT.ROW_WID <= VALID_DT_WID

inner join W_DAY_D EndDT  on

StartDT.ROW_WID <= EndDT.ROW_WID)

 

Let me know if it works.
 
 
 

 


Viewing all articles
Browse latest Browse all 27759

Trending Articles



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