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
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 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.
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
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 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.