Hi all,
I have a query to be tuned for performance. The reason being its using a table ORDER_LI which is having huge volume of data. I am using the indexed columns only. But as I have a SUM function in the query i dont think it will help. Please provide me some pointers to improve the performance.
SELECT 'VSN' AS DTL_TYPE
, DL.OCCURENCE_NO AS DTL1
, DL.DEAL_NO AS DEAL
, CC.CUST_NO AS CUST_NO
, CC.CUST_NM AS CUST_NM
, CC.CUST_CITY_NM AS CITY_NM
, OL.ORIG_HIER_ID AS DTL2
, DL.PERF_OPT_CD AS DTL3
, OL.REP_SLS_ORGN_ID AS DTL4
, CHAR(VL.STRT_DT) AS DTL5
, CHAR(VL.END_DT) AS DTL6
, VL.SLS_CHNL_ID AS DTL7
, CHAR(VL.TOT_SPND_TO_DT_AMT) AS DTL8
, SUM(OL.SHIP_QT) AS QUANTITY
, SUM(DL.DEAL_DOL_AM) AS AMOUNT
FROM TESTQ.DEAL_LI DL
, TESTQ.ORDER_LI OL
, TESTQ.VSN_DEAL_LEVEL VL
, TESTQ.CUSTOMER_COMMON CC
WHERE DL.DEAL_NO = 'BA4Y'
AND DL.ORD_NO = OL.ORD_NO
AND DL.ORD_ITEM_NO = OL.ORD_ITEM_NO
AND OL.ORIG_CUST_NO = '1990663'
AND OL.ORIG_HIER_ID = '0C2'
AND OL.ORIG_CUST_NO = CC.CUST_NO
AND VL.OCCURENCE_NO = DL.OCCURENCE_NO
AND DL.SL_STS_IN IN('999','000')
AND VL.OCCURENCE_VERS_NO =
( SELECT MAX(VL1.OCCURENCE_VERS_NO)
FROM TESTQ.VSN_DEAL_LEVEL VL1
WHERE VL1.OCCURENCE_NO = VL.OCCURENCE_NO )
GROUP BY DL.OCCURENCE_NO
, DL.DEAL_NO
, CC.CUST_NO
, CC.CUST_NM
, CC.CUST_CITY_NM
, OL.ORIG_HIER_ID
, DL.PERF_OPT_CD
, OL.REP_SLS_ORGN_ID
, VL.STRT_DT
, VL.END_DT
, VL.SLS_CHNL_ID
, VL.TOT_SPND_TO_DT_AMT
Thanks In advance,
Ambili.
PERFORMANCE TUNING.
Moderators: Kalicharan, Moderator Group
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page