Reducing the Cost of the query by indexing.

Hello,
I have a query as under :
SELECT T1_WO.WO_ID, T1_RW_MSG.RMSG_FN_ID, T1_RW_MSG.RMSG_PROD_CD, T1_RW_MSG.RMSG_OPRN_CD, T1_WO.WO_ENTRY_DT, T1_RW_MSG.RMSG_OUR_REF_NUM, T1_WO.WO_CURR_QUEUE, T1_WO.WO_PRIORITY, T1_WO.WO_STATUS_CD, T1_RW_MSG.RMSG_TRANS_MD, T1_RW_MSG.RMSG_SRC_TYP, T1_WO.WO_TYP_FLG, T1_WO.WO_DEQUEUE_DT, T1_RW_MSG.RMSG_BTCH_ID, T1_RW_MSG.RMSG_SEQ_NUM_IN_BTCH, T1_WO.WO_FRM_QUEUE , T1_WO.WO_ORIG_ENTRY_DT,T1_WO.WO_SRC_TYP, T1_RW_MSG.RMSG_TILIS_PROC_LOC FROM T1_RW_MSG, T1_WO WHERE ( T1_RW_MSG.RMSG_FN_ID = T1_WO.RMSG_FN_ID ) AND ( T1_WO.WO_TYP_FLG = 'R') AND ( ( T1_WO.WO_ERR_FLG = 'F' ) AND ( T1_WO.WO_BSY_FLG = 'F' ) AND (T1_WO.WO_CURR_QUEUE IN ('MUMBAISAP','CCD19SAP') OR (T1_WO.WO_CURR_QUEUE IN ('') AND T1_WO.WO_FRM_ROLE_INSTANCE = 'CCD19SAP') OR (T1_WO.WO_CURR_QUEUE IN ('') AND T1_WO.WO_FRM_ROLE_INSTANCE <> 'CCD19SAP')) )
ORDER BY T1_WO.WO_PRIORITY DESC, T1_WO.WO_ENTRY_DT ASC;
This query has an ORDER BY clause wherein two columns
WO_PRIORITY DESC,WO_ENTRY_DT are used which are not indexed.
These columns are not indexed.Now I try to reduce the cost of these query by indexing these columns WO_PRIORITY DESC,WO_ENTRY_DT.Will this reduce the cost of the query.
Message was edited by:
UdayM

wrap your code in [code] and [/code] tags to preserve the formatting you will do to make it readable. You're unlikely to get much help if you make it hard to read.
an example of code formatting:
WITH t1_wo AS (SELECT 'a' wo_curr_queue from dual
               UNION
               SELECT to_char(null) from dual
               UNION
               SELECT '' from dual)
  SELECT *
  FROM t1_wo
  WHERE t1_wo.wo_curr_queue IN ('')Interestingly, that returns no rows, which makes me suspect that the sections of your query that include t1_wo.wo_curr_queue IN ('') will never work.

Similar Messages

  • Can JDBS calculate the cost of a query ?

    In the past I worked with DB2 and I know that it has a feature that can calculate the cost of a query before executing it. Now I have to work with sybase.
    I would like to know if there is any way to get that cost in order to decide whether to execute the query or not. In the same way, I would prefer a standard method:
    Does JDBC provide a way? Is there any other standard way, using java? Is there any way possible way?, it may be not standard or not java.
    Thanks a lot.

    Most databases provide a way to do this. The most common verbage for this is "EXPLAIN".
    Some of them might expose it via SQL. But that depends on the database.
    I suspect there might also be problems with capturing the output.
    The most likely way that I can think is if you can encapsulate it in a stored procedure. At the very least you could just call the stored procedure. Or doing it that way might allow you to figure out how to do it via direct SQL calls.

  • Ordered item to absorb the cost of the free goods

    We have created an exclusive free goods agreement and we would like the ordered item to absorb the cost of the free goods.  In order to transfer the correct information to CO-PA from SD billing, what should we do? Can anybody explain briefly?

    Hi Yasar,
    we do the setting for this in copy controls from delivery to billing.
    pl go to t.code VTFL, select the item which is required to abasorb the cost.
    there you will find a check box " cummulate cost ". Tick it here, this will make the cost of the free item to be transferred to the main item. This can also be used even incase of BOM's.
    regards
    sadhu kishore

  • All of a sudden my desktop apps and files went missing.what is the cost of the problem

    all of a sudden, my desktop applications, (i mean the whole applications and files,document in my desktop), went missing .what could be the cost of the problem?

    all of a sudden, my desktop applications, (i mean the whole applications and files,document in my desktop), went missing .what could be the cost of the problem?

  • Error occurred in accounting - check the costing in the ERP system

    Hi Experts,
    i am experiencing error in cproject preliminary costing. please refer below error.
    i have the choosed the costing variant as ad hoc cost estimation in controlling for easy cost planning. i need to create a quotation from cproject.
    Please sugeest me what is missing?
    thanks in advance,
    Prabu
    Error occurred in accounting - check the costing in the ERP system
    Message no. DPR_FIN_GECCO026
    Diagnosis
    Errors occurred in costing in the ERP system.
    Procedure
    Check the costing log for costing in the ERP system:
    Call costing:
    If it is preliminary costing, the hyperlink for calling the ad hoc cost estimate can be found in the Costing view.
    If it is costing for an account assignment object (after transfer), the hyperlink for calling Easy Cost Planning can be found in the Services view.
    In costing, choose Revaluate All Items. The costing log is then generated with the error messages.
    Procedure for System Administration
    This message has the number DPR_FIN_GECCO026.

    Hi,
    Check the configuration.
    Create and Change Controlling Scenario
    Define Controlling Scenario
    Settings for Easy Cost Planning
    Assign Cost Elements and Activity Types
    Regards
    Ravindra

  • What is the cost of the display for ipad 4 in Germany?

    what is the cost of the display for ipad 4 in Germany?

    This is your only option in Germany for IPADS
    My iPad is not eligible for warranty service. What are my service options?
    Apple offers two service options for iPads that are not eligible for warranty service.
    Battery Replacement ServiceIf your iPad requires service only because the battery's ability to hold an electrical charge has diminished, please refer to the Battery Replacement Service information.
    Out-of-Warranty ServiceIf you own an iPad that is ineligible for warranty service but is eligible for Out-of-Warranty (OOW) Service, Apple will replace your iPad with an iPad that is new or equivalent to new in both performance and reliability for the Out-of-Warranty Service fee listed below.
    iPad model
    Out-of-Warranty Service Fee
    iPad mini
    200,90 €
    iPad, iPad 2,
    iPad mini 2
    250,90 €
    iPad 3rd, 4th generation,
    iPad Air, iPad mini 3
    300,90 €
    iPad Air 2
    380,90 €
    The Out-of-Warranty Service fee includes an 11,90 € shipping fee, which applies only if service is arranged through Apple and requires shipping. All fees are in euros and include VAT.Certain damage is ineligible for Out-of-Warranty service, including catastrophic damage, such as the device separating into multiple pieces, and inoperability caused by unauthorized modifications. However, an iPad that has failed due to contact with liquid may be eligible for Out-of-Warranty service.Apple reserves the right to determine whether or not your iPad is eligible for Out-of-Warranty service. Replacement iPads have a 90-day limited hardware warranty or assume the remainder of your standard warranty or AppleCare product coverage, whichever is longer. Please see theApple Repair Terms and Conditions for further details.Learn more about service for discontinued products.

  • How to rerun the costing in the Billing document.

    Hi,
    I am working for an client who belongs to Cable Industry, we are capturing the costing in the sales order and pricing is based on the costing.
    We are capturing the pricing in Ek02, on this we are adding the profit margin.
    As Copper price is always changes in some cases client want to charge more or less the difference amount at the time of creating the invoice. The sales order may partially delivered and billed. In this case also client want to change the price.
    How can we incorporate the change of copper price in the billing document as i cannot run the costing once again in the sales order for the balanced quantity, and client want this calculation to be done by system itself during billing.And SAP has not given any provision to run the costing during billing document.
    Kinldy suggest how to proceed further.
    Thanks & Regards,
    Kumar.

    Hi,
    My client belong to cable industry, so copper becomes the major rawmaterial which changes daily.
    So, sometimes based on the customer request if the invoicing is done after 3 months from the date of sales order
    then we  need to update the price at the time of invoicing.
    In sales order we are running the costing and using the variant configuration Module in th project.
    And after production at the time of invoicing client is asking to put the changed prices (Ex. Copper, GI Wire and PVC component) for which prices will be announced by the LME.
    So, kindly suggest me how to re run the costing in the billing or is there any alternative to define separate condition types for Copper, GI Wire etc.
    Awaiting for your reply,
    Thanks & Regards,
    Tilak.

  • Where is the cost of the icloud mentioned on the Apple websites?

    Where is the Cost of the icloud mentioned on the Apple websites?  How much is the monthly/annual fee for icloud? There is no Search in HELP either, just puts you in circles to sign up.

    The first 5GB is free.  Prices for storage upgrades above that are revealed by going to Settings>iCloud>Storage & Backup>Buy More Storage.

  • What is the cost of the 4th Generation IPad

    What is the cost of the new 4th Generation IPad?  I was told that the IPad Air is no longer available. Is that correct?
    What are the different sizes avvailable?What will it cost me to have the new 4th Generation IPad deliverd to South Africa?

    Check my response in your other thread.

  • TS1702 If I purchase an app from iTunes and it does not work or does not meet expectations, is there a way to be refunded the cost of the app?

    If I purchase an app from iTunes and it does not work properly or meet expectations, is there a way to receive refund for the cost of the app?

    First contact the Developer of the App...
    If no joy...
    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • HT5570 I got an error message when I tried to download a song and it didn't download but my account balance was lowered by the cost of the song.  What gives?

    I got an error message when I tried to download a song and it didn't download but my account balance was lowered by the cost of the song.  What gives?

    Apple has announced they are currently experiencing issues with iTunes store purchases... give it some time to clear up.

  • How do I check the cost of the query ?

    I did
    set autotrace on traceonly
    set timing on
    and executed a select statement.
    I got a execution plan and statistics
    What should I check in this output.
    Pls help me how to tune the query

    The EXPLAIN plan display will have a header called COST and that's where the cost of individual steps and overall cost of the SQL statement will be displayed. There is no such thing as normal value for cost.
    Also, a high cost does not necessarily mean that the query execution plan is bad. Cost is dependent on how the statistics on tables / indexes etc. have been collected.
    Shakti
    http://www.impact-sol.com
    Developers of Guggi Oracle - Tool for DBAs and Developers

  • Order by shooting up the cost of the query by 4 times

    I have the following query :
    select company_id,company_name, total_depts,
    to_char(case when total_depts = 0 then 0 else (accnt_count/total_depts*100) end,'990.99')||'%' as accnt_count_percent,
    to_char(case when total_depts = 0 then 0 else (lib_count/total_depts*100) end,'990.99')||'%' as lib_count_percent,
    to_char(case when total_depts = 0 then 0 else (house_count/total_depts*100) end,'990.99')||'%' as house_count_percent,
    to_char(case when total_depts = 0 then 0 else (fin_count/total_depts*100) end,'990.99')||'%' as fin_count_percent,
    to_char(case when total_depts = 0 then 0 else (total_depts - (accnt_count + lib_count + house_count + fin_count))/total_depts*100 end ,'990.99')||'%' as total_success
    ,total_deptments,less_imp,more_imp,version_id_count as total_users
    from
      select dpt_inst.company_id as company_id,
      dpt_inst.company_name as company_name,
      count(*) as total_depts,
      sum(case when (upper(err.problem) = upper('accnt_count')) then 1 else 0 end) as accnt_count,
      sum(case when (upper(err.problem) = upper('lib_count')) then 1 else 0 end) as lib_count,
      sum(case when (upper(err.problem) = upper('fin_count')) then 1 else 0 end) as fin_count,
      sum(case when (upper(err.problem) = upper('house_count')) then 1 else 0 end) as house_count
      from education.dept_and_inst_view dpt_inst
      left join education.dept_error err
      on dpt_inst.dept_code = err.code
      where dpt_inst.part_id  in ('A','L','M')
      and dpt_inst.company_id not in ('L100901','L20009')
      group by dpt_inst.company_id,dpt_inst.company_name
    ) inst_dept_q
    inner join
      select company_id, count (*) total_deptments
      from education.departments ed_acc
      inner join cv.cv_customers cv_usr
      on ed_acc.cust_id = cv_usr.id
      inner join cv.customer_enrollment cvce
      on cv_usr.subs_id  = cvce.subs_id
       where ed_acc.status = 'important'
        and company_id not in ('L100901','L20009')
        group by company_id
      ) dept_customers_q on inst_dept_q.company_id = dept_customers_q.company_id
    inner join
      select
            company_id,
            sum(case when version_id = 1 then 1 else 0 end) as less_imp,
            sum(case when version_id = 2 then 1 else 0 end) as more_imp,
            count (*) version_id_count
        from (
          select distinct (cvce.subs_id), ed_acc.company_id,cvce.version_id
          from education.departments ed_acc
          inner join cv.cv_customers cv_usr
             on ed_acc.cust_id = cv_usr.id
          inner join cv.customer_enrollment cvce
             on cv_usr.subs_id  = cvce.subs_id
          where ed_acc.company_id not in ('L100901','L20009')
          and ed_acc.status = 'important'
        ) group by company_id
    ) inst_cust_cnt_q on dept_customers_q.company_id = inst_cust_cnt_q.company_id
    order by 3 desc
    The order by in this query is increasing the cost by 4 times.
    I wan to post the Explain Plan taken from SQL Developer but when I paste it in this window it is all unreadble (outdented). How to put the explain plan?

         This is the Explain plan from SQL Developer:
            OPERATION                                         OBJECT_NAME              OPTIONS             COST
         SELECT STATEMENT
                                                                                                        3082
            SORT
                                                                                    ORDER BY            3082
             NESTED LOOPS
                                                                                                        649
             NESTED LOOPS    
                                                                                                        285
                VIEW
                                                                                                        198
                  HASH
                                                                                     GROUP BY           198
                HASH JOIN
                                                                                                        197
                   Access Predicates
                      ed_acc.cust_id=TO_NUMBER(TP_USER_ID)
                   TABLE ACCESS
                                                               DEPARTMENTS           FULL                137
                      Filter Predicates
                    AND
                      ED_ACC.STATUS = 'important'
                      ED_ACC.company_id<>'L100901'
                      ED_ACC.company_id<>'L20009'
                   HASH JOIN
                                                                                                          59
                    Access Predicates
                      subs_id=subs_id
                    TABLE ACCESS
                                                              APPLICATION_USER       FULL                 35
                    TABLE ACCESS
                                                              USER_APP_ENROLLMENT    FULL                 23
                       Filter Predicates
                         OR
                           ENROLLMENT_STATUS='Active'
                           ENROLLMENT_STATUS='Enrolled'
                           ENROLLMENT_STATUS='Subscribed'
                        AND
                           ENROLLMENT_STATUS='In-active'
                           THROUGH_DATE>=SYSDATE@!
                VIEW PUSHED PREDICATE
                                                                                                          87
                FILTER
                  Filter Predicates
                      COUNT(*)>0
                  SORT
                                                                                  AGGREGATE        
                    VIEW
                                                                                                         87
                      SORT
                                                                                    UNIQUE               87
                    FILTER
                     Filter Predicates
                      AND
                       'L100901'<>dept_customers_q.company_id
                       'L20009'<>dept_customers_q.company_id
                    HASH JOIN
                                                                                                         86
                     Access Predicates
                       subs_id=subs_id
                    HASH JOIN
                                                                                                         62
                     Access Predicates
                         ed_acc.cust_id=TO_NUMBER(TP_USER_ID)
                     TABLE ACCESS
                                                         DEPARTMENTS          BY INDEX ROWID             26
                       Filter Predicates
                                ed_acc.status = 'important'
                       INDEX
                                                         DEPARTMENTS_I4       RANGE SCAN                 2
                         Access Predicates
                                ed_acc.company_id=dept_customers_q.company_id
                                Filter Predicates
                                AND
                                  ed_acc.company_id<>'L100901'
                                  ed_acc.company_id<>'L20009'
                            TABLE ACCESS
                                                                     APPLICATION_USER       FULL               35
                        TABLE ACCESS
                                                                   USER_APP_ENROLLMENT      FULL               23
                          Filter Predicates
                          OR
                           ENROLLMENT_STATUS='Active'
                           ENROLLMENT_STATUS='Enrolled'
                        ENROLLMENT_STATUS='Subscribed'
                         AND
                        ENROLLMENT_STATUS='In-active'
                           THROUGH_DATE>=SYSDATE@!
              VIEW PUSHED PREDICATE
                                                                                                              33
              SORT
                                                                                            GROUP BY          33
            FILTER
             Filter Predicates
             AND
             'L20009'<>dept_customers_q.company_id
             'L100901'<>dept_customers_q.company_id
             HASH JOIN
                                                                                         RIGHT OUTER          32
             Access Predicates
                ERR.CODE(+)=TO_NUMBER(TPA.dept_error)
             TABLE ACCESS
                                                                    dept_error             FULL               3
             HASH JOIN
                                                                                        RIGHT OUTER           29
             Access Predicates
                TPA.company_id=TPI.company_id(+)
             TABLE ACCESS
                                                                    tp_companies       BY INDEX ROWID         2
               INDEX
                                                                   SYS_C00219340       UNIQUE SCAN            1
                 Access Predicates
                   TPI.company_id(+)=dept_customers_q.company_id
                 Filter Predicates
                   AND
                    TPI.company_id(+)<>'L100901'
                    TPI.company_id(+)<>'L20009'
             NESTED LOOPS
                                                                                                              26
               TABLE ACCESS
                                                                  DEPARTMENTS           BY INDEX ROWID        26
             Filter Predicates
               OR
                TPA.part_id='A'
                TPA.part_id='L'
                TPA.part_id='M'
             INDEX
                                                                  DEPARTMENTS_I4       RANGE SCAN                2
             Access Predicates
                TPA.company_id=dept_customers_q.company_id
             Filter Predicates
                 AND
                   TPA.company_id<>'L100901'
                   TPA.company_id<>'L20009'
             INDEX
                                                                  SYS_C00219178           UNIQUE SCAN              0
             Access Predicates
                   TPA.DEPARTMENTS_TYPE_ID=TPAT.DEPARTMENTS_TYPE_ID

  • Can i trade in my ipod touch 2nd gen for the new ipod to reduce the cost of the new ipod touch?

    My ipod touch 2nd gen is had drop once and there is a grey mark on the screen.. i was thinking, can we trade in our old Apple product for a new 1?
    I don mean to say exact trade.. maybe reduce in price for the new 1.. =)

    Hmm.. I am from Malaysia.. so gazelle cant.. i think i may opt to get the 10% discount if i am goin to get the new 1.. =)
    Btw, do you know how?

  • My screen cracked, but I haven't had my macbook for a full year yet. Does Apple care or warranty cover the costs of the damage?

    My screen cracked, does apple care or warrant cover the costs?

    Yes, unless the damage occurred due to an accident. In other words the warranty is applicable only if the crack occurred due to a manufacturing defect.

Maybe you are looking for

  • Form feed, null and StringTokenizer

    is form feed recognized as null when using the StringTokenizer? i currently have my StringTokenizer set with a blank space and i am attempting to read until the value is (EOF) null and while it hasMoreTokens. the text file that i am reading from span

  • Automatic Form Feed - Epson LQ - 2180 printer to R12 in Solaris Environment

    Hi We are adding a new Epson dot matrix [ Impact] Printer to our system. [Epson LQ - 2180] Server OS: Sun OS sun4v sparc SUNW,SPARC-Enterprise-T5120 R12 Version: 12.1.3 This is a network printer. This has been added to the printer server via root. We

  • Installer has insufficinent privileges to access this directory c:\program files\ipod\bin log on as administrator

    I'm getting this error when I try to install the newest version of Itunes.  I have tried so many things.  Please help. installer has insufficinent privileges to access this directory c:\program files\ipod\bin log on as administrator

  • Video storage

    Can you get any videos that are under 1GB because I have got a 32GB iPad 2 and I was wanting a few more videos/movies. Also, why do they take up so much room because most games that's have got are under 500MB and they are HD. Would be great if someon

  • Transports during Support Pack application/testing

    During our last Support Pack processing, (SP14-SP16) we had applied the support packs to Dev, QA and were waiting for our functional teams to complete their testing prior to applying the SPs to PRD.  During this time, the SAP manager insisted we prom