Advertisement

02.08.2005 at 11:34PM PST, ID: 21307483
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Query optimization - help required

Asked by INDIRA_K in Oracle Database

Tags: , , ,

I have a query which is having a huge performance degrade. Could you help in optimizaiton of the same.
Select
DPS_NUM,
DPS_TYPE,
DPS_STATUS,  
CUSTOMER_TYPE,
CUSTOMER_NAME,
SEVERITY_ID,
PRODUCT_NO,  
ENGG_PART_ETA,
DECODE(ENGINEER_PART_ETA_FLAG,'','None',ENGINEER_PART_ETA_FLAG) ENGINEER_PART_ETA_FLAG ,
PROBLEM_COUNT,
DPS_ALERT_FLAG,
DPS_OWNER,  
REASON_CODE,  
DPS_REPEAT_DISPATCH_FLAG,
DPS_ACK_FLAG,  
CALL_AGE,  
TAKE,  
CLAIM_ALERT_FLAG,  
REPEATDISPATCH_ALERT_FLAG,  
SEVERITY_ALERT_FLAG,  
DPS_TYPE_FLAG,  
SERVICE_ACC_DATE_TIME,
DPS_VERSION_NUM,
IS_TANDEM_CLIENT_UPDATE
FROM
        (
        SELECT
        VWJDPSIS.DPS_NUM AS DPS_NUM,
        VWJDPSIS.DPS_TYPE as DPS_TYPE,
        VWJDPSIS.DPS_STATUS as DPS_STATUS,
        ECCPRD.fnGetRefCodeValue(VWJDPSIS.CALL_TYPE,'CUSTOMERTYPE') as CUSTOMER_TYPE,
        VWJDPSIS.CUSTOMER_NAME as CUSTOMER_NAME,
        ECCPRD.fnGetRefCodeValue(VWJDPSIS.SEVERITY_ID,'SEVERITYCODE') as SEVERITY_ID,
        VWJDPSIS.BRAND_DESCRIPTION AS PRODUCT_NO,  
        substr(VWJDPSIS.ENGINEER_PART_ETA,3,28) AS ENGG_PART_ETA,
        substr(VWJDPSIS.ENGINEER_PART_ETA,1,2) ENGINEER_PART_ETA_FLAG,
        decode(PROBLEM_COUNT,NULL,0,ECCDPS.PROBLEM_COUNT) AS PROBLEM_COUNT,
        ECCDPS.DPS_ALERT_FLAG as DPS_ALERT_FLAG,
        Lower(ECCDPS.DPS_OWNER_ID) as DPS_OWNER,
        VWJDPSIS.REASON_CODE as REASON_CODE,  
        CASE WHEN  
                REASON_CODE LIKE ('02%')
        THEN
                'Y'
        ELSE  
                DPS_REPEAT_DISPATCH_FLAG END AS  DPS_REPEAT_DISPATCH_FLAG,
        DPS_ACK_FLAG AS DPS_ACK_FLAG,
        ECCPRD.fnGetCallAgeValue(SERVICE_ACC_DATE_TIME) AS CALL_AGE,  
        'Take' AS TAKE,  
        CASE WHEN  
                REASON_CODE LIKE ('01TA')
        THEN
                'Y'
        ELSE  
                'N' END AS  CLAIM_ALERT_FLAG,
        CASE WHEN
                REASON_CODE IN ( SELECT
                                INFO_VALUE
                                FROM ECCPRD.SYSTEM_INFO  
                                WHERE
                                UPPER(INFO_CATEGORY) = UPPER('ALERTTYPE')
                                AND UPPER(INFO_CODE) = UPPER('REPEAT'))  
        THEN
                'Y'
        ELSE
                'N' END AS REPEATDISPATCH_ALERT_FLAG,  
        CASE WHEN
                to_char(SEVERITY_ID) IN ( SELECT
                                        INFO_VALUE
                                        FROM ECCPRD.SYSTEM_INFO  
                                        WHERE UPPER(INFO_CATEGORY) = UPPER('ALERTTYPE')
                                        AND UPPER(INFO_CODE) = UPPER('SEVERITY'))  
        THEN
                'Y'
        ELSE
                'N' END AS SEVERITY_ALERT_FLAG,  
        VWJDPSIS.LOB_PRODUCT_DESCRIPTION AS DPS_TYPE_FLAG,  
        SERVICE_ACC_DATE_TIME,
        VWJDPSIS.DPS_VERSION_NUM ,
        VWJDPSIS.IS_TANDEM_CLIENT_UPDATE  
        FROM
        ECCPRD.JDPSIS_DPS_INFO_VIEW VWJDPSIS
                LEFT OUTER JOIN
        ECCPRD.DPS_INFO ECCDPS ON VWJDPSIS.DPS_NUM  =  ECCDPS.DPS_NUM
        WHERE  
        VWJDPSIS.DSP_CODE in
                ( SELECT
                INFO_CODE
                FROM
                ECCPRD.SYSTEM_INFO
                WHERE
                INFO_CATEGORY = 'DSPCODE')
        AND VWJDPSIS.DPS_TYPE in
                ( SELECT
                INFO_CODE
                FROM
                ECCPRD.SYSTEM_INFO
                WHERE
                INFO_CATEGORY = 'DPSTYPE'
                AND INFO_VALUE<>'NBD') AND
                (DPS_STATUS <> 'DONE'  
                AND DPS_STATUS <> 'CNL'
                AND DPS_STATUS <> 'DCNL'  
                AND DPS_STATUS <> 'CLO'
                AND DPS_STATUS <> 'DRCV'
                AND DPS_STATUS <> 'RCV'
                AND DPS_STATUS <> 'TWFA')
                AND VWJDPSIS.DPS_VERSION_NUM = (SELECT
                                                MAX(DPS_VERSION_NUM)
                                                from
                                                ECCPRD.JDPSIS_DPS_INFO_VIEW DPSIN
                                                WHERE
                                                DPSIN.DPS_NUM=VWJDPSIS.DPS_NUM)  
        UNION
        Select
        VWJDPSIS.DPS_NUM AS DPS_NUM,
        VWJDPSIS.DPS_TYPE as DPS_TYPE,
        VWJDPSIS.DPS_STATUS as DPS_STATUS,
        ECCPRD.fnGetRefCodeValue(VWJDPSIS.Call_TYPE,'CUSTOMERTYPE') as CUSTOMER_TYPE,
        VWJDPSIS.CUSTOMER_NAME as CUSTOMER_NAME,
        ECCPRD.fnGetRefCodeValue(VWJDPSIS.SEVERITY_ID,'SEVERITYCODE') as SEVERITY_ID,
        VWJDPSIS.BRAND_DESCRIPTION AS PRODUCT_NO,      
        substr(VWJDPSIS.ENGINEER_PART_ETA,3,28) AS ENGG_PART_ETA,
        DECODE(substr(VWJDPSIS.ENGINEER_PART_ETA,1,2),'','None',substr(VWJDPSIS.ENGINEER_PART_ETA,1,2))
        ENGINEER_PART_ETA_FLAG ,
        decode(PROBLEM_COUNT,NULL,0,ECCDPS.PROBLEM_COUNT) AS PROBLEM_COUNT,
        ECCDPS.DPS_ALERT_FLAG as DPS_ALERT_FLAG,
        ECCDPS.DPS_OWNER_ID as DPS_OWNER,
        ECCPRD.VWJDPSIS.REASON_CODE  as REASON_CODE,  
        CASE WHEN  
                REASON_CODE LIKE ('02%')
        THEN
                'Y'
        ELSE
                DPS_REPEAT_DISPATCH_FLAG END AS DPS_REPEAT_DISPATCH_FLAG,
        DPS_ACK_FLAG AS DPS_ACK_FLAG,
        ECCPRD.fnGetCallAgeValue(SERVICE_ACC_DATE_TIME) AS CALL_AGE,  
        'Take' AS TAKE,  
        CASE WHEN  
                REASON_CODE LIKE ('01TA')
        THEN
                'Y'
        ELSE  
                'N' END AS  CLAIM_ALERT_FLAG,
        CASE WHEN
                REASON_CODE IN ( SELECT
                                INFO_VALUE
                                FROM
                                ECCPRD.SYSTEM_INFO  
                                WHERE
                                UPPER(INFO_CATEGORY) = UPPER('ALERTTYPE')
                                AND UPPER(INFO_CODE) = UPPER('REPEAT'))  
        THEN
                'Y'
        ELSE
                'N' END AS REPEATDISPATCH_ALERT_FLAG,  
        CASE WHEN
                to_char(SEVERITY_ID) IN ( SELECT
                                        INFO_VALUE
                                        FROM
                                        ECCPRD.SYSTEM_INFO  
                                        WHERE
                                        UPPER(INFO_CATEGORY) = UPPER('ALERTTYPE') AND
                                        UPPER(INFO_CODE) = UPPER('SEVERITY'))  
        THEN
                'Y'
        ELSE
                'N' END AS SEVERITY_ALERT_FLAG,  
        VWJDPSIS.LOB_PRODUCT_DESCRIPTION AS DPS_TYPE_FLAG,  
        SERVICE_ACC_DATE_TIME,
        VWJDPSIS.DPS_VERSION_NUM,
        VWJDPSIS.IS_TANDEM_CLIENT_UPDATE  
        FROM
        ECCPRD.JDPSIS_DPS_INFO_VIEW VWJDPSIS
                LEFT OUTER JOIN
        ECCPRD.DPS_INFO ECCDPS ON VWJDPSIS.DPS_NUM  =  ECCDPS.DPS_NUM
        WHERE  
        VWJDPSIS.DSP_CODE in (SELECT
                                INFO_CODE
                                FROM
                                ECCPRD.SYSTEM_INFO
                                WHERE
                                INFO_CATEGORY = 'DSPCODE')
        AND VWJDPSIS.DPS_TYPE in (SELECT
                                INFO_CODE
                                FROM
                                ECCPRD.SYSTEM_INFO
                                WHERE
                                INFO_CATEGORY = 'DPSTYPE'
                                AND INFO_VALUE = 'NBD')
        AND (VWJDPSIS.CALL_TYPE IN(SELECT
                                INFO_CODE
                                FROM
                                ECCPRD.SYSTEM_INFO
                                WHERE  
                                info_CATEGORY='CUSTOMERTYPE'
                                AND INFO_VALUE IN ('G/K','G','K') )
        OR  
        VWJDPSIS.LOB_PRODUCT_DESCRIPTION IN ('EMC','PowerConnect')
        OR  
        VWJDPSIS.DPS_NUM IN (SELECT
                                dps_num  
                                FROM
                                ECCPRD.DPS_INFO
                                WHERE
                                dps_repeat_dispatch_flag ='Y'  )
        OR  
        REASON_CODE LIKE ('01TA')
        OR  
        REASON_CODE LIKE ('02%')
        OR  
        to_char(VWJDPSIS.SEVERITY_ID) IN ( SELECT
                                        INFO_value
                                        FROM
                                        ECCPRD.SYSTEM_INFO
                                        WHERE
                                        INFO_code='SEVERITY'
                                        AND
                                        info_CATEGORY='ALERTTYPE')
        OR  
        VWJDPSIS.DPS_NUM IN (SELECT
                                dps_num
                                FROM
                                ECCPRD.ALERT_DETAILS  
                                WHERE alert_code= 'OVER5H'
                                AND ALERT_ACTIVE_FLAG='Y'))
        AND (DPS_STATUS <> 'DONE'  
                AND DPS_STATUS <> 'CNL'
                AND DPS_STATUS <> 'DCNL'  
                AND DPS_STATUS <> 'CLO'
                AND DPS_STATUS <> 'DRCV'  
                AND DPS_STATUS <> 'RCV'
                AND DPS_STATUS <> 'TWFA')  
        AND VWJDPSIS.DPS_VERSION_NUM = (SELECT
                                        MAX(DPS_VERSION_NUM)
                                        from
                                        ECCPRD.JDPSIS_DPS_INFO_VIEW DPSIN
                                        WHERE
                                        DPSIN.DPS_NUM=VWJDPSIS.DPS_NUM) )
        ORDER BY DPS_NUM DESC
Start Free Trial
[+][-]02.09.2005 at 02:11AM PST, ID: 13262291

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Tags: query, decode, optimizaiton, optimization
Sign Up Now!
Solution Provided By: morphman
Participating Experts: 4
Solution Grade: A
 
 
[+][-]02.09.2005 at 05:48AM PST, ID: 13263613

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.09.2005 at 12:21PM PST, ID: 13268674

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.09.2005 at 01:08PM PST, ID: 13269150

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.09.2005 at 09:42PM PST, ID: 13272456

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2005 at 04:52AM PDT, ID: 14303291

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.30.2005 at 08:32AM PDT, ID: 14339227

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32