Stuck on how to improve very slow query without any admin rights

Hello All,
I am using the code below to query a very large data table (RH) and a few other joined tables. I am trying to improve the query but I do not have any admin rights and have no idea how to get diagnostic info on how the query is being executed. Apologies for the system specific and probably not easy to read code but I do not have a generic version that anyone could run, and no admin rights so I can not create tables.
The main part of the code below (subquery R) takes about 10 minutes to run (3 minutes without the date parameters) and the full code (with the two analytic functions on top) below takes an eye watering 30 minutes to run and this is only a subquery of a much larger query so I really need to get this running more quickly. All I want to do is place a cap on the dates, get partitioned row numbers and a lead row value on one of the fields. I really am stuck on how to get this query more efficient. Am I counting things multiple times unnecessarily? How can I make this quicker? Am I committing some cardinal programming sin in using analytic functions on subqueries?
Apologies for the vaugueness of this code and my questions but I am totally clueless about diagnostics and basically have very limited system access so I'm stuck as to where to go or to look.
Very grateful for any advice,
Jon
SELECT R.*
, ROW_NUMBER( ) OVER( PARTITION BY R.RTBLE_ID ORDER BY R.EFF_DT DESC, R.CHG_DT DESC ) RN
, LEAD(R.RTNG_CD,1,0) OVER( PARTITION BY R.RTBLE_ID ORDER BY R.EFF_DT DESC, R.CHG_DT DESC ) RTNG_CD_PREV
FROM ( SELECT RH.RTNG_ID
, RH.RTBLE_ID
, RA.RTNG_ACTN_DESC
, TYP.RTNG_TYP_DESC
, RH.RTNG_CD_ID
, RC.RTNG_CD
, RH.EFF_DT
, RH.CHG_DT
, RAL.RTNG_ALRT_TYP_ID
, RAL.EFF_DT ALRT_EFF_DT
, RAL.CHG_DT ALRT_CHG_DT
, RH.PRV_FLG
FROM FTCH_RTNG.RTNG_HIST RH
, FTCH_RTNG.RTNG_ALRT_HIST RAL
, FII_CORE.RTNG_ACTN RA
, FTCH_RTNG.RTNG_TYP TYP
, FII_CORE.RTNG_CD RC
WHERE RH.RTNG_ACTN_ID = RA.RTNG_ACTN_ID
AND RH.RTNG_TYP_ID = TYP.RTNG_TYP_ID
AND RH.RTNG_TYP_ID = RC.RTNG_TYP_ID
AND RH.RTNG_CD_ID = RC.RTNG_CD_ID
AND RH.RTNG_ID = RAL.RTNG_ID (+)
AND RH.DELETE_FLG = 'N'
AND RH.EFF_DT < TRUNC(CURRENT_DATE,'MM')
AND RAL.EFF_DT < TRUNC(CURRENT_DATE,'MM')
)R
-----

Thanks so much for replying blueforg, and for pointing out the code markup.
Our server is in the US and we run our code from London, so it is the local time I am interested in, CURRENT_DATE is merely there to get that and as you suggest is not a column. I want my cap to the first of whatever month I run the code on so I'm happy with that bit of the code (so 1 Oct if I run it today). I'm just surprised at how slow my code becomes when I try and restrict the dates and get the row numbers and next row values.
This code is actually a subquery used in a much bigger query that I am trying to tidy up and make more efficient. The RN is important as I will eventually be filtering for RN = 1. I didn't post the full query as it is huge,badly written (by me) and and particular to our databases so I'm tackling bits one at a time to cut down on confusion. I'll repost with the RN=1 and the code markup ;)
I also restricting the RH table directly (SELECT * FROM FTCH_RTNG.RTNG_HIST RH WHERE RH.EFF_DT < TRUNC(CURRENT_DATE,'MM')) and moving the analytic functions into the R subquery but that is very slow as well. I heard that temporary tables are efficient? I'm assuming that with my rubbish priveleges I will not be able to do that. I don't want to take any chances of messing anything up either!
Jon
SELECT RT.* FROM
  ( SELECT  R.*
          , ROW_NUMBER( ) OVER( PARTITION BY R.RTBLE_ID ORDER BY R.EFF_DT DESC, R.CHG_DT DESC ) RN    
          , LEAD(R.RTNG_CD,1,0) OVER( PARTITION BY R.RTBLE_ID ORDER BY R.EFF_DT DESC, R.CHG_DT DESC ) RTNG_CD_PREV
    FROM  ( SELECT  RH.RTNG_ID    
                  , RH.RTBLE_ID    
                  , RA.RTNG_ACTN_DESC    
                  , TYP.RTNG_TYP_DESC    
                  , RH.RTNG_CD_ID    
                  , RC.RTNG_CD    
                  , RH.EFF_DT  
                  , RH.CHG_DT 
                  , RAL.RTNG_ALRT_TYP_ID    
                  , RAL.EFF_DT ALRT_EFF_DT    
                  , RAL.CHG_DT ALRT_CHG_DT
                  , RH.PRV_FLG    
            FROM    FTCH_RTNG.RTNG_HIST RH
                  , FTCH_RTNG.RTNG_ALRT_HIST RAL
                  , FII_CORE.RTNG_ACTN RA    
                  , FTCH_RTNG.RTNG_TYP TYP    
                  , FII_CORE.RTNG_CD RC    
            WHERE RH.RTNG_ACTN_ID = RA.RTNG_ACTN_ID    
            AND RH.RTNG_TYP_ID = TYP.RTNG_TYP_ID    
            AND RH.RTNG_TYP_ID = RC.RTNG_TYP_ID    
            AND RH.RTNG_CD_ID = RC.RTNG_CD_ID    
            AND RH.RTNG_ID = RAL.RTNG_ID (+)    
            AND RH.DELETE_FLG = 'N'
            AND RH.EFF_DT < TRUNC(CURRENT_DATE,'MM')
            AND RAL.EFF_DT < TRUNC(CURRENT_DATE,'MM')
                                                      )R  )RT
WHERE RT.RN = 1-----

Similar Messages

  • How to improve performance of query

    Hi all,
    How to improve performance of query.
    please send :
    [email protected]
    thanks in advance
    bhaskar

    hi
    go through the following links for performance
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cccad390-0201-0010-5093-fd9ec8157802
    http://www.asug.com/client_files/Calendar/Upload/ASUG%205-mar-2004%20BW%20Performance%20PDF.pdf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1955ba90-0201-0010-d3aa-8b2a4ef6bbb2

  • How to write the given query using 'ANY ' operator

    Hi,
    How to write the given query using 'ANY ' operator , I dont need to fetch to grade_master table twice in database, just need to fetch within the result set.
    SELECT dsg_code,dsg_name,dsg_grade FROM designation_master WHERE dsg_orgn='&&Orgn' and dsg_ctry='&&ctry'
    And dsg_loc ='&&loc' And dsg_oru = '&&oru' and dsg_grade in decode('&&radio_group',
    1, SELECT grd_code FROM grade_master WHERE grd_osm_code in (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&Orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'),
    2, SELECT grd_code FROM grade_master WHERE grd_osm_code > (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' and grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code),
    3, SELECT grd_code FROM grade_master WHERE grd_osm_code < (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'))
    thanks
    rincy

    Hi,
    One thing I understood my your issue is you want to perform, execution of query once or fetch the results sets my minimizing the number of times executions of queries. It would be hard for us to check in this way, atleast provide some temporary data and some business rules. Only I can IN, >, < (queries logical conditons on inner query)
    - Pavan Kumar N
    - ORACLE OCP - 9i/10g
    https://www.oracleinternals.blogspot.com

  • How can I share the internet without any network distribution?

    I am facing a problem of internet sharing.
    I would like to share my connection from ethernet to airport,
    however, when I chose the "internet sharing" box, safari failed to connect to the internet.
    After removing the tick of the box, web browsing became normal again.
    how can I share the internet without any network distribution?
    thanks!

    You'd have to select in Sharing Preferences > Internet Sharing > Share your connection from ETHERNET, and to computers using AIRPORT.

  • How can I run ni488216.exe without any prompts during installation?

    How can I run ni488216.exe without any prompts during installation (Silent mode)?

    Typically you can do a silent install of the NI-488.2 software by running:
    setup.exe /S LV_INSTALL path=
    Regards,
    Greg Caesar
    National Instruments
    Applications Engineer

  • How to find back my iphone without any software

    how to find back my iphone without any software

    If you didn't turn on Find myiPhone prior to theft, you can't find it.  Sorry.

  • Very Slow Query with CTE inner join

    I have 2 tables (heavily simplified here to show relevant columns):
    CREATE TABLE tblCharge
    (ChargeID int NOT NULL,
    ParentChargeID int NULL,
    ChargeName varchar(200) NULL)
    CREATE TABLE tblChargeShare
    (ChargeShareID int NOT NULL,
    ChargeID int NOT NULL,
    TotalAmount money NOT NULL,
    TaxAmount money NULL,
    DiscountAmount money NULL,
    CustomerID int NOT NULL,
    ChargeShareStatusID int NOT NULL)
    I have a very basic View to Join them:
    CREATE VIEW vwBASEChargeShareRelation as
    Select c.ChargeID, ParentChargeID, s.CustomerID, s.TotalAmount, isnull(s.TaxAmount, 0) as TaxAmount, isnull(s.DiscountAmount, 0) as DiscountAmount
    from tblCharge c inner join tblChargeShare s
    on c.ChargeID = s.ChargeID Where s.ChargeShareStatusID < 3
    GO
    I then have a view containing a CTE to get the children of the Parent Charge:
    ALTER VIEW [vwChargeShareSubCharges] AS
    WITH RCTE AS
    SELECT ParentChargeId, ChargeID, 1 AS Lvl, ISNULL(TotalAmount, 0) as TotalAmount, ISNULL(TaxAmount, 0) as TaxAmount,
    ISNULL(DiscountAmount, 0) as DiscountAmount, CustomerID, ChargeID as MasterChargeID
    FROM vwBASEChargeShareRelation Where ParentChargeID is NULL
    UNION ALL
    SELECT rh.ParentChargeID, rh.ChargeID, Lvl+1 AS Lvl, ISNULL(rh.TotalAmount, 0), ISNULL(rh.TaxAmount, 0), ISNULL(rh.DiscountAmount, 0) , rh.CustomerID
    , rc.MasterChargeID
    FROM vwBASEChargeShareRelation rh
    INNER JOIN RCTE rc ON rh.PArentChargeID = rc.ChargeID and rh.CustomerID = rc.CustomerID
    Select MasterChargeID as ChargeID, CustomerID, Sum(TotalAmount) as TotalCharged, Sum(TaxAmount) as TotalTax, Sum(DiscountAmount) as TotalDiscount
    from RCTE
    Group by MasterChargeID, CustomerID
    GO
    So far so good, I can query this view and get the total cost for a line item including all children.
    The problem occurs when I join this table. The query:
    Select t.* from vwChargeShareSubCharges t
    inner join
    tblChargeShare s
    on t.CustomerID = s.CustomerID
    and t.MasterChargeID = s.ChargeID
    Where s.ChargeID = 1291094
    Takes around 30 ms to return a result (tblCharge and Charge Share have around 3.5 million records).
    But the query:
    Select t.* from vwChargeShareSubCharges t
    inner join
    tblChargeShare s
    on t.CustomerID = s.CustomerID
    and t.MasterChargeID = s.ChargeID
    Where InvoiceID = 1045854
    Takes around 2 minutes to return a result - even though the only charge with that InvoiceID is the same charge as the one used in the previous query.
    The same thing occurs if I do the join in the same query that the CTE is defined in.
    I ran the execution plan for each query. The first (fast) query looks like this:
    The second(slow) query looks like this:
    I am at a loss, and my skills at decoding execution plans to resolve this are lacking.
    I have separate indexes on tblCharge.ChargeID, tblCharge.ParentChargeID, tblChargeShare.ChargeID, tblChargeShare.InvoiceID, tblChargeShare.ChargeShareStatusID
    Any ideas? Tested on SQL 2008R2 and SQL 2012

    >> The database is linked [sic] to an established app and the column and table names can't be changed. <<
    Link? That is a term from pointer chains and network databases, not SQL. I will guess that means the app came back in the old pre-RDBMS days and you are screwed. 
    >> I am not too worried about the money field [sic], this is used for money and money based calculations so the precision and rounding are acceptable at this level. <<
    Field is a COBOL concept; columns are totally different. MONEY is how Sybase mimics the PICTURE clause that puts currency signs, commas, period, etc in a COBOL money field. 
    Using more than one operation (multiplication or division) on money columns will produce severe rounding errors. A simple way to visualize money arithmetic is to place a ROUND() function calls after 
    every operation. For example,
    Amount = (Portion / total_amt) * gross_amt
    can be rewritten using money arithmetic as:
    Amount = ROUND(ROUND(Portion/total_amt, 4) * 
    gross_amt, 4)
    Rounding to four decimal places might not seem an 
    issue, until the numbers you are using are greater 
    than 10,000. 
    BEGIN
    DECLARE @gross_amt MONEY,
     @total_amt MONEY,
     @my_part MONEY,
     @money_result MONEY,
     @float_result FLOAT,
     @all_floats FLOAT;
     SET @gross_amt = 55294.72;
     SET @total_amt = 7328.75;
     SET @my_part = 1793.33;
     SET @money_result = (@my_part / @total_amt) * 
    @gross_amt;
     SET @float_result = (@my_part / @total_amt) * 
    @gross_amt;
     SET @Retult3 = (CAST(@my_part AS FLOAT)
     / CAST( @total_amt AS FLOAT))
     * CAST(FLOAT, @gross_amt AS FLOAT);
     SELECT @money_result, @float_result, @all_floats;
    END;
    @money_result = 13525.09 -- incorrect
    @float_result = 13525.0885 -- incorrect
    @all_floats = 13530.5038673171 -- correct, with a -
    5.42 error 
    >> The keys are ChargeID(int, identity) and ChargeShareID(int, identity). <<
    Sorry, but IDENTITY is not relational and cannot be a key by definition. But it sure works just like a record number in your old COBOL file system. 
    >> .. these need to be int so that they are assigned by the database and unique. <<
    No, the data type of a key is not determined by physical storage, but by logical design. IDENTITY is the number of a parking space in a garage; a VIN is how you identify the automobile. 
    >> What would you recommend I use as keys? <<
    I do not know. I have no specs and without that, I cannot pull a Kabbalah number from the hardware. Your magic numbers can identify Squids, Automobile or Lady Gaga! I would ask the accounting department how they identify a charge. 
    >> Charge_Share_Status_ID links [sic] to another table which contains the name, formatting [sic] and other information [sic] or a charge share's status, so it is both an Id and a status. <<
    More pointer chains! Formatting? Unh? In RDBMS, we use a tiered architecture. That means display formatting is in a presentation layer. A properly created table has cohesion – it does one and only one data element. A status is a state of being that applies
    to an entity over a period time (think employment, marriage, etc. status if that is too abstract). 
    An identifier is based on the Law of Identity from formal logic “To be is to be something in particular” or “A is A” informally. There is no entity here! The Charge_Share_Status table should have the encoded values for a status and perhaps a description if
    they are unclear. If the list of values is clear, short and static, then use a CHECK() constraint. 
    On a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, this is literally that silly and wrong. 
    >> I understand what a CTE is; is there a better way to sum all children for a parent hierarchy? <<
    There are many ways to represent a tree or hierarchy in SQL.  This is called an adjacency list model and it looks like this:
    CREATE TABLE OrgChart 
    (emp_name CHAR(10) NOT NULL PRIMARY KEY, 
     boss_emp_name CHAR(10) REFERENCES OrgChart(emp_name), 
     salary_amt DECIMAL(6,2) DEFAULT 100.00 NOT NULL,
     << horrible cycle constraints >>);
    OrgChart 
    emp_name  boss_emp_name  salary_amt 
    ==============================
    'Albert'    NULL    1000.00
    'Bert'    'Albert'   900.00
    'Chuck'   'Albert'   900.00
    'Donna'   'Chuck'    800.00
    'Eddie'   'Chuck'    700.00
    'Fred'    'Chuck'    600.00
    This approach will wind up with really ugly code -- CTEs hiding recursive procedures, horrible cycle prevention code, etc.  The root of your problem is not knowing that rows are not records, that SQL uses sets and trying to fake pointer chains with some
    vague, magical non-relational "id".  
    This matches the way we did it in old file systems with pointer chains.  Non-RDBMS programmers are comfortable with it because it looks familiar -- it looks like records and not rows.  
    Another way of representing trees is to show them as nested sets. 
    Since SQL is a set oriented language, this is a better model than the usual adjacency list approach you see in most text books. Let us define a simple OrgChart table like this.
    CREATE TABLE OrgChart 
    (emp_name CHAR(10) NOT NULL PRIMARY KEY, 
     lft INTEGER NOT NULL UNIQUE CHECK (lft > 0), 
     rgt INTEGER NOT NULL UNIQUE CHECK (rgt > 1),
      CONSTRAINT order_okay CHECK (lft < rgt));
    OrgChart 
    emp_name         lft rgt 
    ======================
    'Albert'      1   12 
    'Bert'        2    3 
    'Chuck'       4   11 
    'Donna'       5    6 
    'Eddie'       7    8 
    'Fred'        9   10 
    The (lft, rgt) pairs are like tags in a mark-up language, or parens in algebra, BEGIN-END blocks in Algol-family programming languages, etc. -- they bracket a sub-set.  This is a set-oriented approach to trees in a set-oriented language. 
    The organizational chart would look like this as a directed graph:
                Albert (1, 12)
        Bert (2, 3)    Chuck (4, 11)
                       /    |   \
                     /      |     \
                   /        |       \
                 /          |         \
            Donna (5, 6) Eddie (7, 8) Fred (9, 10)
    The adjacency list table is denormalized in several ways. We are modeling both the Personnel and the Organizational chart in one table. But for the sake of saving space, pretend that the names are job titles and that we have another table which describes the
    Personnel that hold those positions.
    Another problem with the adjacency list model is that the boss_emp_name and employee columns are the same kind of thing (i.e. identifiers of personnel), and therefore should be shown in only one column in a normalized table.  To prove that this is not
    normalized, assume that "Chuck" changes his name to "Charles"; you have to change his name in both columns and several places. The defining characteristic of a normalized table is that you have one fact, one place, one time.
    The final problem is that the adjacency list model does not model subordination. Authority flows downhill in a hierarchy, but If I fire Chuck, I disconnect all of his subordinates from Albert. There are situations (i.e. water pipes) where this is true, but
    that is not the expected situation in this case.
    To show a tree as nested sets, replace the nodes with ovals, and then nest subordinate ovals inside each other. The root will be the largest oval and will contain every other node.  The leaf nodes will be the innermost ovals with nothing else inside them
    and the nesting will show the hierarchical relationship. The (lft, rgt) columns (I cannot use the reserved words LEFT and RIGHT in SQL) are what show the nesting. This is like XML, HTML or parentheses. 
    At this point, the boss_emp_name column is both redundant and denormalized, so it can be dropped. Also, note that the tree structure can be kept in one table and all the information about a node can be put in a second table and they can be joined on employee
    number for queries.
    To convert the graph into a nested sets model think of a little worm crawling along the tree. The worm starts at the top, the root, makes a complete trip around the tree. When he comes to a node, he puts a number in the cell on the side that he is visiting
    and increments his counter.  Each node will get two numbers, one of the right side and one for the left. Computer Science majors will recognize this as a modified preorder tree traversal algorithm. Finally, drop the unneeded OrgChart.boss_emp_name column
    which used to represent the edges of a graph.
    This has some predictable results that we can use for building queries.  The root is always (left = 1, right = 2 * (SELECT COUNT(*) FROM TreeTable)); leaf nodes always have (left + 1 = right); subtrees are defined by the BETWEEN predicate; etc. Here are
    two common queries which can be used to build others:
    1. An employee and all their Supervisors, no matter how deep the tree.
     SELECT O2.*
       FROM OrgChart AS O1, OrgChart AS O2
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND O1.emp_name = :in_emp_name;
    2. The employee and all their subordinates. There is a nice symmetry here.
     SELECT O1.*
       FROM OrgChart AS O1, OrgChart AS O2
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND O2.emp_name = :in_emp_name;
    3. Add a GROUP BY and aggregate functions to these basic queries and you have hierarchical reports. For example, the total salaries which each employee controls:
     SELECT O2.emp_name, SUM(S1.salary_amt)
       FROM OrgChart AS O1, OrgChart AS O2,
            Salaries AS S1
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND S1.emp_name = O2.emp_name 
       GROUP BY O2.emp_name;
    4. To find the level and the size of the subtree rooted at each emp_name, so you can print the tree as an indented listing. 
    SELECT O1.emp_name, 
       SUM(CASE WHEN O2.lft BETWEEN O1.lft AND O1.rgt 
       THEN O2.sale_amt ELSE 0.00 END) AS sale_amt_tot,
       SUM(CASE WHEN O2.lft BETWEEN O1.lft AND O1.rgt 
       THEN 1 ELSE 0 END) AS subtree_size,
       SUM(CASE WHEN O1.lft BETWEEN O2.lft AND O2.rgt
       THEN 1 ELSE 0 END) AS lvl
      FROM OrgChart AS O1, OrgChart AS O2
     GROUP BY O1.emp_name;
    5. The nested set model has an implied ordering of siblings which the adjacency list model does not. To insert a new node, G1, under part G.  We can insert one node at a time like this:
    BEGIN ATOMIC
    DECLARE rightmost_spread INTEGER;
    SET rightmost_spread 
        = (SELECT rgt 
             FROM Frammis 
            WHERE part = 'G');
    UPDATE Frammis
       SET lft = CASE WHEN lft > rightmost_spread
                      THEN lft + 2
                      ELSE lft END,
           rgt = CASE WHEN rgt >= rightmost_spread
                      THEN rgt + 2
                      ELSE rgt END
     WHERE rgt >= rightmost_spread;
     INSERT INTO Frammis (part, lft, rgt)
     VALUES ('G1', rightmost_spread, (rightmost_spread + 1));
     COMMIT WORK;
    END;
    The idea is to spread the (lft, rgt) numbers after the youngest child of the parent, G in this case, over by two to make room for the new addition, G1.  This procedure will add the new node to the rightmost child position, which helps to preserve the idea
    of an age order among the siblings.
    6. To convert a nested sets model into an adjacency list model:
    SELECT B.emp_name AS boss_emp_name, E.emp_name
      FROM OrgChart AS E
           LEFT OUTER JOIN
           OrgChart AS B
           ON B.lft
              = (SELECT MAX(lft)
                   FROM OrgChart AS S
                  WHERE E.lft > S.lft
                    AND E.lft < S.rgt);
    7. To find the immediate parent of a node: 
    SELECT MAX(P2.lft), MIN(P2.rgt)
      FROM Personnel AS P1, Personnel AS P2
     WHERE P1.lft BETWEEN P2.lft AND P2.rgt 
       AND P1.emp_name = @my_emp_name;
    I have a book on TREES & HIERARCHIES IN SQL which you can get at Amazon.com right now. It has a lot of other programming idioms for nested sets, like levels, structural comparisons, re-arrangement procedures, etc. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Very Slow Query due to Bitmap Conversion

    I have a strange problem with the performance of a spatial query. If I perform a 'SELECT non_geom_column FROM my_table WHERE complicated_join_query' the result comes back sub-second. However, when I replace the column selected with geometry and perform 'SELECT geom_column FROM my_table WHERE same_complicated_join_query' the response takes over a minute.
    The issue is that in the second case, despite the identical where clause, the explain plan is significantly different. In the 'select geom_column' query there is a BITMAP CONVERSION (TO ROWIDS) which accounts for all of the extra time, where as in the 'select other_column' query that conversion is replaced with TABLE ACCESS (BY INDEX ROWID) which is near instant.
    I have tried putting in some hints, although I do not have much experience with hints, and have also tried nesting the query in various sub-selects. Whatever I try I can not persuade the explain plan to drop the bitmap conversion when I select the geometry column. The full query and an explanation of that query are below. I have run out of things to try, so any help or suggestions at all would be much appreciated.
    Regards,
    Chris
    Explanation and query
    My application allows users to select geometries from a map image through clicking, dragging a box and various other means. The image is then refreshed - highlighting geometries based on the query with which I am having trouble. The user is then able to deselect any of those highlighted geometries, or append others with additional clicks or dragged selections.
    If there are 2 (or any even number of) clicks within the same geometry then that geometry is deselected. Alternatively the geometry could have been selected through an intersection with a dragged box, and then clicked in to deselect - again an even number of selections. Any odd number of selections (i.e. selecting, deselecting, then selecting again) would result in the geometry being selected.
    The application can not know if the multiple user clicks are in the same geometry, as it simply has an image to work with, so all it does is pass all the clicks so far to the database to deal with.
    My query therefore does each spatial point or rectangle query in turn and then appends the unique key for the rows each returned to a list. After performing all of the queries it groups the list by the key and the groups with an odd total are 'selected'. To do this logic in a single where clause I have ended up with nested select statements that are joined with union all commands.
    The query is therefore..
    SELECT
    --the below column (geometry) makes it very slow...replacing it with any non-spatial column takes less than 1/100 of the time - that is my problem!
    geometry
    FROM
    my_table
    WHERE
    primary_key IN
    SELECT primary_key FROM
    SELECT primary_key FROM my_table WHERE
    sdo_relate(geometry, mdsys.sdo_geometry(2003, 81989, NULL, sdo_elem_info_array(1, 1003, 3), sdo_ordinate_array( rectangle co-ords )), 'mask=anyinteract') = 'TRUE'
    UNION ALL SELECT primary_key FROM my_table WHERE
    sdo_relate(geometry, mdsys.sdo_geometry(2001, 81989, sdo_point_type( point co-ords , NULL), NULL, NULL), 'mask=anyinteract') = 'TRUE'
    --potentially more 'union all select...' here
    GROUP BY primary_key HAVING mod(count(*),2) = 1     
    AND
    --the below is the bounding rectangle of the whole image to be returned
    sdo_filter(geometry, mdsys.sdo_geometry(2003, 81989, NULL, sdo_elem_info_array(1, 1003, 3), sdo_ordinate_array( outer rectangle co-ords )), 'mask=anyinteract') = 'TRUE'

    Hi
    Thanks for the reply. After a lot more googling- it turns out this is a general Oracle problem and is not solely related to use of the GEOMETRY column. It seems that sometimes, the Oracle optimiser makes an arbitrary decision to do bitmap conversion. No amount of hints will get it to change its mind !
    One person reported a similarly negative change after table statistic collection had run.
    Why changing the columns being retrieved should change the execution path, I do not know.
    We have a numeric primary key which is always set to a positive value. When I added "AND primary_key_column > 0" (a pretty pointless clause) the optimiser changed the way it works and we got it working fast again.
    Chris

  • Very slow query on xml db objects

    Hi, I'm a dba (new to xml db) trying to diagnose some very slow queries against xml tables. The following takes 2 + hours to return a count of ~700,000 records. We have some that take 10-15 hours.
    select count(*)
    from MEDTRONICCRM a, table(xmlsequence(extract(value(a),'/MedtronicCRM/Counters/
    Histogram'))) b ,
    table(xmlsequence(extract(value(b),'/Histogram/Row'))) c, table(xmlsequence(extract(value(c),'/Row/Column'))) d
    The explain plan from a tkprof looks like this:
    Rows Row Source Operation
    1 SORT AGGREGATE (cr=1586294 r=27724 w=0 time=334399181 us)
    761020 NESTED LOOPS (cr=1586294 r=27724 w=0 time=6285597846 us)
    209395 NESTED LOOPS (cr=1586294 r=27724 w=0 time=1294406875 us)
    16864 NESTED LOOPS (cr=1586294 r=27724 w=0 time=188247898 us)
    544 TABLE ACCESS FULL OBJ#(26985) (cr=1993 r=548 w=0 time=171380 us)
    16864 COLLECTION ITERATOR PICKLER FETCH (cr=0 r=0 w=0 time=82831582 us)
    209395 COLLECTION ITERATOR PICKLER FETCH (cr=0 r=0 w=0 time=939691917 us)
    761020 COLLECTION ITERATOR PICKLER FETCH (cr=0 r=0 w=0 time=3399611143 us)
    I noticed the following statemnt in a previous thread:
    "Indexing is not the answer here... The problem is the storage model. You are current storing all of the collections as serialized lobs. This means that all manipluation of the collection is done in memory. We need to store the collections as nested tables to get peformant queries on them. You do this by using the store VARRAY as table clause to control which collections are stored as nested tables. "
    Could this be the problem? How do I tell which storage model we are using.
    Thanks ,
    Heath Henjum

    With 10g I get the following
    SQL> begin
    2 dbms_xmlschema.registerSchema
    3 (
    4 schemaURL => '&3',
    5 schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
    6 local => TRUE,
    7 genTypes => TRUE,
    8 genBean => FALSE,
    9 genTables => &5
    10 );
    11 end;
    12 /
    old 4: schemaURL => '&3',
    new 4: schemaURL => 'MedtronicCRM.xsd',
    old 5: schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
    new 5: schemaDoc => xdbURIType('/home/OTNTEST/xsd/MedtronicCRM.xsd').getClob(),
    old 9: genTables => &5
    new 9: genTables => TRUE
    begin
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00175: a complex base within "simpleContent" must have simple content
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 17
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
    ORA-06512: at line 2
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options

  • Stumbled on the slow query, Can any one look into it, Y it is so slow

    I just stumbled on the slow query . Can any one please guess why this querie is so slow, do i need to change anything in it
    Pid=32521 Tid=2884070320 03/26/2011 07:54:19.176 - Cursor wm09_2_49107 took 27996 ms elapsed time and 27995 ms db time for 1 fetches. sql string:
    SELECT ALLOC_INVN_DTL.ALLOC_INVN_DTL_ID, ALLOC_INVN_DTL.WHSE, ALLOC_INVN_DTL.SKU_ID, ALLOC_INVN_DTL.INVN_TYPE, ALLOC_INVN_DTL.PROD_STAT, ALLOC_INVN_DTL.BATCH_NBR, ALLOC_INVN_DTL.SKU_ATTR_1, ALLOC_INVN_DTL.SKU_ATTR_2, ALLOC_INVN_DTL.SKU_ATTR_3, ALLOC_INVN_DTL.SKU_ATTR_4, ALLOC_INVN_DTL.SKU_ATTR_5, ALLOC_INVN_DTL.CNTRY_OF_ORGN, ALLOC_INVN_DTL.ALLOC_INVN_CODE, ALLOC_INVN_DTL.CNTR_NBR, ALLOC_INVN_DTL.TRANS_INVN_TYPE, ALLOC_INVN_DTL.PULL_LOCN_ID, ALLOC_INVN_DTL.INVN_NEED_TYPE, ALLOC_INVN_DTL.TASK_TYPE, ALLOC_INVN_DTL.TASK_PRTY, ALLOC_INVN_DTL.TASK_BATCH, ALLOC_INVN_DTL.ALLOC_UOM, ALLOC_INVN_DTL.ALLOC_UOM_QTY, ALLOC_INVN_DTL.QTY_PULLD, ALLOC_INVN_DTL.FULL_CNTR_ALLOCD, ALLOC_INVN_DTL.ORIG_REQMT, ALLOC_INVN_DTL.QTY_ALLOC, ALLOC_INVN_DTL.DEST_LOCN_ID, ALLOC_INVN_DTL.TASK_GENRTN_REF_CODE, ALLOC_INVN_DTL.TASK_GENRTN_REF_NBR, ALLOC_INVN_DTL.TASK_CMPL_REF_CODE, ALLOC_INVN_DTL.TASK_CMPL_REF_NBR, ALLOC_INVN_DTL.ERLST_START_DATE_TIME, ALLOC_INVN_DTL.LTST_START_DATE_TIME, ALLOC_INVN_DTL.LTST_CMPL_DATE_TIME, ALLOC_INVN_DTL.NEED_ID, ALLOC_INVN_DTL.STAT_CODE, ALLOC_INVN_DTL.CREATE_DATE_TIME, ALLOC_INVN_DTL.MOD_DATE_TIME, ALLOC_INVN_DTL.USER_ID, ALLOC_INVN_DTL.PKT_CTRL_NBR, ALLOC_INVN_DTL.REQD_INVN_TYPE, ALLOC_INVN_DTL.REQD_PROD_STAT, ALLOC_INVN_DTL.REQD_BATCH_NBR, ALLOC_INVN_DTL.REQD_SKU_ATTR_1, ALLOC_INVN_DTL.REQD_SKU_ATTR_2, ALLOC_INVN_DTL.REQD_SKU_ATTR_3, ALLOC_INVN_DTL.REQD_SKU_ATTR_4, ALLOC_INVN_DTL.REQD_SKU_ATTR_5, ALLOC_INVN_DTL.REQD_CNTRY_OF_ORGN, ALLOC_INVN_DTL.PKT_SEQ_NBR, ALLOC_INVN_DTL.CARTON_NBR, ALLOC_INVN_DTL.CARTON_SEQ_NBR, ALLOC_INVN_DTL.PIKR_NBR, ALLOC_INVN_DTL.PULL_LOCN_SEQ_NBR, ALLOC_INVN_DTL.DEST_LOCN_SEQ_NBR, ALLOC_INVN_DTL.TASK_CMPL_REF_NBR_SEQ, ALLOC_INVN_DTL.SUBSTITUTION_FLAG, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_1, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_2, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_3, ALLOC_INVN_DTL.CD_MASTER_ID FROM ALLOC_INVN_DTL WHERE ( ( ( ( ( ( ALLOC_INVN_DTL.TASK_CMPL_REF_CODE = :1 ) AND ( ALLOC_INVN_DTL.TASK_CMPL_REF_NBR = :2 ) ) AND ( ALLOC_INVN_DTL.SKU_ID = :3 ) ) AND ( ALLOC_INVN_DTL.CNTR_NBR = :4 ) ) AND ( ALLOC_INVN_DTL.STAT_CODE < 1 ) ) AND ( ALLOC_INVN_DTL.PULL_LOCN_ID IS NULL ) )
    input variables
    1: Address(0xabe74300) Length(0) Type(8) "2" - No Indicator
    2: Address(0x8995474) Length(0) Type(8) "PERP014119" - No Indicator
    3: Address(0xab331f1c) Length(0) Type(8) "MB57545217" - No Indicator
    4: Address(0xab31e32c) Length(0) Type(8) "T0000000000000078257" - No Indicator

    784786 wrote:
    I just stumbled on the slow query . Can any one please guess why this querie is so slow, do i need to change anything in it
    Pid=32521 Tid=2884070320 03/26/2011 07:54:19.176 - Cursor wm09_2_49107 took 27996 ms elapsed time and 27995 ms db time for 1 fetches. sql string:
    SELECT ALLOC_INVN_DTL.ALLOC_INVN_DTL_ID, ALLOC_INVN_DTL.WHSE, ALLOC_INVN_DTL.SKU_ID, ALLOC_INVN_DTL.INVN_TYPE, ALLOC_INVN_DTL.PROD_STAT, ALLOC_INVN_DTL.BATCH_NBR, ALLOC_INVN_DTL.SKU_ATTR_1, ALLOC_INVN_DTL.SKU_ATTR_2, ALLOC_INVN_DTL.SKU_ATTR_3, ALLOC_INVN_DTL.SKU_ATTR_4, ALLOC_INVN_DTL.SKU_ATTR_5, ALLOC_INVN_DTL.CNTRY_OF_ORGN, ALLOC_INVN_DTL.ALLOC_INVN_CODE, ALLOC_INVN_DTL.CNTR_NBR, ALLOC_INVN_DTL.TRANS_INVN_TYPE, ALLOC_INVN_DTL.PULL_LOCN_ID, ALLOC_INVN_DTL.INVN_NEED_TYPE, ALLOC_INVN_DTL.TASK_TYPE, ALLOC_INVN_DTL.TASK_PRTY, ALLOC_INVN_DTL.TASK_BATCH, ALLOC_INVN_DTL.ALLOC_UOM, ALLOC_INVN_DTL.ALLOC_UOM_QTY, ALLOC_INVN_DTL.QTY_PULLD, ALLOC_INVN_DTL.FULL_CNTR_ALLOCD, ALLOC_INVN_DTL.ORIG_REQMT, ALLOC_INVN_DTL.QTY_ALLOC, ALLOC_INVN_DTL.DEST_LOCN_ID, ALLOC_INVN_DTL.TASK_GENRTN_REF_CODE, ALLOC_INVN_DTL.TASK_GENRTN_REF_NBR, ALLOC_INVN_DTL.TASK_CMPL_REF_CODE, ALLOC_INVN_DTL.TASK_CMPL_REF_NBR, ALLOC_INVN_DTL.ERLST_START_DATE_TIME, ALLOC_INVN_DTL.LTST_START_DATE_TIME, ALLOC_INVN_DTL.LTST_CMPL_DATE_TIME, ALLOC_INVN_DTL.NEED_ID, ALLOC_INVN_DTL.STAT_CODE, ALLOC_INVN_DTL.CREATE_DATE_TIME, ALLOC_INVN_DTL.MOD_DATE_TIME, ALLOC_INVN_DTL.USER_ID, ALLOC_INVN_DTL.PKT_CTRL_NBR, ALLOC_INVN_DTL.REQD_INVN_TYPE, ALLOC_INVN_DTL.REQD_PROD_STAT, ALLOC_INVN_DTL.REQD_BATCH_NBR, ALLOC_INVN_DTL.REQD_SKU_ATTR_1, ALLOC_INVN_DTL.REQD_SKU_ATTR_2, ALLOC_INVN_DTL.REQD_SKU_ATTR_3, ALLOC_INVN_DTL.REQD_SKU_ATTR_4, ALLOC_INVN_DTL.REQD_SKU_ATTR_5, ALLOC_INVN_DTL.REQD_CNTRY_OF_ORGN, ALLOC_INVN_DTL.PKT_SEQ_NBR, ALLOC_INVN_DTL.CARTON_NBR, ALLOC_INVN_DTL.CARTON_SEQ_NBR, ALLOC_INVN_DTL.PIKR_NBR, ALLOC_INVN_DTL.PULL_LOCN_SEQ_NBR, ALLOC_INVN_DTL.DEST_LOCN_SEQ_NBR, ALLOC_INVN_DTL.TASK_CMPL_REF_NBR_SEQ, ALLOC_INVN_DTL.SUBSTITUTION_FLAG, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_1, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_2, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_3, ALLOC_INVN_DTL.CD_MASTER_ID FROM ALLOC_INVN_DTL WHERE ( ( ( ( ( ( ALLOC_INVN_DTL.TASK_CMPL_REF_CODE = :1 ) AND ( ALLOC_INVN_DTL.TASK_CMPL_REF_NBR = :2 ) ) AND ( ALLOC_INVN_DTL.SKU_ID = :3 ) ) AND ( ALLOC_INVN_DTL.CNTR_NBR = :4 ) ) AND ( ALLOC_INVN_DTL.STAT_CODE < 1 ) ) AND ( ALLOC_INVN_DTL.PULL_LOCN_ID IS NULL ) )
    input variables
    1: Address(0xabe74300) Length(0) Type(8) "2" - No Indicator
    2: Address(0x8995474) Length(0) Type(8) "PERP014119" - No Indicator
    3: Address(0xab331f1c) Length(0) Type(8) "MB57545217" - No Indicator
    4: Address(0xab31e32c) Length(0) Type(8) "T0000000000000078257" - No IndicatorWithout more information I cannot tell you why it is slow, but I can certainly tell you why it is impossible to read.
    Just because sql allows unformatted query text does not mean it is a good idea. Why not bring some sanity to this for your own sake, not to mention that of people from whom you are expecting to actually read and analyze this mess. I wish someone could explain to me why people write these long stream-of-consciousness queries.
    When posting to this forum you should use the code tags to bracket your code and preserve the formatting. Then the code should actually be formatted:
    SELECT
         ALLOC_INVN_DTL.ALLOC_INVN_DTL_ID,
         ALLOC_INVN_DTL.WHSE,
         ALLOC_INVN_DTL.SKU_ID,
         ALLOC_INVN_DTL.INVN_TYPE,
         ALLOC_INVN_DTL.PROD_STAT,
         ALLOC_INVN_DTL.BATCH_NBR,
         ALLOC_INVN_DTL.SKU_ATTR_1,
         ALLOC_INVN_DTL.SKU_ATTR_2,
         ALLOC_INVN_DTL.SKU_ATTR_3,
         ALLOC_INVN_DTL.SKU_ATTR_4,
         ALLOC_INVN_DTL.SKU_ATTR_5,
         ALLOC_INVN_DTL.CNTRY_OF_ORGN,
         ALLOC_INVN_DTL.ALLOC_INVN_CODE,
         ALLOC_INVN_DTL.CNTR_NBR,
         ALLOC_INVN_DTL.TRANS_INVN_TYPE,
         ALLOC_INVN_DTL.PULL_LOCN_ID,
         ALLOC_INVN_DTL.INVN_NEED_TYPE,
         ALLOC_INVN_DTL.TASK_TYPE,
         ALLOC_INVN_DTL.TASK_PRTY,
         ALLOC_INVN_DTL.TASK_BATCH,
         ALLOC_INVN_DTL.ALLOC_UOM,
         ALLOC_INVN_DTL.ALLOC_UOM_QTY,
         ALLOC_INVN_DTL.QTY_PULLD,
         ALLOC_INVN_DTL.FULL_CNTR_ALLOCD,
         ALLOC_INVN_DTL.ORIG_REQMT,
         ALLOC_INVN_DTL.QTY_ALLOC,
         ALLOC_INVN_DTL.DEST_LOCN_ID,
         ALLOC_INVN_DTL.TASK_GENRTN_REF_CODE,
         ALLOC_INVN_DTL.TASK_GENRTN_REF_NBR,
         ALLOC_INVN_DTL.TASK_CMPL_REF_CODE,
         ALLOC_INVN_DTL.TASK_CMPL_REF_NBR,
         ALLOC_INVN_DTL.ERLST_START_DATE_TIME,
         ALLOC_INVN_DTL.LTST_START_DATE_TIME,
         ALLOC_INVN_DTL.LTST_CMPL_DATE_TIME,
         ALLOC_INVN_DTL.NEED_ID,
         ALLOC_INVN_DTL.STAT_CODE,
         ALLOC_INVN_DTL.CREATE_DATE_TIME,
         ALLOC_INVN_DTL.MOD_DATE_TIME,
         ALLOC_INVN_DTL.USER_ID,
         ALLOC_INVN_DTL.PKT_CTRL_NBR,      
         ALLOC_INVN_DTL.REQD_INVN_TYPE,      
         ALLOC_INVN_DTL.REQD_PROD_STAT,
         ALLOC_INVN_DTL.REQD_BATCH_NBR,
         ALLOC_INVN_DTL.REQD_SKU_ATTR_1,
         ALLOC_INVN_DTL.REQD_SKU_ATTR_2,
         ALLOC_INVN_DTL.REQD_SKU_ATTR_3,
         ALLOC_INVN_DTL.REQD_SKU_ATTR_4,
         ALLOC_INVN_DTL.REQD_SKU_ATTR_5,
         ALLOC_INVN_DTL.REQD_CNTRY_OF_ORGN,
         ALLOC_INVN_DTL.PKT_SEQ_NBR,
         ALLOC_INVN_DTL.CARTON_NBR,
         ALLOC_INVN_DTL.CARTON_SEQ_NBR,
         ALLOC_INVN_DTL.PIKR_NBR,
         ALLOC_INVN_DTL.PULL_LOCN_SEQ_NBR,
         ALLOC_INVN_DTL.DEST_LOCN_SEQ_NBR,
         ALLOC_INVN_DTL.TASK_CMPL_REF_NBR_SEQ,
         ALLOC_INVN_DTL.SUBSTITUTION_FLAG,
         ALLOC_INVN_DTL.MISC_ALPHA_FIELD_1,
         ALLOC_INVN_DTL.MISC_ALPHA_FIELD_2,
         ALLOC_INVN_DTL.MISC_ALPHA_FIELD_3,
         ALLOC_INVN_DTL.CD_MASTER_ID
    FROM ALLOC_INVN_DTL
    WHERE (
                 ( ALLOC_INVN_DTL.TASK_CMPL_REF_CODE = :1
                    AND ( ALLOC_INVN_DTL.TASK_CMPL_REF_NBR = :2
                  AND ( ALLOC_INVN_DTL.SKU_ID = :3
                AND ( ALLOC_INVN_DTL.CNTR_NBR = :4
              AND ( ALLOC_INVN_DTL.STAT_CODE < 1
            AND ( ALLOC_INVN_DTL.PULL_LOCN_ID IS NULL
          )Now, since you are only selecting from one table, there is no need to clutter up the query by qualifying every column name with the table name. Let's simplify with this:
    SELECT
         ALLOC_INVN_DTL_ID,
         WHSE,
         SKU_ID,
         INVN_TYPE,
         PROD_STAT,
         BATCH_NBR,
         SKU_ATTR_1,
         SKU_ATTR_2,
         SKU_ATTR_3,
         SKU_ATTR_4,
         SKU_ATTR_5,
         CNTRY_OF_ORGN,
         ALLOC_INVN_CODE,
         CNTR_NBR,
         TRANS_INVN_TYPE,
         PULL_LOCN_ID,
         INVN_NEED_TYPE,
         TASK_TYPE,
         TASK_PRTY,
         TASK_BATCH,
         ALLOC_UOM,
         ALLOC_UOM_QTY,
         QTY_PULLD,
         FULL_CNTR_ALLOCD,
         ORIG_REQMT,
         QTY_ALLOC,
         DEST_LOCN_ID,
         TASK_GENRTN_REF_CODE,
         TASK_GENRTN_REF_NBR,
         TASK_CMPL_REF_CODE,
         TASK_CMPL_REF_NBR,
         ERLST_START_DATE_TIME,
         LTST_START_DATE_TIME,
         LTST_CMPL_DATE_TIME,
         NEED_ID,
         STAT_CODE,
         CREATE_DATE_TIME,
         MOD_DATE_TIME,
         USER_ID,
         PKT_CTRL_NBR,      
         REQD_INVN_TYPE,      
         REQD_PROD_STAT,
         REQD_BATCH_NBR,
         REQD_SKU_ATTR_1,
         REQD_SKU_ATTR_2,
         REQD_SKU_ATTR_3,
         REQD_SKU_ATTR_4,
         REQD_SKU_ATTR_5,
         REQD_CNTRY_OF_ORGN,
         PKT_SEQ_NBR,
         CARTON_NBR,
         CARTON_SEQ_NBR,
         PIKR_NBR,
         PULL_LOCN_SEQ_NBR,
         DEST_LOCN_SEQ_NBR,
         TASK_CMPL_REF_NBR_SEQ,
         SUBSTITUTION_FLAG,
         MISC_ALPHA_FIELD_1,
         MISC_ALPHA_FIELD_2,
         MISC_ALPHA_FIELD_3,
         CD_MASTER_ID
    FROM ALLOC_INVN_DTL
    WHERE (
                 ( TASK_CMPL_REF_CODE = :1
                    AND ( TASK_CMPL_REF_NBR = :2
                  AND ( SKU_ID = :3
                AND ( CNTR_NBR = :4
              AND ( STAT_CODE < 1
            AND ( PULL_LOCN_ID IS NULL
          )And finally, your WHERE clause is a simple string of AND conditions, there was no need to complicate it with all of the nested parentheses. Much simpler:
    WHERE ALLOC_INVN_DTL.TASK_CMPL_REF_CODE = :1
       AND  ALLOC_INVN_DTL.TASK_CMPL_REF_NBR = :2
       AND  ALLOC_INVN_DTL.SKU_ID = :3
       AND  ALLOC_INVN_DTL.CNTR_NBR = :4
       AND  ALLOC_INVN_DTL.STAT_CODE < 1
       AND  ALLOC_INVN_DTL.PULL_LOCN_ID IS NULL
               None of the above makes a whit of difference in your query performance, but if you worked in my office, I would make you clean it up before I even attempted to do a performance analysis.
    Edited by: EdStevens on Mar 26, 2011 2:14 PM

  • This browser has very slow connectivty to any web site.

    Whatever web sit I want to look at this browser is very slow to connect. I have never had this type of issue with explorer.

    Hi,
    When you initally posted your question, it appears that addons.mozilla.org was undergoing maintenance. I can now successfully download addons from addons.mozilla.org with no problem. You can see the status report at http://status.mozilla.org/en-US/detail/78/ describing the downtime.
    '''EDIT: Downtime has been resolved and it should be working now'''

  • Very slow at loading any website if it loads at all

    Everytime I load Firefox , lately it has been very slow at loading a website and sometimes it take so long that it times out. It has also looked like it loaded a wed page but it will not load the whole page
    == This happened ==
    Every time Firefox opened
    == a couple days ago

    Please see http://support.mozilla.com/en-US/forum/1/656957

  • How to write a SQL Query without using group by clause

    Hi,
    Can anyone help me to find out if there is a approach to build a SQL Query without using group by clause.
    Please site an example if is it so,
    Regards

    I hope this example could illuminate danepc on is problem.
    CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
    CREATE OR REPLACE FUNCTION GET_ARR return my_array
    as
         arr my_array;
    begin
         arr := my_array();
         for i in 1..10 loop
              arr.extend;
              arr(i) := i mod 7;
         end loop;
         return arr;
    end;
    select column_value
    from table(get_arr)
    order by column_value;
    select column_value,count(*) occurences
    from table(get_arr)
    group by column_value
    order by column_value;And the output should be something like this:
    SQL> CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
      2  /
    Tipo creato.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION GET_ARR return my_array
      2  as
      3   arr my_array;
      4  begin
      5   arr := my_array();
      6   for i in 1..10 loop
      7    arr.extend;
      8    arr(i) := i mod 7;
      9   end loop;
    10   return arr;
    11  end;
    12  /
    Funzione creata.
    SQL>
    SQL>
    SQL> select column_value
      2  from table(get_arr)
      3  order by column_value;
    COLUMN_VALUE
               0
               1
               1
               2
               2
               3
               3
               4
               5
               6
    Selezionate 10 righe.
    SQL>
    SQL> select column_value,count(*) occurences
      2  from table(get_arr)
      3  group by column_value
      4  order by column_value;
    COLUMN_VALUE OCCURENCES
               0          1
               1          2
               2          2
               3          2
               4          1
               5          1
               6          1
    Selezionate 7 righe.
    SQL> Bye Alessandro

  • Problems with Yahoo Mail and Calendar on MacBook air.  Very slow performance.  Any ideas?

    I have a macbook air running Apple's latest OS. My system is up-to-date.  Over the last few weeks, I have had a very difficult time accessing my yahoo mail and calendar.  I can access other sites, thus I know my connection is solid.  The problem seems to be limited to Yahoo.  I can access my yahoo account on my husband's PC without any issues.  To be specific, here are the symptoms of my problem.  When I try to open my yahoo mail on the Mac, I get the spinning wheel for several minutes.  I view my yahoo calendar through ical.  Yahoo is not connecting with ical, thus my calendar is empty.  I verified my settings and they are correct.  Also, sometimes after trying and retrying the calendar will connect.  I checked the web and did not find any info about this problem.  I appreciate your assistance.

    I have been having the same issue. I can't figure it out. I have tried setting this up my yahoo calendar on my phone and my computer and my iPhone with no luck. It's definitely a Yahoo Problem. At this point I have become enemy to Yahoo Calendar.

  • How to set up Group Policy without any server installed

    How to set up Group Policy on Win8 without any server installed?
    I have set up 50 users on LAN and want to push softwares via one common point. From google I found to deploy Software using Group Policy. But then Group Policy occurs in Servers and I don't have any server set up.

    Hello,
    a Domain requires at least one Windows server OS machine which has Active Directory installed.
    As previous already mentioned from SenneVL this also requires that computers are added to the domain and that you create user accounts in Active Directory users and computers which stores the account information in the Active directory database.
    In your case with single computers each machine has its own database(SAM) which stores passwords etc. this is different in a domain.
    Each computer has a local policy which will be overwritten from centrally managed policies from the domain.
    "The common point would be my PC (Admin PC) ."
    This machine can not be used for your needs with software installation for 50 computers.
    "How To Use the Group Policy Editor to Manage Local Computer Policy."
    This is about the local machine and you cannot manage them for other computers from your Admin PC.
    "DOMAIN part: By default Microsoft takes everyone on Workgroup. Is that not a default DOMAIN? or should I make one lets say "ABC" on every PC ?"
    NO, this is NOT a domain.
    http://windows.microsoft.com/en-us/windows7/what-is-the-difference-between-a-domain-a-workgroup-and-a-homegroup
    Best regards
    Meinolf Weber
    MVP, MCP, MCTS
    Microsoft MVP - Directory Services
    My Blog: http://blogs.msmvps.com/MWeber
    Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.
    Twitter:  

Maybe you are looking for