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

How to improve query performance. - forum topic by rtakle_d

$
0
0

Hi ,
 
Below Mention Query is running in Orlace however i now this not correct place to ask oracle question here .
anyone can suggest how i can tune below mention query because it's taking 5 hrs in oracle .I have created index for all group by columns .

Delete From RX_IN where ROWID IN (
SELECT RX1.ROWID FROM ( SELECT MBR_KEY, RX_NDC, RX_FILLED_DT , RX_NBR, FILLED_REFILS_NBR,  CLM_NBR, CLM_DISP_CD,
ROW_NUMBER() OVER(PARTITION BY MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR,CLM_DISP_CD
  ORDER    BY MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR, CLM_DISP_CD) AS CHECKING FROM RX_IN WHERE CLM_DISP_CD='ORGNL' ) RX1
 INNER JOIN  ( SELECT MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR, CLM_DISP_CD,
 ROW_NUMBER() OVER(PARTITION BY MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR,CLM_DISP_CD
 ORDER    BY MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR, CLM_DISP_CD) AS CHECKING FROM RX_IN WHERE CLM_DISP_CD='RVRSL' ) RX2   
 ON RX1.MBR_KEY= RX2.MBR_KEY AND RX1.RX_NDC = RX2.RX_NDC AND RX1.RX_FILLED_DT=RX2.RX_FILLED_DT AND RX1.RX_NBR=RX2.RX_NBR AND RX1.FILLED_REFILS_NBR=RX2.FILLED_REFILS_NBR
 AND RX1.CLM_NBR=RX2.CLM_NBR AND RX1.CHECKING=RX2.CHECKING
 
 UNION
 
  SELECT RX2.ROWID FROM ( SELECT MBR_KEY, RX_NDC, RX_FILLED_DT , RX_NBR, FILLED_REFILS_NBR,  CLM_NBR, CLM_DISP_CD,
 ROW_NUMBER() OVER(PARTITION BY MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR,CLM_DISP_CD
 ORDER    BY MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR, CLM_DISP_CD) AS CHECKING FROM RX_IN WHERE CLM_DISP_CD='ORGNL' ) RX1
 INNER JOIN  ( SELECT MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR, CLM_DISP_CD,
 ROW_NUMBER() OVER(PARTITION BY MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR,CLM_DISP_CD
 ORDER    BY MBR_KEY, RX_NDC, RX_FILLED_DT, RX_NBR, FILLED_REFILS_NBR,  CLM_NBR, CLM_DISP_CD) AS CHECKING FROM RX_IN WHERE CLM_DISP_CD='RVRSL' ) RX2 
 ON RX1.MBR_KEY= RX2.MBR_KEY AND RX1.RX_NDC = RX2.RX_NDC AND RX1.RX_FILLED_DT=RX2.RX_FILLED_DT AND RX1.RX_NBR=RX2.RX_NBR AND RX1.FILLED_REFILS_NBR=RX2.FILLED_REFILS_NBR
 AND RX1.CLM_NBR=RX2.CLM_NBR AND RX1.CHECKING=RX2.CHECKING
)

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>