Need guidance on Query for fine Tuning

Hi ,
Please help me on the below query while rewriting. Actually it is taking 2.56 sec to give 2.25 lacs records.
I am trying to tune this query since 2 days,but not able to understand where to change & why it is taking that much time.
Using : Oracle 10g version
Tool : TOAD 8.6.1
There are Indexes on every column used in Where clause but still some table scanning full.
becoz of Inner Join it is taking much time, So Can anyone rewrite the below query for faster execution.
SELECT workorder.fincode,
     workorder.istask,
     workorder.status,
workorder.targstartdate,
     workorder.targcompdate,
     workorder.schedfinish,
workorder.actfinish,
     workorder.estdur,
     workorder.wonum,
     workorder.mprn,
workorder.sihousename AS wositehousename,
workorder.sihouseno AS wositehouseno,
workorder.sistreet AS wositestreet,
     workorder.sicounty AS wositecounty,
workorder.siposttown AS wositeposttown,
workorder.sipostcode AS wositepostcode,
     workorder.workorderid
FROM (maximo.sr
INNER JOIN
(maximo.relatedrecord INNER JOIN maximo.workorder
ON relatedrecord.relatedreckey =
(CASE
WHEN workorder.PARENT IS NOT NULL
THEN workorder.PARENT
ELSE workorder.wonum
END
AND relatedrecord.orgid = workorder.orgid
AND relatedrecord.siteid = workorder.siteid
AND relatedrecord.relatedrecclass = 'WORKORDER')
ON sr.ticketid = relatedrecord.recordkey
AND sr.orgid = relatedrecord.orgid
AND sr.siteid = relatedrecord.siteid
AND relatedrecord.CLASS = 'SR')
LEFT JOIN
frozen_quote@gqmfof
ON sr.ticketid = customer_enquiry_ref AND sr.quotever = quote_version
Explan Result:
PLAN_TABLE_OUTPUT
Plan hash value: 599875212
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
| 0 | SELECT STATEMENT | | 1569 | 272K| 3362 (1)| 00:00:41 | | |
|* 1 | HASH JOIN | | 1569 | 272K| 3362 (1)| 00:00:41 | | |
|* 2 | HASH JOIN RIGHT OUTER | | 1263 | 92199 | 417 (4)| 00:00:06 | | |
| 3 | REMOTE | | 1 | 10 | 2 (0)| 00:00:01 | GQMFOF | R->S |
| 4 | NESTED LOOPS | | 1263 | 79569 | 414 (3)| 00:00:05 | | |
| 5 | MERGE JOIN CARTESIAN | | 3798 | 159K| 397 (3)| 00:00:05 | | |
| 6 | VIEW | VW_NSO_1 | 1 | 14 | 3 (34)| 00:00:01 | | |
| 7 | SORT UNIQUE | | 1 | 26 | 3 (34)| 00:00:01 | | |
|* 8 | INDEX RANGE SCAN | SYNONYMDOM_NDX1 | 1 | 26 | 2 (0)| 00:00:01 | | |
| 9 | BUFFER SORT | | 3798 | 107K| 397 (3)| 00:00:05 | | |
|* 10 | TABLE ACCESS FULL | RELATEDRECORD | 3798 | 107K| 394 (3)| 00:00:05 | | |
|* 11 | TABLE ACCESS BY INDEX ROWID| TICKET | 1 | 20 | 1 (0)| 00:00:01 | | |
|* 12 | INDEX UNIQUE SCAN | TICKET_NDX1 | 1 | | 0 (0)| 00:00:01 | | |
| 13 | TABLE ACCESS FULL | WORKORDER | 231K| 23M| 2943 (1)| 00:00:36 | | |
Predicate Information (identified by operation id):
1 - access("RELATEDRECORD"."RELATEDRECKEY"=CASE WHEN ("WORKORDER"."PARENT" IS NOT NULL) THEN
"WORKORDER"."PARENT" ELSE "WORKORDER"."WONUM" END AND "RELATEDRECORD"."ORGID"="WORKORDER"."ORGID" AND
"RELATEDRECORD"."SITEID"="WORKORDER"."SITEID")
2 - access("TICKET"."QUOTEVER"="QUOTE_VERSION"(+) AND "TICKET"."TICKETID"="CUSTOMER_ENQUIRY_REF"(+))
8 - access("DOMAINID"='TKCLASS' AND "MAXVALUE"='SR')
10 - filter("RELATEDRECORD"."CLASS"='SR' AND "RELATEDRECORD"."RELATEDRECCLASS"='WORKORDER')
11 - filter("TICKET"."ORGID"="RELATEDRECORD"."ORGID" AND "TICKET"."SITEID"="RELATEDRECORD"."SITEID")
12 - access("CLASS"="$nso_col_1" AND "TICKET"."TICKETID"="RELATEDRECORD"."RECORDKEY")
Regards,
GR

Add the NOCYCLE clause to your connect by statement CONNECT BY NOCYCLE PRIOR
You also might want to add the organization ID into your join.

Similar Messages

  • How to guide for Fine tuning the performance of SAP EP

    All,
    Could anyone please let me know where to locate the how to guide for fine tuning the performance of the SAP Enterprise Portal?
    thanks,
    ~L

    hi leena,
    Look into these threads...
    https://www.sdn.sap.com/irj/sdn/thread?threadID=119605
    https://www.sdn.sap.com/irj/sdn/thread?threadID=101325
    Also see,
    <a href="https://websmp103.sap-ag.de/~form/sapnet?_SHORTKEY=00200797470000073623&_OBJECT=011000358700001480992005E">this link</a>
    https://media.sdn.sap.com/public/eclasses/bwp04/PortalTuning_files/Default.htm
    Regs,
    jaga
    Message was edited by: jagadeep sampath

  • Presets sought for fine-tuning skin tones

    Are presets available to fine tune skin tones in Camera Raw, perhaps by tweaking colors and hue/saturation/luminance settings in the HSL/Grayscale menu?
    I like almost everything about ACR except how the default settings render skin tones on my 5D's CR2 files. I bought a copy of Margulis' 'Professional Photoshop' and now can consistently "fix" what I didn't like, but I suspect as much or more could be accomplished with knowledgeable tweaking in the HSL menu.
    I found one preset, after visiting this adobe forums thread:
    http://www.adobeforums.com/webx/.3bbed80a/1
    ... but that's all. I think they'd be a snap for an expert retoucher to create -- e.g., warm_with_pink.xmp, warm_with_yellow.xmp, presets for skin tones of different ethnicities, etc.
    Of course, I've tried to do it myself, by nudging orange, red, yellow and magenta sliders, but ... with limited success, to put it mildly. I'd much rather start out with tweak-the-skin-tones presets from an expert, and then adjust to taste. If I can find 'em.

    Thanks for the links to chromoholics and creativepro. My last experience with creating a custom camera profile wasn't that successful, but that was a long time ago, and I probably shouldn't let that discourage me from trying again. If that's the ultimate solution, you've told me what I need to know.
    For whatever it's worth, though, I've shot with two 5Ds, and can't tell the CR2s they produce apart. ACR at default settings yields the same (to me) objectionable, pale apricot skin tone from the CR2s of both cameras.
    I would fix this in ACR, if I knew how. I don't; I'm not that good with the HSL sliders; I have to do it in Photoshop. But because the 5D is a popular and fairly high end camera, I guessed, or hoped, that professional wedding or fashion photographers who live and die by nuances of skin tone might have sub-directories full of presets to nudge 5D skin tones ... and, further, that they'd generously share said preset collection with the world.

  • Need help with query for converting columns to rows

    Hello,
    I know this is a very common question asked in the forum. I have searched regading this, i did find some threads, but i was not able to achieve what i require from the answers posted. So anybody please help me.
    I have a table which is having multiple columns as follows:
    Insert into table_1 (X,Y,Z,A,B,C,D,E,F,G,H,I) values (0,0,2,0,0,1,3,0,0,0,0,0);I want to convert the result into a two column, multiple rows i.e., I want the result as follows:
    Col1 Col2
    X      0
    Y     0
    Z      2
    A     0
    B     0
    C     1
    D     3
    E     0
    F     0
    G     0
    H     0
    I      0Please anybody help me in writing the query for this..

    Is this what you are expecting:
    SQL> WITH T AS
      2  (
      3  SELECT 0 X, 0 Y, 2 Z, 0 A, 0 B, 1 C, 3 D, 0 E, 0 F, 0 G, 0 H, 0 I FROM DUAL
      4  )
      5  SELECT  'X' col1, X col2 FROM T
      6  UNION ALL
      7  SELECT  'Y' col1, Y col2 FROM T
      8  UNION ALL
      9  SELECT  'Z' col1, Z col2 FROM T
    10  UNION ALL
    11  SELECT  'A' col1, A col2 FROM T
    12  UNION ALL
    13  SELECT  'B' col1, B col2 FROM T
    14  UNION ALL
    15  SELECT  'C' col1, C col2 FROM T
    16  UNION ALL
    17  SELECT  'D' col1, D col2 FROM T
    18  UNION ALL
    19  SELECT  'E' col1, E col2 FROM T
    20  UNION ALL
    21  SELECT  'F' col1, F col2 FROM T
    22  UNION ALL
    23  SELECT  'G' col1, G col2 FROM T
    24  UNION ALL
    25  SELECT  'H' col1, H col2 FROM T
    26  UNION ALL
    27  SELECT  'I' col1, I col2 FROM T
    28  /
    C       COL2                                                                   
    X          0                                                                   
    Y          0                                                                   
    Z          2                                                                   
    A          0                                                                   
    B          0                                                                   
    C          1                                                                   
    D          3                                                                   
    E          0                                                                   
    F          0                                                                   
    G          0                                                                   
    H          0                                                                   
    C       COL2                                                                   
    I          0                                                                   
    12 rows selected.

  • Inputs for Fine tuning the program

    Hi All,
    Following code is taking lot of time... No i need to fine tune the same ,,,
    Please give some inputs..
    SELECT VBELN INTO VBUK-VBELN FROM VBUK
    WHERE ( CMGST EQ 'B' OR CMGST EQ 'C' )
    AND VBELN IN S_VBELN.
    SELECT * FROM VBAP WHERE VSTEL IN SHP_PT
    AND VBELN EQ VBUK-VBELN
    AND VKGRU '101'.
    SELECT VBELN POSNR EDATU FROM VBEP
    INTO (VBEP-VBELN,VBEP-POSNR,VBEP-EDATU)
    WHERE VBELN EQ VBAP-VBELN AND POSNR EQ VBAP-POSNR
    AND LFREL EQ 'X' AND BMENG GT 0
    AND EDATU BETWEEN DATE_LOW
    AND DAT_HIGH
    ORDER BY EDATU VBELN POSNR.
    CLEAR LIPS.
    PERFORM APPEND_DATA_TO_ITAB1 TABLES ITAB1
    USING VBEP-VBELN VBEP-POSNR
    VBEP-EDATU LIPS-VBELN
    LIPS-POSNR vbap-VSTEL.
    ENDSELECT.
    ENDSELECT.
    ENDSELECT.
    Regards,
    Chan
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    Edited by: Thomas Zloch on Nov 24, 2010 1:17 PM

    HI,
    Remove the select endselect the select all the entries into internal table then from tat internal table select by using for all entries into another internal table. for eq -
    IF NOT s_vbeln[] IS INITIAL.
      SELECT vbeln cmgst
            INTO TABLE itvbuk
            FROM vbuk
            WHERE vbeln IN s_vbeln.
      DELETE itvbuk WHERE  cmgst NE 'B' AND cmgst NE 'C' .
    ENDIF.
    IF NOT itvbuk[] IS INITIAL.
      SELECT *
             FROM vbap
             INTO TABLE itvbap
             FOR ALL ENTRIES IN itvbuk
             WHERE vbeln EQ itvbuk-vbeln.
      DELETE itvbap WHERE vkgru NE '101' AND NOT vstel IN shp_pt.
    ENDIF.
    Like wise modify the logic and check the secondary index is available for the where clause which you will be specifing.
    Regards,
    Madhukar Shetty

  • Slow starup of Java application - best practices for fine tuning JVM?

    We are having problems with a java application, which takes a long time to startup.
    In order to understand our question we better start with some background info. You will find the question(s) after that.
    Background:
    The setup is as follows:
    In a client-server solution we have a win xp, fat client running java 1.6.0.18.
    (Sun JRE). The fat client containt a lot of GUI, and connects to a server for DB access. Client machines are typical 1 to 3 years old (there are problems even on brand new machines). They have the client version of JRE - standard edition installed (Java SE 6 update 10 or better) Pretty much usual stuff so far.
    We have done a lot of profiling on the client code, and yes we have found parts of our own Java code that needs improving. we are all over this. Server side seems ok with good response times. So far, we havent found anything about shaky net connections or endless loops in the java client code or similiar.
    Still, things are not good. Starting the application takes a long time. too long.
    There are many complicating factors, but here is what we think we have observed:
    There is a problem with cold vs. varm starts of the application. Apparently, after a reboot of the client PC - things are really, really bad - and it takes (sometimes) up to 30-40 secs to start the application (until we arrive at the start GUI in our app).
    If we run our application, close it down, and then restart
    without rebooting, things are a lot better. It then usually takes
    something like 15 - 20 sec. which is "acceptable". Not good, but acceptable,
    Any ideas why?
    I have googled it, and some links seems to suggest that the reason could be disk cache. Where vital jar are already in disk cache on th warm start? Does that make any sense? Virus scanners presumable runs in both cases.
    People still think that 15 - 20 sec in start up on the warm start is an awful long time, even though there is a lot, a lot, of functionality in the application.
    We got a suggestion to use IBMs JRE - as it can do some tricks (not sure what) our SUN JRE cant do concerning the warm and cold start problem. But thats is not an option for us. And noone has come up with any really good suggestions with the SUN JRE so far?
    On the Java Quick Starter (JQS) -
    improves initial startup time for most java applets and applications.
    Which might be helpful? People on the internet seem more interested
    in uninstalling the thing than actually installing it though?
    And it seems very proprietary, where we cant give our Jar files to it?
    We could obviously try to "hide" the problem in some way and make it "seem" quicker. Where perceived performance can be just as good as actual performance. But it does seem a bad solution. So for the cold start we will probably try reading the jar files and thereby have them in disk cache before startup of our application. And see if that helps us.
    Still, ok the cold start is the real killer, but warm start isn't exactly wonderfull either.
    People have suggested that we read more on the JVM and performance.
    java.sun.com.javase/technologies/performance.jsp
    java.sun.com.docs/hotspot/gc5.0/gc_tuning_5.html
    the use of JVM flags "-Xms" "-Xmx" etc etc.
    And here comes the question .. da da ...
    Concerning various suggested reading material.
    it is very much appreciated - but we will like to ask people here - if it is possibe to get more specific pointers. to where the gold might be buried.
    I.e. in a an ideal world we would have time to read and understand all of these documents in depth. However, in this less than ideal world we are also doing a lot of very timeconsuming profiling in our own java code.
    E.g. java garbage collection is is a huge subject - and JVm settings also. Sure, in the end we will probably have to do this all very thoroughly. But for now we are hoping for some heuristics on what other people are doing when facing a problem like ours..?
    Young generation, large memory pages, garbage collection threads ect. all sounds interesting - but what would you start with?
    If you don't have info to decide - what kind of profiling would you be running and then adjust what JVM setting in your trials?
    In this pressed for time scenario. Ignorance is not bliss. But makes it hard to pinpoint the or those JVM parameters to adjust. So some good pointers from experienced JVM "configurators" will be much appreciated!
    Actually, If we can establish that finetuning of these parameters is a good idea, it will certainly also be much easier to allocate the time for doing so. - reading, experimenting etc. in our project.
    So, All in all , what kinds of performance improvements can we hope for? 5 out of 20 secs on the warm start? Or is it 10 % nitpicking? Whats the ball park figure for what we can hope to achieve here given our setup? What do you think based on above?
    Maybe someone out there have done some finetuning of JVM parameters in a similiar PC environments like, with similiar fat clients...? Finetuning so and so - gave 5 secs. So start your work with these one-two parameters?
    Something like that - some best practices? Thats what we are hoping for.
    best wishes
    -Simon

    Thanks for helpful answer from both you and kajbj.
    The app doesn't use shared network drives.
    What are you doing between main starts to get executed and the UI is
    displayed?
    Basicly, Calculating what to show in the UI. Accessing server - not so much, there are some reads from a cache, but the profiling doesnt indicate that it should be a problem. Sure, I could shift the startup time to some other slot, but sofar I havent found a place where the end-user wouldnt be annoyed.> Caching of something would seem most obvious. Normal VM stuff >seems unlikely. With profiling i basicly find that ''everything'' takes a lot longer in the cold start scenario. Some of our local java methods are going to be rewritten following our review. But what else can be tuned?You guys dont think the Java Quick Start approach, with more jars in disk cache will give something? And how should that be done/ what does people do?I.e. For the class loader I read something about
    1.Bootstrap class loader
    2.Extensions class loader
    3.System class loader
    and is wondering if this has something to do with the cold start problem?
    The extensions class loader loads the code in the extensions directories (<JAVA_HOME>/lib/ext
    So, we should move app classes to ext? Put them in one jar file? (We have many). Best practice about that?
    Otherwise it seems to me that it must be about finetuning the JVM?
    I imagine that it is a question about:
    1. the right heap size
    2. the right garbage collection scheme
    Googling heap size for XP
    CHE22 writes:
    You are right; -Xms1600M works well, but -Xms1700M bombs
    Thats one best practice or what?
    On garbage collection, there are numerous posts, and much "masters of Java black art" IMHO, And according to profiling GC is not really that much of a problem anyway? Still,
    Based on my description I was hoping for a short reply like "try setting these two parameters on your xp box, it worked for me" ...or something like that. With no takers on that one, I fear people are saying that there is nothing to be gained there?
    we read:
    [ -Xmx3800m -Xms3800m
    Configures a large Java heap to take advantage of the large memory system.
    -Xmn2g
    Configures a large heap for the young generation (which can be collected in parallel), again taking advantage of the large memory system. It helps prevent short lived objects from being prematurely promoted to the old generation, where garbage collection is more expensive.
    Unless you have problems with pauses, try granting as much memory as possible to the virtual machine. The default size (64MB) is often too small.
    Setting -Xms and -Xmx to the same value increases predictability by removing the most important sizing decision from the virtual machine. On the other hand, the virtual machine can't compensate if you make a poor choice.
    The -XX:+AggressiveHeap+ option inspects the machine resources (size of memory and number of processors) and attempts to set various parameters to be optimal for long-running, memory allocation-intensive jobs]
    So is Setting -Xms and -Xmx and -XX:AggressiveHeap
    best practice? What kind of performance improvement should we expect?
    Concerning JIT:
    I read this one
    [the impact of the JIT compiler is obvious on the graph: at startup the time taken is around 500us for the first few values, then quickly drops to 130us, before falling again to 70us, where it stays for 30 minutes,
    for this specific issue, I greatly improved my performances by configuring another VM argument: I set -XX:CompileThreshold=50]
    The size of the cache can be changed with
    -Xmaxjitcodesize
    This sounds like you should do something with JIT args, but reading
    // We disable the JIT during toolkit initialization. This
    // tends to touch lots of classes that aren't needed again
    // later and therefore JITing is counter-productiive.
    java.lang.Compiler.disable();
    However, finding
    the sweet spots for compilation thresholds has been tricky, so we're
    still experimenting with the recompilation policy. Work on it
    continues.
    sounds like there is no such straigth forward path, it all depends...
    Ok, its good, when
    [Small methods that can be more easily analyzed, optimized, and inlined where necessary (and not inlined where not necessary). Clearly delineated uses of data so that usage patterns and lifetimes are apparent. ]
    but when I read this:
    [The virtual machine is responsible for byte code execution, storage allocation, thread synchronization, etc. Running with the virtual machine are native code libraries that handle input and output through the operating system, especially graphics operations through the window system. Programs that spend significant portions of their time in those native code libraries will not see their performance on HotSpot improved as much as programs that spend most of their time executing byte codes.]
    I have the feeling that we might not able to improve performance that way?
    Any comments?
    otherwise i was wondering about
    -XX:CompileThreshold=50 -Xmaxjitcodesize (large, how large?)
    Somehow, we still feel that someone out there should have experienced similiar problems? But obviously there is no guarantee that the someone should surf by here!
    In c++ we used to just write everything ourselves. Here it does seem to be a question about the right use of other peoples stuff?
    Where you are kind of hoping for a shortcut, so you dont have to read endless number of documents, but can find a short document that actually addresses your problem ... well.
    -Simon
    Edited by: simoncpm on Mar 15, 2010 3:43 PM
    Edited by: simoncpm on Mar 15, 2010 3:53 PM

  • Query for Performance tuning

    Hi,
    I have attached my query and explain plan for that query. This create statement takes around 1.5 hrs for 200K records.
    Is there any way to tune the query.
    CREATE TABLE SC1.TMP_MP_XYZ
    PARALLEL 4 TABLESPACE FT_WORKAREA NOLOGGING AS
    SELECT /*+ ORDERED USE_HASH(x,d) INDEX_FFS(x) PARALLEL(d,4) */
    d.ROWID dis_rowid
    FROM SC2.TMP_GLOBAL PARTITION (PM200802) x,
    SC1.ba_DISP_XX PARTITION (PM200802) d
    WHERE x.dsp_hash IN
    (d.dsp_hash,
    TRUNC (d.dsp_hash, -14),
    TRUNC (d.dsp_hash, -7),
    TRUNC (d.dsp_hash, -14) + MOD (d.dsp_hash, POWER (10, 7))
    AND LOWER (d.url_name) LIKE x.rule || '%'
    AND BITAND (d.xflag, 1) = 0
    AND BITAND (d.xflag, 1) = 0
    Statement Id=14 Type=TABLE ACCESS
    Cost=17004 TimeStamp=06-03-08::10::04:37
    (1) CREATE TABLE STATEMENT CHOOSE
    Est. Rows: 274 Cost: 68,076
    LOAD AS SELECT
    (14) CONCATENATION
    (4) HASH JOIN
    Est. Rows: 1 Cost: 17,019
    (2) UNIQUE INDEX FAST FULL SCAN SC2.IMP_TMP_GLOBAL__NAME [Not Analyzed]
    Est. Rows: 146,873 Cost: 15
    (3) TABLE ACCESS FULL SC1.BA_DISP_XX [Analyzed]
    Blocks: 2,436 Est. Rows: 32 of 31,951 Cost: 17,004
    (7) HASH JOIN
    Est. Rows: 1 Cost: 17,019
    (5) UNIQUE INDEX FAST FULL SCAN SC2.IMP_TMP_GLOBAL _NAME  [Not Analyzed]
    Est. Rows: 146,873 Cost: 15
    (6) TABLE ACCESS FULL SC1.BA_DISP_XX [Analyzed]
    Blocks: 2,436 Est. Rows: 32 of 31,951 Cost: 17,004
    (10) HASH JOIN
    Est. Rows: 1 Cost: 17,019
    (8) UNIQUE INDEX FAST FULL SCAN SC2.IMP_TMP_GLOBAL__NAME [Not Analyzed]
    Est. Rows: 146,873 Cost: 15
    (9) TABLE ACCESS FULL SC1.BA_DISP_XX [Analyzed]
    Blocks: 2,436 Est. Rows: 32 of 31,951 Cost: 17,004
    (13) HASH JOIN
    Est. Rows: 1 Cost: 17,019
    (11) UNIQUE INDEX FAST FULL SCAN SC2.IMP_TMP_GLOBAL _NAME  [Not Analyzed]
    Est. Rows: 146,873 Cost: 15
    (12) TABLE ACCESS FULL SC1.BA_DISP_XX [Analyzed]
    Blocks: 2,436 Est. Rows: 32 of 31,951 Cost: 17,004
    - Mahesh

    First, can you repost with better formatting. Your execution plan has lost any indentation, and everything is at the same level, which makes it difficult to work out the real order of execution. Put the SQL statement and plan between lines with and on them, but with CODE in lower case i.e. code, which the forum engine recognises.
    Second, you seem to have four full table scans on ba_DISP_XX, which is probably due to the IN clause in the WHERE. I don't know what indexes you have, because you don't mention it. But Oracle cannot use ordinary indexes on columns when you apply a function or expression to that column. Which is what you are doing to the dsp_hash column, with the TRUNC function.
    So, the quickest comments I can make are:
    Investigate using function based indexes, but you may need several of them, which all take up disk space.
    Rewrite the query to not use TRUNC, or to use it in a standard way so that a single function based index could be used.
    Get rid of the hints. You are explicitly telling Oracle to use a HASH join, and PARALLEL scan the ba_DISP_XX table. Which is what it is doing in the execution plan. So you are getting what you have asked for.
    The query is very odd. Where is the proper join between tables x and d? I see an IN between them, which is unlikely to be the join. And a LOWER LIKE. If this is the join, then create a function based index on LOWER (d.url_name). Again, without a suitable index, Oracle will scan the full table.
    Bottom line - the query is doing what you want, because you have used hints to tell it to scan that table and use a HASH join, and without using function based indexes Oracle cannot used ordinary indexes for this query. So it will table scan either way.
    John

  • Proxy to JDBC scenario need dynamic sql query for sender .

    Hi Experts,
    I am developing proxy to jdbc scenario. in this i need to pass dynamic sql query  whre we are passing classical method like below.
    while we are passing select stmt in constant and mapped with access field  and key field mapped with key field.
    MY requirement is like instead of passing select stmt in constant where i can generate dynamically and passed in one field and mapped with access field.

    Hi Ravinder,
    A simple UDF or use of graphical mapping functions in most cases should provide you everything you need to construct a dynamic SQL statement for your requirement.
    Regards,
    Ryan Crosby

  • Need the sql query for IN clause.

    Hi All,
    i have item data like --
    IBM 200 and IBM 500
    have present code like this ----select * from emp where in (IBM 200 and IBM 500);
    so i need change or repalce like ('IBM 200','IBM 500')
    Any body please help me out this..
    Need to get out put 'IBM 200','IBM 500' from data IBM 200 and IBM 500 ...
    Edited by: anbarasan on Oct 17, 2011 10:30 PM

    Please consider the following when you post a question. This would help us help you better
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Need a single query for all IF conditions

    I have the following requirements which looks at two parameter p_batch and p_frequency and frames a select to query from the Employers table.
    Can I achieve all these in a single select statement? If so how to do it?
    Please help.
    Thank you.
    IF p_batch = 1 and p_frequency = 2 then
    SELECT er.employer_id
    FROM employers er
    WHERE SUBSTR (er.name, 1, 1) BETWEEN 'A' AND 'M'
    AND er.freq_flag = 2
    ORDER BY er.name asc;
    ELSIF p_batch = 2 and p_frequency = 2 then
    Open cursor for processing employer starting with N to Z
    SELECT er.employer_id
    FROM employers er
    WHERE SUBSTR (er.name, 1, 1) BETWEEN 'N' AND 'Z'
    AND er.freq_flag = 2
    ORDER BY er.name asc;
    ELSIF p_batch = 1 and p_frequency = 1 then
    Open cursor for processing employer starting with A to M for all ER
    SELECT er.employer_id
    FROM employers er
    WHERE SUBSTR (er.name, 1, 1) BETWEEN 'A' AND 'M'
    ORDER BY er.name asc;
    ELSIF p_batch = 2 and p_frequency = 1 then
    Open cursor for processing employer starting with N to Z for all ER
    SELECT er.employer_id
    FROM wweb.ptei_employers er
    WHERE SUBSTR (er.name, 1, 1) BETWEEN 'N' AND 'Z'
    ORDER BY er.name asc;
    ELSE
    -- Return as no need to send any mails
    END IF;

    Hi,
    Sure, you can do that in a single statement. Here's one way:
    SELECT       employer_id
    FROM       employers
    WHERE       SUBSTR (name, 1, 1) BETWEEN  CASE p_batch
                                 WHEN  1  THEN  'A'
                                 WHEN  2  THEN  'N'
                               END
                         AND      CASE p_batch
                                 WHEN  1  THEN  'M'
                                 WHEN  2  THEN  'Z'
                               END
    AND       (     (     p_frequency = 2
              AND     freq_flag   = 2
           OR     p_frequency  = 1
    ORDER BY  name
    ;

  • Need guidance in query optimization

    hi everyone.
    This query takes more than 400 milli seconds to execute.it executes more than 25 times.make the web page slow.
    can anyone provide guidance in optimizing this query
    SELECT
         DISTINCT *
    FROM
         PRICING_ANALYST
    WHERE
         USER_ID IN
              SELECT
              FROM      
                   PRICING_ANALYST pa,
                   ALC_PROJECT p,
                   REQUEST r,
                   ALCG_TEMP_QUOTE q,
                   ALC_USER u,
                   REQUESTER, ALC_COUNTRY
              WHERE
                   r.REQUEST_ID = 172938
                   AND
                   r.temp_quote_ref_num = q.temp_quote_ref_num
                   AND
                   r.user_id = q.user_id
                   AND
                   r.project_id = q.project_id
                   AND
                   pa.country_code = q.country_code
                   AND
                   q.country_code = alc_country.country_code
                   AND
                   p.project_id = r.project_id
                   AND
                   pa.user_id = u.user_id
                   AND
                   requester.user_id = p.user_id
                   AND
                   requester.project_id = p.project_id
                   AND
                        pa.CUSTOMER_EQUANT = 'Y'
                        OR
                        pa.CUSTOMER_NEW_EQUANT = 'Y'
                        OR
                        pa.CUSTOMER_EXISTING_EQUANT = 'Y'
                        OR
                        pa.CUSTOMER_EXISTING_GLOBALONE = 'Y'
                        OR
                        pa.CUSTOMER_OTHERS = 'Y'
                        OR
                        pa.CUSTOMER_FRANCE_TELECOM = 'Y'
                        OR
                        pa.CUSTOMER_SPRINT = 'Y'
                   AND
                   pa.COUNTRY_CODE = q.COUNTRY_CODE
                   AND
                        pa.Business_Opportunity IS null
                        OR
                        substr(pa.Business_Opportunity, instr(pa.Business_Opportunity,(r.Business_Opportunity || '''')), length(r.Business_Opportunity))= r.Business_Opportunity)
                        AND
                        pa.REQUEST_local_loop = 'Y'
                        AND
                        substr(pa.ACCESS_TECH_ID, instr(pa.ACCESS_TECH_ID, (q.ACCESS_TECH_ID || '''')), length(q.ACCESS_TECH_ID)) = q.ACCESS_TECH_ID
                   )

    Hi,
    Pl make sure all tables related to this query are analyzed recently with indexes, try to preserve the explain plan of the queries when it is running properly, so we can compare if slow running query, any change in the plan.
    Dilipkumar Patel

  • Need help with query for OITW

    I want to query a list that gives me all OnHand quantities for the Warehouses in one line per item:
    Item, Qty Whs1, Qty Whs2 ...
    Item1, Qty1_1, Qty1_2 ...
    Item2, Qty2_1, Qty2_2 ...
    Could somebody put me in the right direction?
    Thanks
    Franz

    Try this:
    SELECT P.Itemcode, T.ItemName,
    (Select U_NF_LagPlatz1 from OITW where WhsCode = 'NFE-1' and itemcode = T.Itemcode),
    (Select U_NF_LagPlatz2 from OITW where WhsCode = 'NFE-1' and itemcode = T.Itemcode),
        [NFE-1] AS Q1, [2] AS Q2, [3] AS Q3, [4] AS Q4,
        [5] AS Q5, [6] AS Q6, [7] AS Q7, [8] AS Q8,
        [9] AS Q9, [10] AS Q10
    FROM dbo.OITM T
    INNER JOIN
    (select Itemcode,OnHand, Whscode from oitw) s
    PIVOT
        sum(onhand)
        FOR whscode IN ([NFE-1],[2],[3],[4],[5],[6],[7],[8],[9],[10])
    ) p ON P.ItemCode = T.ItemCode
    ORDER BY P.[Itemcode]
    Regards,
    Bala
    Edited by: Balakumar Viswa on Jul 26, 2010 3:06 PM

  • Need an MDX query for Date range

    Hi there,
    My requirement is to filter sales from 1st of month to until holiday of the month. I am able to use to ":" range function for filtering, but I am not able to filter on holiday date. Becuase both filter and exists are giving set results, I need
    member expression to use range function. Please let me know ASAP.
    Thanks,
    ATRSAMS

    Hi ATRSAMS ,
    You can get the first member of the month with the OpeningPeriod function, and item(#) to have a specific member from a set .
    So if you want first member from your set : filter(.....).ITEM(0)
    Regards, David .

  • Need T-SQL query for Below condition, Thanks!

    experts,
    i having a table with below data,
    declare @tbl table (uid int, name varchar(10), id int)
    insert table @tbl values (1, 'val1', 6)
    insert table @tbl values (2, 'val2', 6)
    insert table @tbl values (3, 'val2', 8)
    insert table @tbl values (4, 'val1', 8)
    insert table @tbl values (5, 'val2', 7)
    insert table @tbl values (6, 'val1', 10)
    need to get all rows for those "id"'s which having both "name" ("val1" & "val2")?
    below should be output, thanks!@
    declare @tbl table (uid int, name varchar(10), id int)
    insert table @tbl values (1, 'val1', 6)
    insert table @tbl values (2, 'val2', 6)
    insert table @tbl values (3, 'val2', 8)
    insert table @tbl values (4, 'val1', 8)

    here you go with full illustration
    declare @tbl table (uid int, name varchar(10), id int)
    insert @tbl values (1, 'val1', 6)
    insert @tbl values (2, 'val2', 6)
    insert @tbl values (3, 'val2', 8)
    insert @tbl values (3, 'val10', 8)
    insert @tbl values (4, 'val1', 8)
    insert @tbl values (5, 'val2', 7)
    insert @tbl values (6, 'val1', 10)
    insert @tbl values (6, 'val24', 11)
    SELECT *
    FROM @tbl t
    WHERE EXISTS
    SELECT 1
    FROM @tbl
    WHERE id = t.id
    GROUP BY id
    HAVING COUNT(DISTINCT CASE WHEN name IN ('val1','val2') THEN name END) = 2
    and name IN ('val1','val2')
    output
    uid name id
    1 val1 6
    2 val2 6
    3 val2 8
    4 val1 8
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Need guidance selecting module for training

    hi friends,
    I have done my Bachelor of engineering in computers and after that i have worked as a developer in an MNC. After that i have done my MBA in Systems and IT.I had knowledge of ITIL project management but nothing majorly of marketing or finance .Now i am selecting in a big MNC where i am going to be trained on any one functional module of my choice from limited choice.
    Being a IT guy i am totally confused as to which module to select .I need some advice which module will be best suited for me.what is the current trend which module is in hot demand.I am sure i dont like FICO module but other than that all modules seem to be domain specific.
    Is there any module which will be useful for an IT guy.?
    please reply.and guide me...

    Its a million dolloar question which BILL GATES only can solve....!!!
    Learning functional module by training or books is just gaining theory knowledge. In order to understand various industry terminology and business processes either you should have worked in different industries or you get by experience.
    Wish you good luck....
    Regards,
    Jagadish

Maybe you are looking for

  • I just got a new computer and firefox 4. Why is my internet moving so slow?

    Every time I click the little green circle spins forever. I have yet to watch a video strait through. For instance a 3 minute clip can take as much as 15 minutes. I would like to know how to check my internet connection and find out what is going on

  • How to sync over all devices

    All my devices were synced for the longest time. Yesterday I upgraded my internet services so the iMac was out of commission for about 6 hours. Now I only receive iMessages on my iPhone and iPad. I can send from my iMac, just not receive though. I've

  • I am not able to install

    Hi, I tried to install webas preview, in the drive selection it gives an error saying that the drive does not have proper format choose any other drive. I am running the set up file from WIN XP machine. Can anyone help me. Regards Guhapriyan

  • Photoshop CC selective color UNDO BUG

    do this in photoshop CC: - open an image - layer -> new adj layer -> selective color preset: custom colors: reds cyan -100% press ctrl+z for UNDO it restores the effect on the image but it doesnt update the setting to 0% same thing in all adjustment

  • Is it possible to record a phone call on the 3Gs

    is it possiuble to record a phone call with the 3Gs