Whats the difference between these two queries ? - for tuning purpose

Whats the difference between these two queries ?
I have huge amount of data for each table. its takeing such a long time (>5-6hrs).
here whice one is fast / do we have any other option there apart from listed here....
QUERY 1: 
  SELECT  --<< USING INDEX >>
      field1, field2, field3, sum( case when field4 in (1,2) then 1 when field4 in (3,4) then -1 else 0 end)
    FROM
      tab1 inner join tab2 on condition1 inner join tab3 on condition2 inner join tab4 on conditon3
    WHERE
     condition4..10 and
    GROUP BY
      field1, field2,field3
    HAVING
      sum( case when field4 in (1,2) then 1 when field4 in (3,4) then -1 else 0 end) <> 0;
QUERY 2:
   SELECT  --<< USING INDEX >>
      field1, field2, field3, sum( decode(field4, 1, 1, 2, 1, 3, -1, 4, -1 ,0))
    FROM
      tab1, tab2, tab3, tab4
    WHERE
     condition1 and
     condition2 and
     condition3 and
     condition4..10
    GROUP BY
      field1, field2,field3
    HAVING
      sum( decode(field4, 1, 1, 2, 1, 3, -1, 4, -1 ,0)) <> 0;
[pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

My feeling here is that simply changing join syntax and case vs decode issues is not going to give any significant improvement in performance, and as Tubby points out, there is not a lot to go on. I think you are going to have to investigate things along the line of parallel query and index vs full table scans as well any number of performance tuning methods before you will see any significant gains. I would start with the Performance Manual as a start and then follow that up with the hard yards of query plans and stats.
Alternatively, you could just set the gofast parameter to TRUE and everything will be all right.
Andre

Similar Messages

  • Whats the difference between these two iphone 5 model "md635ll vs md639ll"?

    i know theres alot of versions of iphone out there. I currently live in california, whats the difference between md635ll vs md639ll models?
    I currently have the md639ll one.

    My feeling here is that simply changing join syntax and case vs decode issues is not going to give any significant improvement in performance, and as Tubby points out, there is not a lot to go on. I think you are going to have to investigate things along the line of parallel query and index vs full table scans as well any number of performance tuning methods before you will see any significant gains. I would start with the Performance Manual as a start and then follow that up with the hard yards of query plans and stats.
    Alternatively, you could just set the gofast parameter to TRUE and everything will be all right.
    Andre

  • Whats the difference between these two Sony's

    so ivwe narrowed my next laptop to.....the Sony  VPCCW21FX  and  VPCCW23fx.  My question is, after looking at the specs of both it seems the only difference s that one (21) has a blu ray and the other doesnt.  Is that the only difference?well besides one being cheaper? 
    thanKs!
    Scott

    Yeah besides the color options, the addition of the Blu-ray drive is the only thing going to seperate these 2 laptops.
    .-**Click the star under my name if this information helped! TY!**-.
    .-**Click the Solved button if this answered your question!**-.

  • Whats the difference between these versions of photoshop?

    First of all to make things clear I want to mention this first that I lives in Pakistan and Adobe doesn't support my region so in order to buy the Adobe Photoshop CC I have to contact the authorized resellers, after contacting them and asking for a invoice proposal for Adobe Photoshop CC, they send me several invoice proposals (per user team liscense). But I just got in a trouble as these proposals are offering Photoshop CC different versions so its like kinda making me double mind, i am just confused which to buy as prices are differ too and kinda noticeable. As for making my intentions clear I also wanna mention that I am looking for Single App Liscense i mean i just wanna buy Photoshop CC thats it. But for sure its not gonna be that photography version nor student one. Also i wanna know that whats the difference between these two versions and also tell me the pros and cons.
    So please help me choose which one is better for me as I am really confused with it.
    Here are the links
    Note: You will have to translate these pages into english
    Link one:
    [65224660BA01A12] ราคาพิเศษ จำหน่าย Photoshop CC ALL Multiple Platforms Multi Asian Languages Licensing Subscription Mo…
    Link two:
    [65226001BA01A12] ราคาพิเศษ จำหน่าย Photoshop CC ALL Multiple Platforms Multi Asian Languages Licensing Subscription Mo…
    I've attached screenshots too

    The features in both of the Photoshop CC are identical, there is a difference in price because, the higher priced is the original Photoshop price, the less priced is the promotional priced Photoshop CC eligible only if you have CS3 or later version of Adobe creative suite product.
    Hope this answers your question.
    Regards
    Rajshree

  • What is the difference between these two reports MC.1 and MB5L

    Hi
    what is the difference between these two reports MC.1 and MB5L?
    what is the Purpose of each report?
    Material ledger is activated for this plant, we found some amount difference between these two reports, my client accounting department used to compare these two reports while year end/month end closing
    Thanks
    Raju

    MC.1 will give you the report for plant analysis as per plant .
    MB5L report will give you list of stock value as per G/L account wise.

  • What is the difference between these two sticks of RAM?

    I am upgrading my Macbook 2.2 GHz Intel Core 2 duo from 2GB of ram to 4GB
    What is the difference between these two kits?
    4GB Kit (2 x 2GB) 200 Pin DDR2-667 PC2-5300 256x64 CL5 1.8V SODIMM ($102.00)
    4GB Kit (2 x 2GB) eRam 200 Pin DDR2-667 PC2-5300 CL5 1.8V SODIMM ($88.00)

    Probably nothing of any consequence. Some places can just negotiate better deals with suppliers. Or one of a million other factors that can affect price is in play here.
    When buying RAM, I generally find it's better to pay a little extra to get a brand that's known for quality. I usually stick to Crucial myself. If you look around, you can probably find some real steals out there, but I don't know... With stories of people who literally go dumpster diving, salvaging stuff that was slated for disposal, then turning around and selling it... I prefer not to take chances. If you are, by all means, go for the cheaper one.

  • What is the Difference between these Two?

    Hi All,
    In Oracle University site i saw 2 Courses for Oracle Webcenter sites. Just i would like to know the difference between these two. Based on your input i can decide which one to take.
    *1. Oracle Webcenter Sites for Developers*
              http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=609&p_org_id=1001&lang=US&get_params=dc:D73886GC10,p_preview:N
    *2. Oracle Webcenter Sites 11g for Developers*
              http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=609&p_org_id=1001&lang=US&get_params=dc:D78300GC10,p_preview:N
    Is the 1st one is Fatwire and the 2nd one is Fatwire+Oracle latest implmentation ? Is my understanding is right?
    regards
    Sri

    It's the same lens, just different sellers.  The higher one is the MSRP, or close to it.  But since they use this lens in a kit it goes for less.  I have no idea who Celltime Inc is, but it's fullfilled by Amazon, so I'd feel reasonably safe.  Just look into their return policy.
    With the recent release of the 6D and somewhat recent 5d3, the market is flooded with these lenses from kits; I wouldn't pay more than 800 something for it.  Getting it through Amazon is a bonus over eBay.  If the seller checks out I'd go for it.
    Edit: DH beat me to it. 

  • What is the difference between these two portalapps folders on the Server?

    Hello,
    On the Server there are two portalapps folder:
    1. Under: C:\usr\sap\JXX\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\portalapps
    2. Under: C:\usr\sap\JXX\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps
    Can someone please explain me what is the difference between these two portalapps folders and under which case will I turn to which folder?

    Hi Roy,
    The one at this location
    Under: C:\usr\sap\JXX\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\portalapps
    has all the files from the WEB-INF folder i.e. these are the non-web resources and cannot be accessed via HTTP(S) examples would be imgaes, CSS etc that you want only your application to access
    those under
    Under: C:\usr\sap\JXX\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps
    they have all the .JAR files, portalapp.xml, config properties etc. these are web resources and can be accessed via HTTP(S)
    Hope this is of help.
    Akhilesh

  • What is the difference between these two commands?

    What is the difference between these two commands?
    DROP TABLESPACE users INCLUDING CONTENTS;
    DROP TABLESPACE users INCLUDING CONTENTS AND DATAFILES;
    --------No.202

    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9004.htm#i2133717

  • What's the difference between these two networks?

    Have searched a lot but can not find a clear answer to the difference between these two networks.
    (I'm using these as examples only)
    Using Airport utility
    * sometimes theres a dotted line "......"
    *And sometimes there's a solid line like a " } "
    I chose these as an example because ours is just like the first example above.
    However sometimes our presents similar to the above example only with two devices, not three.

    Dotted line is wireless.. Solid line is ethernet..
    Normally all ethernet should show as your lower picture since all are directly wired..
    Wireless should show which Airport is the main base and which extend using wireless.
    But it is 50% science and 80% voodoo (voodoo cannot count even!!)

  • How to get the difference between these two dates

    Hello Friends,
    I need to get the difference between these two fields which store dates but with varchar2 data types
    SELECT pac.segment1, pac.segment2 emp_no, pac.segment3 NAME,
    pac.segment4 POSITION, pac.segment5 start_date, pac.segment6,
    pac.segment7
    FROM per_analysis_criteria pac, fnd_id_flex_structures_vl ffs
    WHERE ffs.id_flex_structure_code = 'Employee Rejoin'
    AND ffs.id_flex_num = pac.id_flex_num
    AND TO_CHAR (TO_DATE (pac.segment7, 'YYYY/MM/DD HH24:MI:SS'))
    - TO_CHAR (TO_DATE (pac.segment6, 'YYYY/MM/DD HH24:MI:SS')) > 1;
    my query is something like this...
    am trying to find the difference between the last two columns but with not much luck..
    can some one suggest me a solution please

    SELECT pac.segment1, pac.segment2 person_id, pac.segment3 NAME,
    papf.employee_number, paaf.supervisor_id, pac.segment4 POSITION,
    pac.segment5 start_date, pac.segment6, pac.segment7,
    papf2.email_address,
    ( TO_DATE (TO_CHAR (pac.segment7), 'DD-MON-YYYY HH:MI:SS AM')
    - TO_DATE (pac.segment6, 'DD-MON-YYYY HH:MI:SS AM')
    + 1
    ) difference,
    POST.email_address
    FROM per_analysis_criteria pac,
    apps.fnd_id_flex_structures_vl ffs,
    per_all_people_f papf,
    per_all_assignments_f paaf,
    per_all_people_f papf2,
    (SELECT email_address, person_id
    FROM per_all_people_f
    WHERE person_id IN (
    SELECT person_id
    FROM per_all_assignments_f
    WHERE position_id IN (SELECT position_id
    FROM per_positions
    WHERE NAME LIKE 'HR Manager.704.')
    AND TRUNC (SYSDATE) BETWEEN effective_start_date
    AND effective_end_date)
    AND TRUNC (SYSDATE) BETWEEN effective_start_date AND effective_end_date
    AND business_group_id = fnd_profile.VALUE ('PER_BUSINESS_GROUP_ID')) POST
    WHERE ffs.id_flex_structure_code = 'Employee Rejoin'
    AND TO_CHAR (papf.person_id) = pac.segment2
    AND ffs.id_flex_num = pac.id_flex_num
    AND TRUNC (SYSDATE) BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND papf.current_employee_flag = 'Y'
    AND papf.person_id = paaf.person_id
    AND TRUNC (SYSDATE) BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date
    AND papf.person_id = paaf.person_id
    AND papf2.person_id = paaf.supervisor_id
    AND paaf.primary_flag = 'Y'
    AND TRUNC (SYSDATE) BETWEEN papf2.effective_start_date
    AND papf2.effective_end_date
    AND papf2.current_employee_flag = 'Y'
    and ( TO_DATE(to_char(pac.segment7), 'DD-MON-YYYY HH:MI:SS AM')-TO_DATE (pac.segment6, 'DD-MON-YYYY HH:MI:SS AM')+1) >1
    last line is giving me the error pls suggest a solution

  • What is the difference between these two instant ink printers?

    Looking to get one of the HP instant ink printers from Best Buy. Either the Envy 4500 or the Envy 5530. There is a $20 diference and I did a side-by-side comparison of them on the Best Buy site, but the only difference I can notice is the 5530 seems to have more memory than the 4500 (128MB vs 32MB).
    Print speeds and resolutions seem to be the same. The cheaper one (4500) also seems to be able to do two-sided printing & reduction/enlargement (which I would have thought to be on the more expensive mode). So are there any other real differences between these two or have I pretty much covered them all?

    HI - great question, you identified a few of the differences.  Some additional differences are:
    4500 has a monochome display that is not touch enabled (you have to use scroll buttons on the side of the screen)
    5300 has a touch enabled color display
    Both printers can do duplexing (printing on both sides) and both have wireless.  
    We are excited about Instant Ink  and hope you enjoy the service & whichever printer you chose!  
    Although I am an HP employee, I am speaking for myself and not for HP

  • Whats the diffrence between these two JKM's and when to use which one.

    Please tell the diffrence between these two.
    JKM Oracle Consistent o JKM Oracle Consistent (Update Date)

    Basic difference is in the requirement .
    JKM Oracle Consistent (Update Date) wants a DATE/TIMESTAMP column in the source tables(s) which will get inserted/update by the source application . ODI will capture the changed data based on this column value . Only the DELETE portion requires a trigger to keep track of deletion happening at source table(s).
    Where as JKM Oracle Consistent does not require any DATE/TIMESTAMP column in the source tables(s) . It uses triggers for keeping track of INSERT/UPDATE/DELETE happening in source .
    In terms of performance JKM Oracle Consistent (Update Date) is better as it will create littel over head on to your source system . SO if you have a DATE/TIMESTAMP column in the source tables(s) which gets inserted/update by the source application, then go for JKM Oracle Consistent (Update Date) .
    Else look for JKM Oracle Consistent .
    Thanks,
    Sutirtha

  • Whats the difference between these products ?

    Hi,
    can somebody tell me what's the difference between these products ?
    Support Portal - Installations and Upgrades - Entry by Application Group - AP BusinessObjects portfolio:
    -SBOP EDGE BI
    -SBOP EDGE DATA INTEGRATOR (formerly Edge Professional)
       -SBOP EDGE BI WITH DI
    -SBOP EDGE DATA MANAGEMENT (formerly Edge Premium)
       -SBOP EDGE BI WITH DM
       -SBOP DATA CLEAN. PACKAGE EDGE
    -SBOP ENTERPRISE
    Is the DATA INTEGRATOR  and/or DATA MANAGEMENT  inculded in SBOP ENTERPRISE ?
    Thank You
    Martin Sautter

    Hi,
    Normally, BOE / BI installers don't include any of those other EIM components. However, they are bundled in the 'edge' offering, which is licensed differently for smaller enterprises.
    For all DI, DS, DQM topics,  which fall under EIM family, please open a thread over here: http://scn.sap.com/community/enterprise-information-management
    Regards,
    H

  • Would you happen to know the difference between these two fields from FI-GL

    Hi,
    Would you happen to know the differnce between these two field
    i. UMSOL from 0fi gl6 and DMSOL from 0fi_ gl_4
    ii. UMHAB from 0fi gl6 and DMHAB from 0fi_ gl_4
    iii.In a test case on a system, where I was looking for the same values in comparison, I am getting inconsistent data.
    which key figures in 0fi gl6  are equivalent to which in 0fi_ gl_4
    Any hints
    Thnx
    Edited by: AmandaBaah on Jul 29, 2009 2:47 AM

    Hi Amanda,
        They are both very different datasources. 0FI_GL_6 is the General Ledger: Transaction Figures which fetched data from the GLT0 table while 0FI_GL_4 fetched data from the BSEG and BKPF tables and fetched the line items from the general ledger.
    You can refer the following links for more info
    [0FI_GL_6|http://help.sap.com/erp2005_ehp_04/helpdata/EN/0a/558cabb2e19a4db3097b81bba4fd0e/content.htm]
    [0FI_GL_4|http://help.sap.com/saphelp_bw33/helpdata/en/af/16533bbb15b762e10000000a114084/content.htm]
    Regards.

Maybe you are looking for

  • Problem with saving data in database table.

    i have ceated on screen prgram... screen contains one text field of leth 40(type c)... if user enters some text in that and enters save button it will store in dbtable which is created by me(ztable)... but that text storing in big letters...even i en

  • Where can I download a trial version of Hyperion Planning and essbase?

    I am new to Hyperion and want to train in it . Where can I download a trial version of Hyperion Planning and essbase?

  • Oracle.DataAccess.Client stored procedure ORA-01403

    Hello, Microsoft announced that System.Data.OracleClient is deprecated and will be no more supported so I try to use the driver Oracle.DataAccess.Client after having installed ODP. It works fine except for stored procedures. After calling a stored pr

  • Schemas synchronization script

    Hello all, I need to synchronize 2 oracle schemas on 2 different databases. I need SQL script to perform that from a powerbuilder program. The first schema is on a server database. The second is on a laptop. The user normally connect to the server, b

  • Com.hyperion.odi.essbase.ODIEssbaseException: Error occured while retrievin

    Hi, I am able to reverse the sample cube but while i reversing the other Essbase cube using "RKM Hyperion Essbase" org.apache.bsf.BSFException: exception from Jython: Traceback (innermost last): File "<string>", line 58, in ? com.hyperion.odi.essbase