Connect by prior performance

In our application, we have a lot of 'trees' in our data (parent/child relationships within a table). We rely heavily on 'connect by prior' to search through the trees, to find for example values that are defined in one of the parents ('inheritance').
Lately however, we've been eliminating connect by priors wherever we can lately, because performance is dramatic. No matter what indexes we use, we keep getting full tablescans on large tables because of the connect by priors. Views with 2 connect by priors are deadly for performance.
What is a good way to optimize connect by priors?
As an example of why we use connect by prior, consider this:
table A
ID   PARENT_ID   NAME    LENGTH
1    NULL        root    10
2    1           child   NULLWe consider record 2 'derived' from record 1, inheriting its length. The alternative for connect by prior is to populate the child length whenever the master length changes, and this is what we do in most situations now, but it's hell to keep track of this. If a record changes, you would still have to go down the tree to change all child lengths etc, so we rather use connect by prior.
Any ideas?

Ivo, would you please post the table definition (if different than your example), the actual list of indexes, a sample query, and the explain plan for that query?
I use hierarchical queries extensively on tables with millions of rows. They work very well if all the pieces are in place. Let's see if we can get your queries humming...

Similar Messages

  • Connect By Prior - Performance and Missing Parent

    I have to say right off the top that I'm not a SQL expert by any means so please be gentle. :)
    I have a query that runs through a Bill Of Materials that works except for two things:
    1. It is horribly slow - 60-90 seconds to return under 300 rows.
    2. It doesn't show the parent node.
    I'm looking into indexes now, so I'm not sure if there's an issue there or not. As far as #2 goes, there are two tables that are involved: BOM_STRUCTURES_B and BOM_COMPONENTS_B. Every item below the parent node has a BOM_COMPONENTS_B record. If a BOM_COMPONENT is a parent to other components, there is a BOM_STRUCTURES_B record for that. (In other words, everything that is a parent has a BOM_STRUCTURES_B record, and all the children have a BOM_COMPONENTS_B record that point to the parent - BOM_STRUCTURES_B). The only exception to this is the parent node, which only has a BOM_STRUCTURES_B record (it is NOT a child, so there is no BOM_COMPONENTS_B record). I've added a "UNION" to the bottom of the script below, but it changes my sort order completely.
    Here's my script:
    select bbm.assembly_item_id,
    bic.component_item_id Component ,
    msi.segment1 Name,
    msi.description Description,
    bic.component_quantity Quantity,
    lpad( ' ', level*2 ) || level MyLevel
    from bom_structures_b bbm
    ,bom_components_b bic
    , mtl_system_items msi
    where bbm.bill_Sequence_id = bic.bill_sequence_id
    and msi.inventory_item_id = bic.component_item_id
    and msi.organization_id = bbm.organization_id
    start with bbm.assembly_item_id = 271962
    and bbm.organization_id = 85
    connect by prior bic.component_item_id = bbm.assembly_item_id;
    I've hard-coded "start with bbm.assembly_item_id = 271962", as it is the root node of a tree (BOM).
    Here's my structure, with extra fields clipped out:
    DBMS_METADATA.GET_DDL('TABLE','BOM_STRUCTURES_B','BOM')
    CREATE TABLE "BOM"."BOM_STRUCTURES_B"
    ( "ASSEMBLY_ITEM_ID" NUMBER,
    "ORGANIZATION_ID" NUMBER NOT NULL ENABLE,
    "COMMON_BILL_SEQUENCE_ID" NUMBER NOT NULL ENABLE,
    ) PCTFREE 20 PCTUSED 80 INITRANS 10 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 4 FREELIST GROUPS 4 BUFFER_POOL DEFAULT)
    TABLESPACE "APPS_TS_TX_DATA"
    DBMS_METADATA.GET_DDL('TABLE','BOM_COMPONENTS_B','BOM')
    CREATE TABLE "BOM"."BOM_COMPONENTS_B"
    ("COMPONENT_ITEM_ID" NUMBER,
    "BILL_SEQUENCE_ID" NUMBER NOT NULL ENABLE,
    "PARENT_BILL_SEQ_ID" NUMBER,
    ) PCTFREE 35 PCTUSED 50 INITRANS 10 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 4 FREELIST GROUPS 4 BUFFER_POOL DEFAULT)
    TABLESPACE "APPS_TS_TX_DATA"
    DBMS_METADATA.GET_DDL('TABLE','MTL_SYSTEM_ITEMS_B','INV')
    CREATE TABLE "INV"."MTL_SYSTEM_ITEMS_B"
    ( "INVENTORY_ITEM_ID" NUMBER NOT NULL ENABLE,
    "ORGANIZATION_ID" NUMBER NOT NULL ENABLE,
    "DESCRIPTION" VARCHAR2(240),
    ) PCTFREE 10 PCTUSED 70 INITRANS 10 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 4 FREELIST GROUPS 4 BUFFER_POOL DEFAULT)
    TABLESPACE "APPS_TS_TX_DATA"
    The relationship between the tables is:
    A BOM_STRUCTURES_B has many BOM_COMPONENTS_B where BOM_COMPONENTS_B.PARENT_BILL_SEQ_ID = BOM_STRUCTURES_B.BILL_SEQUENCE_ID. Both BOM_STRUCTURES_B.ASSEMBLY_ITEM_ID and BOM_COMPONENTS_B.COMPONENT_ITEM_ID are related to a single MTL_SYSTEM_ITEMS_B.INVENTORY_ITEM_ID.
    Thanks to anyone who can help with this horrible problem I've been fighting with for much too long! :)
    Thank you!
    Steve

    Due to an error in the otn forums (*), this got posted to the wrong forum, sorry for that, I'll repost in the correct one.
    *) For the forum admins: I was browsing the SQL/PLSQL forum, clicked on 'new message', got the login prompt, logged in, and apparently this got me to the application server forum for some reason.

  • CONNECT BY PRIOR and performance of Query Plan

    Anyone,
    I have an SQL Statement that is performing rather slow and I am trying to figure out if I could optimize it. Here is the SQL:
       SELECT/*+ index(MAXIMO.EQNDX99) */
            maximo.equipment.eqnum, maximo.equipment.parent, LEVEL
       FROM maximo.equipment@maxi_dblink
       WHERE parent = :b1 CONNECT BY PRIOR eqnum = parent
       ORDER BY eqnum, LEVELAfter some research in this board I followed some advice found to create an index on the table for both the eqnum, parent and the parent, eqnum. EQNDX99 and EQNDX999 respectivley.
    Now the Qery Plan for this query shows the following:
    SELECT STATEMENT (REMOTE)
       SORT (ORDER BY)
          FILTER
             CONNECT BY
                 INDEX (FAST FULL SCAN) EQNDX99 (NON-UNIQUE)
                 TABLE ACESS (BY USER ROWID) EQUIPMENT
                 INDEX (RANGE SCAN) EQNDX999 (NON-UNIQUE)Now it appears to be using both indexes but it is operating through a DBLINK. Is there anything else I can do to increase performance??? It appears to be using the HINT through the link as well.
    Thanks for any help I can get,
    David Miller

    how long does it takes to complete the query?

  • Connect by prior subquery - performance problem

    Hello,
    I have some data which is organized in a folder tree. The requeriement is to be able to search from any subfolder and down.
    /Documents
    ___Folder A
    ______Doc A
    ______Doc B
    ___Folder B
    ______Doc C
    ______Doc D
    The folder structure is defined in a table called CORNERS where the records(=folders) has a ID/PARENTID relationsship to describe the folder structure.
    Another table, called MASTER, contains the main content. Each item has a CORNERID value which defined in which subfolder the document is located.
    MASTER
    ID CORNERID TITLE INDEX_URL
    100 2 Doc A http://xxx/yy.com
    101 2 Doc B http://xxz/yy.com
    102 3 Doc C http://xyz/yy.com
    103 3 Doc D http://xyz/zz.com
    CORNERS
    ID PARENTID NAME
    1 Documents
    2 1 Folder A
    3 1 Folder B
    MASTER table has ~50000 records
    CORNERS has ~900 records.
    Analyzed nighly and stats are fresh.
    Indexes defined:
    CORNERS_ID_PARENT_IDX corners(id,parentid)
    CORNERS_PARENT_ID_IDX corners(parentid,id)
    MASTER_ID_CORNERID_IDX master(id,cornerid)
    MASTER_CORNERID_ID_IDX master(cornerid,id)
    Oracle Text index (URL based) on MASTER.INDEX_URL
    Foreign key defined:
    MASTER.CORNERID references CORNERS.ID
    If I do a search without involving the hierarchy, then the search runs pretty fast:
    SQL> SELECT COUNT(*) FROM (SELECT a.id, a.cornerid FROM MASTER a WHERE (CONTAINS(title,'$ADS AND {S} AND $PARAMETER',2) > 1 OR CONTAINS(index_url,'$ADS AND {S} AND $PARAMETER',1) > 1) );
    COUNT(*)
    5125
    Elapsed: 00:00:00.14
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1354 Card=1 Bytes=15
    8)
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'MASTER' (Cost=1354 Car
    d=758 Bytes=119764)
    3 2 BITMAP CONVERSION (TO ROWIDS)
    4 3 BITMAP OR
    5 4 BITMAP CONVERSION (FROM ROWIDS)
    6 5 SORT (ORDER BY)
    7 6 DOMAIN INDEX OF 'MASTER_TITLE_IDX' (Cost=470)
    8 4 BITMAP CONVERSION (FROM ROWIDS)
    9 8 SORT (ORDER BY)
    10 9 DOMAIN INDEX OF 'MASTER_IDX' (Cost=650)
    Statistics
    1462 recursive calls
    0 db block gets
    5507 consistent gets
    347 physical reads
    0 redo size
    380 bytes sent via SQL*Net to client
    503 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    2 sorts (memory)
    0 sorts (disk)
    1 rows processed
    SQL>
    BUT, if I add a subquery to limit the search to a certain folder tree (which includes ~200 nodes), then the performance is really badly affected. The subquery itself runs fast - around 0.07 seconds, but together with the rest of the query the preformance is really bad:
    SQL> SELECT COUNT(*) FROM (SELECT a.id, a.cornerid FROM MASTER a WHERE (CONTAINS(title,'$ADS AND {S} AND $PARAMETER',2) > 1 OR CONTAINS(index_url,'$ADS AND {S} AND $PARAMETER',1) > 1) AND cornerid IN ( SELECT ID FROM corners START WITH id = 2434 CONNECT BY PRIOR id = parentid) );
    COUNT(*)
    942
    Elapsed: 00:00:01.83
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=118 Card=1 Bytes=175
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'MASTER' (Cost=19 Card=
    1 Bytes=162)
    3 2 NESTED LOOPS (Cost=118 Card=8 Bytes=1400)
    4 3 VIEW OF 'VW_NSO_1' (Cost=2 Card=6 Bytes=78)
    5 4 SORT (UNIQUE)
    6 5 CONNECT BY (WITH FILTERING)
    7 6 NESTED LOOPS
    8 7 INDEX (UNIQUE SCAN) OF 'SYS_C002969' (UNIQUE
    ) (Cost=1 Card=1 Bytes=4)
    9 7 TABLE ACCESS (BY USER ROWID) OF 'CORNERS'
    10 6 NESTED LOOPS
    11 10 BUFFER (SORT)
    12 11 CONNECT BY PUMP
    13 10 INDEX (RANGE SCAN) OF 'CORNERS_PARENT_ID_IDX
    ' (NON-UNIQUE) (Cost=2 Card=6 Bytes=48)
    14 3 INDEX (RANGE SCAN) OF 'MASTER_CORNERID_ID_IDX' (NON-
    UNIQUE) (Cost=1 Card=38)
    Statistics
    29267 recursive calls
    0 db block gets
    55414 consistent gets
    140 physical reads
    0 redo size
    380 bytes sent via SQL*Net to client
    503 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    12 sorts (memory)
    0 sorts (disk)
    1 rows processed
    I've tried an alternative syntax, instead of the IN clause like this:
    SELECT COUNT(*) FROM (
    WITH folders AS (
    SELECT ID
    FROM CORNERS
    START WITH ID=2434
    CONNECT BY PRIOR ID= PARENTID
    SELECT a.id
    FROM MASTER a, folders b
    WHERE a.cornerid = b.id
    AND CONTAINS(index_url,'$ADS AND {S} AND $PARAMETER',1) > 1);
    It does runfaster, but still takes around 1 second.
    Any suggestion on how to make this run faster!?
    Thanks in advance!
    -Mats

    how long does it takes to complete the query?

  • Connect by prior with the  hint index not improving the performance

    Hi
    I have a table ORDERS (transaction table) with a parent order and multiple child orders with a field called orig_tid which track it back to main order.Child order can be further amended it will have mapping to immediate parent and immediate parent will have mapping to its parent.
    I want find out al the order associated with main order using connect by prior.
    I have created an index on required fileds but still those are not reducing the bytes. It is foing full index scan which are involving big bytes.
    [code]
    create index idx_test on orders decode(length(nvl(orig_tid,0)),9,substr(tran_no,6),orig_tid)
    SELECT  /*+ (mmd IDX_TEST) */ *
    FROM ORDERS mmd
    connect by prior tid=decode(length(nvl(orig_tid,0)),9,substr(tran_no,6),orig_tid)
    start_with or_number='13454566654553'
    [/CODE]
    Explain Plan
    ID | OPERATION                                |  NAME                 | ROWS               | BYTES    | COST
    0 | SELECT STATEMENT         |                                         | 9768              | 5093K   |       6944
    1|CONNECT BY WITH FILTERING|                          |                         |              |
    2|TABLE ACCESS BY INDEX ROWID|ORDERS |               1                 |534|            319K
    3| INDEX FULL SCAN|            IDX_TEST|     976K|    | 5652
    4|NESTED LOOPS|      |  |  |
    5|CONNECT By PUMP |  |  |  |
    6| TABLE ACCESS BY INDEX ROWID| ORDERS|  9768 | 5093K| 6944
    7| INDEX FULL SCAN | IDX_TEST | 3907|  | 5689
    Message was edited by: NikhilJuneja

    post EXPLAIN PLAN for SQL

  • SQL with connect by prior running for a long time

    Hi,
    We are using Oracle 10g. Below is a cursor sql which is having performance issues. The pAccountid is being passed from the output of a different cursor. But this cursor sql is running for a long time. Could you please help me in tuning this sql. I believe the subquery with connect by prior is causing the trouble.
    The TRXNS is a huge table which is not partitioned. The query is forced to use the index on the accountid of the TRXNS table.
    The accountlink table has 20,000 records and the TRXNStrack table has 10,000 records in total.
    This sql executes for 200,000 pAccountids and runs for more than 8 hours.
    SELECT /*+ INDEX(T TRXNS_ACCOUNTID_NIDX) */ AL.FROMACCOUNTID oldaccountid ,
                                    A.ACCOUNTNUM  oldaccountnum,
                                   T.TRXNSID,
                                   T.TRXNSTYPEID,
                                   T.DESCRIPTION ,
                                   T.postdt,
                                   T.TRXNSAMT
                        FROM
                        ACCOUNTLINK AL,
                        TRXNS T,
                        ACCOUNT A
                       WHERE AL.TOACCOUNTID IN
                                                             (SELECT TOACCOUNTID FROM ACCOUNTLINK START WITH TOACCOUNTID = pAccountid
                                                                                                                         CONNECT BY PRIOR FROMACCOUNTID  = TOACCOUNTID)
                            AND AL.FROMACCOUNTID = T.ACCOUNTID
                            AND A.ACCOUNTID = AL.FROMACCOUNTID
    AND NOT EXISTS (select 1 from TRXNStrack trck where trck.TRXNSid = t.TRXNSid AND TRXNSTrackReasonid = 1)
                            AND T.postdt > A.CLOSEDATE
                            AND T.postdt >= sysdate-2
                            AND T.postdt <= sysdate;
    Create script for trxn table:
    CREATE TABLE SP.TRXNS
      TRXNSID      NUMBER(15) CONSTRAINT "BIN$rpIQEeyLDfbgRAAUT4DEnQ==$0" NOT NULL,
      ACCOUNTID    NUMBER(15) CONSTRAINT "BIN$rpIQEeyMDfbgRAAUT4DEnQ==$0" NOT NULL,
      STATEMENTID  NUMBER(15),
      TRXNSTYPEID  NUMBER(15),
      DESCRIPTION  VARCHAR2(80 BYTE),
      postdt     DATE,
      TRXNSAMT     NUMBER(12,2),
      TRXNSREQID   NUMBER(15),
      LASTUPDATE   DATE,
      SOURCEID     NUMBER(15),
      HIDE         VARCHAR2(1 BYTE)
    TABLESPACE SO_TRXN_DATA
    RESULT_CACHE (MODE DEFAULT)
    PCTUSED    40
    PCTFREE    10
    INITRXNS   2
    MAXTRXNS   255
    STORAGE    (
                INITIAL          50M
                NEXT             1M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                FREELISTS        8
                FREELIST GROUPS  1
                BUFFER_POOL      DEFAULT
                FLASH_CACHE      DEFAULT
                CELL_FLASH_CACHE DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    CREATE INDEX SP.TRXNS_ACCOUNTID_NIDX ON SP.TRXNS
    (ACCOUNTID, postdt)
    LOGGING
    TABLESPACE SO_TRXN_INDEX
    PCTFREE    10
    INITRXNS   2
    MAXTRXNS   255
    STORAGE    (
                INITIAL          64K
                NEXT             1M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                FREELISTS        1
                FREELIST GROUPS  1
                BUFFER_POOL      DEFAULT
                FLASH_CACHE      DEFAULT
                CELL_FLASH_CACHE DEFAULT
    NOPARALLEL;
    below is the executing plan for this sql taken from toad :
    PLAN_ID
    TIMESTAMP
    OPERATION
    OPTIONS
    OBJECT_OWNER
    OBJECT_NAME
    OBJECT_ALIAS
    OBJECT_INSTANCE
    OBJECT_TYPE
    OPTIMIZER
    SEARCH_COLUMNS
    ID
    PARENT_ID
    DEPTH
    POSITION
    COST
    CARDINALITY
    BYTES
    CPU_COST
    IO_COST
    TEMP_SPACE
    ACCESS_PREDICATES
    FILTER_PREDICATES
    PROJECTION
    TIME
    QBLOCK_NAME
    1121
    9/10/2013 3:30
    FILTER
    1
    0
    1
    1
    NOT EXISTS (SELECT 0 FROM "TRXNSTRACK" "TRCK" WHERE "TRXNSTRACKREASONID"=1 AND "TRCK"."TRXNSID"=:B1)
    AL."FROMACCOUNTID"[NUMBER,22], "T"."TRXNSID"[NUMBER,22], "T"."TRXNSTYPEID"[NUMBER,22], "T"."DESCRIPTION"[VARCHAR2,80], "T"."POSTDT"[DATE,7], "T"."TRXNSAMT"[NUMBER,22], "A"."ACCOUNTNUM"[VARCHAR2,19]
    SEL$5DA710D3
    1121
    9/10/2013 3:30
    FILTER
    2
    1
    2
    1
    SYSDATE@!-2<=SYSDATE@!
    AL."FROMACCOUNTID"[NUMBER,22], "T"."TRXNSID"[NUMBER,22], "T"."TRXNSTYPEID"[NUMBER,22], "T"."DESCRIPTION"[VARCHAR2,80], "T"."POSTDT"[DATE,7], "T"."TRXNSAMT"[NUMBER,22], "A"."ACCOUNTNUM"[VARCHAR2,19]
    1121
    9/10/2013 3:30
    NESTED LOOPS
    3
    2
    3
    1
    (#keys=0) "AL"."FROMACCOUNTID"[NUMBER,22], "T"."TRXNSID"[NUMBER,22], "T"."TRXNSTYPEID"[NUMBER,22], "T"."DESCRIPTION"[VARCHAR2,80], "T"."POSTDT"[DATE,7], "T"."TRXNSAMT"[NUMBER,22], "A"."ACCOUNTNUM"[VARCHAR2,19]
    1121
    9/10/2013 3:30
    NESTED LOOPS
    4
    3
    4
    1
    5
    1
    119
    3989858
    4
    (#keys=0) "AL"."FROMACCOUNTID"[NUMBER,22], "T"."TRXNSID"[NUMBER,22], "T"."TRXNSTYPEID"[NUMBER,22], "T"."DESCRIPTION"[VARCHAR2,80], "T"."POSTDT"[DATE,7], "T"."TRXNSAMT"[NUMBER,22], "A".ROWID[ROWID,10]
    1
    1121
    9/10/2013 3:30
    NESTED LOOPS
    5
    4
    5
    1
    4
    1
    90
    3989690
    3
    (#keys=0) "AL"."FROMACCOUNTID"[NUMBER,22], "T"."TRXNSID"[NUMBER,22], "T"."TRXNSTYPEID"[NUMBER,22], "T"."DESCRIPTION"[VARCHAR2,80], "T"."POSTDT"[DATE,7], "T"."TRXNSAMT"[NUMBER,22]
    1
    1121
    9/10/2013 3:30
    HASH JOIN
    SEMI
    6
    5
    6
    1
    3
    2
    54
    3989094
    2
    AL."TOACCOUNTID"="TOACCOUNTID"
    (#keys=1) "AL"."FROMACCOUNTID"[NUMBER,22]
    1
    1121
    9/10/2013 3:30
    INDEX
    FULL SCAN
    SP
    ACCOUNTLINK_AK1
    AL@SEL$1
    INDEX (UNIQUE)
    ANALYZED
    7
    6
    7
    1
    1
    18
    252
    107
    1
    AL."FROMACCOUNTID"[NUMBER,22], "AL"."TOACCOUNTID"[NUMBER,22]
    1
    SEL$5DA710D3
    1121
    9/10/2013 3:30
    VIEW
    SYS
    VW_NSO_1
    VW_NSO_1@SEL$5DA710D3
    11
    VIEW
    8
    6
    7
    2
    2
    18
    234
    107
    1
    TOACCOUNTID[NUMBER,22]
    1
    SEL$683B0107
    1121
    9/10/2013 3:30
    CONNECT BY
    NO FILTERING WITH START-WITH
    9
    8
    8
    1
    TOACCOUNTID=PRIOR "FROMACCOUNTID"
    TOACCOUNTID=56354162
    TOACCOUNTID[NUMBER,22], "FROMACCOUNTID"[NUMBER,22], PRIOR NULL[22], LEVEL[4]
    SEL$683B0107
    1121
    9/10/2013 3:30
    INDEX
    FULL SCAN
    SP
    ACCOUNTLINK_AK1
    ACCOUNTLINK@SEL$3
    INDEX (UNIQUE)
    ANALYZED
    10
    9
    9
    1
    1
    18
    252
    107
    1
    ACCOUNTLINK.ROWID[ROWID,10], "FROMACCOUNTID"[NUMBER,22], "TOACCOUNTID"[NUMBER,22]
    1
    SEL$3
    1121
    9/10/2013 3:30
    TABLE ACCESS
    BY INDEX ROWID
    SP
    TRXNS
    T@SEL$1
    2
    TABLE
    ANALYZED
    11
    5
    6
    2
    1
    1
    63
    298
    1
    T."TRXNSID"[NUMBER,22], "T"."TRXNSTYPEID"[NUMBER,22], "T"."DESCRIPTION"[VARCHAR2,80], "T"."POSTDT"[DATE,7], "T"."TRXNSAMT"[NUMBER,22]
    1
    SEL$5DA710D3
    1121
    9/10/2013 3:30
    INDEX
    RANGE SCAN
    SP
    TRXNS_ACCOUNTID_NIDX
    T@SEL$1
    INDEX
    ANALYZED
    2
    12
    11
    7
    1
    1
    1
    224
    1
    AL."FROMACCOUNTID"="T"."ACCOUNTID" AND "T"."POSTDT">=SYSDATE@!-2 AND "T"."POSTDT"<=SYSDATE@!
    T.ROWID[ROWID,10], "T"."POSTDT"[DATE,7]
    1
    SEL$5DA710D3
    1121
    9/10/2013 3:30
    INDEX
    UNIQUE SCAN
    SP
    ACCOUNT_PK
    A@SEL$1
    INDEX (UNIQUE)
    ANALYZED
    1
    13
    4
    5
    2
    1
    1
    90
    1
    A."ACCOUNTID"="AL"."FROMACCOUNTID"
    A.ROWID[ROWID,10]
    1
    SEL$5DA710D3
    1121
    9/10/2013 3:30
    TABLE ACCESS
    BY INDEX ROWID
    SP
    ACCOUNT
    A@SEL$1
    3
    TABLE
    ANALYZED
    14
    3
    4
    2
    1
    1
    29
    168
    1
    A."CLOSEDATE"<SYSDATE@! AND "T"."POSTDT">"A"."CLOSEDATE"
    A."ACCOUNTNUM"[VARCHAR2,19]
    1
    SEL$5DA710D3
    1121
    9/10/2013 3:30
    INDEX
    RANGE SCAN
    SP
    TRXNSTRACK_TRXNSID_NIDX
    TRCK@SEL$6
    INDEX
    ANALYZED
    2
    15
    1
    2
    2
    1
    1
    10
    73
    1
    TRCK."TRXNSID"=:B1 AND "TRXNSTRACKREASONID"=1
    TRCK."TRXNSID"[NUMBER,22], "TRXNSTRACKREASONID"[NUMBER,22]
    1
    SEL$6
    Please help me in debugging this thanks!

    Hi,
    Thanks for your thought on this subject. Below is the trace info that I got from the DBA
    SQL ID: d0x879qx2zgtz Plan Hash: 4036333519
    SELECT /*+ INDEX(T TRXNS_ACCOUNTID_NIDX) */ AL.FROMACCOUNTID OLDACCOUNTID ,
      A.ACCOUNTNUM OLDACCOUNTNUM, T.TRXNSID, T.TRXNSTYPEID, T.DESCRIPTION ,
      T.POSTDT, T.TRXNSAMT
    FROM
    ACCOUNTLINK AL, TRXNS T, ACCOUNT A WHERE AL.TOACCOUNTID IN (SELECT
      TOACCOUNTID FROM ACCOUNTLINK START WITH TOACCOUNTID = :B3 CONNECT BY PRIOR
      FROMACCOUNTID = TOACCOUNTID) AND AL.FROMACCOUNTID = T.ACCOUNTID AND
      A.ACCOUNTID = AL.FROMACCOUNTID AND NOT EXISTS (SELECT 1 FROM TRXNSTRACK
      TRCK WHERE TRCK.TRXNSID = T.TRXNSID AND TRXNSTRACKREASONID = :B4 ) AND
      T.POSTDT > A.CLOSEDATE AND T.POSTDT >= :B2 AND T.POSTDT <= :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  17160      2.10       1.87          0          0          0           0
    Fetch    17160   7354.61    7390.86     169408    5569856  883366791           0
    total    34320   7356.71    7392.74     169408    5569856  883366791           0
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 38     (recursive depth: 1)
    SQL ID: gs89hpavb4cts Plan Hash: 3415795327
    SELECT A.ACCOUNTID, C.MEMBERID, A.PROGRAMID, A.ACCOUNTNUM
    FROM
    CUSTOMER C, CUSTOMERACCOUNT CA, ACCOUNT A, PROGRAMPARAMVALUE PPV,
      BATCHPROCESSPROGRAM BP WHERE A.PROGRAMID = BP.PROGRAMID AND A.PROGRAMID =
      PPV.PROGRAMID AND A.ACCOUNTID = CA.ACCOUNTID AND CA.PERSONID = C.PERSONID
      AND PPV.PARAMID = :B2 AND PPV.VALUE = 'Y' AND BP.PROCESSID = :B1 AND BP.RUN
      = 'Y' AND A.ACCOUNTTYPEID = 4 AND A.ACCOUNTSTATUSID = 1 AND C.MEMBERID IS
      NOT NULL
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch      172     13.14     115.34      80826     278650          0       17200
    total      172     13.14     115.34      80826     278650          0       17200
    Misses in library cache during parse: 0
    Parsing user id: 38     (recursive depth: 1)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        0      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  17160      2.10       1.87          0          0          0           0
    Fetch    17332   7367.75    7506.21     250234    5848506  883366791       17200
    total    34492   7369.85    7508.09     250234    5848506  883366791       17200
    Misses in library cache during parse: 0
        2  user  SQL statements in session.
        0  internal SQL statements in session.
        2  SQL statements in session.
    Trace file: svoprod_ora_12346.trc
    Trace file compatibility: 11.1.0.7
    Sort options: default
           1  session in tracefile.
           2  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           2  SQL statements in trace file.
           2  unique SQL statements in trace file.
       66499  lines in trace file.
        7516  elapsed seconds in trace file.

  • Connect by Prior - ORA-00600: internal error code, arguments: [kkqcbydrv:1

    Hi,
    We are writing some complex query using Connect by Prior in it.
    When we execute this query on same version of database as that of our client, then the query is executing.
    But when we execute this query at client's side then it raises error -
    ORA-00600: internal error code, arguments: [kkqcbydrv:1] , [] , [] , [] , [] , [] , [] , []
    After searching on metalink,
    We could find two workarounds -
    1. Use a /*+no_unnest*/ hint, but this may have perfomance implications.
    2. alter session set "_optimizer_connect_by_cost_based"=false;
    of which we cant use second workaround as this query is called from a application and not directly from oracle prompt.
    We are working with the first workaround, but what is wondering us is that,
    If same query can work well on our side then why is this query not performing in same way at client's side?
    We are using same version of database, same amount of data is present in development and production databases.
    Then what is causing this error only in priduction?
    Any help in this regard is appreciated.
    Thanks,
    Av.

    You can use the second tip in a database login trigger. But if the metalink ORA-600 diagnostic tool can only give you those workarounds I suggest raising a SR to try and get the bug fixed.
    It may be differing patch levels that cause the difference between the two sites, some subtle difference in temp tablespace, a corrupt block - impossible for us to say but maybe not for Oracle.

  • Slow connect by prior ... start with subquery in 9i

    Has anyone come across a performance problem (compared to 8i) when using hierarchical queries where the START WITH list is generated by a subquery? The culprit seems to be an extra visit to the subquery block as part of the CONNECT BY WITH FILTERING operation.
    For example, take a simple tree structure:
    CREATE TABLE tree
    id NUMBER,
    parentid NUMBER
    CONSTRAINT tree_pk PRIMARY KEY (id)
    ...and a subquery - here just a table called sample with a subset of the ids from the tree table:
    CREATE TABLE sample
    id NUMBER,
    CONSTRAINT sample_pk PRIMARY KEY (id)
    ...with which to drive the start points of the treewalk:
    SELECT parentid, id, label
    FROM tree
    CONNECT BY PRIOR parentid = id
    START WITH id IN
    SELECT id FROM SAMPLE
    With the tables populated and analyzed, I get this from 8i:
    Execution Plan
    .0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
    .1....0...CONNECT BY
    .2....1.....NESTED LOOPS (Cost=1 Card=1280 Bytes=10240)
    .3....2.......INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=1 Card=1280 Bytes=5120)
    .4....2.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
    .5....1.....TABLE ACCESS (BY USER ROWID) OF 'TREE'
    .6....1.....TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
    .7....6.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=1)
    Statistics
    .....0..recursive calls
    .....4..db block gets
    .15687..consistent gets
    ....59..physical reads
    .....0..redo size
    223313..bytes sent via SQL*Net to client
    .38276..bytes received via SQL*Net from client
    ...343..SQL*Net roundtrips to/from client
    .....3..sorts (memory)
    .....0..sorts (disk)
    ..5120..rows processed
    and this is 9i:
    Execution Plan
    .0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
    .1....0...CONNECT BY (WITH FILTERING)
    .2....1.....NESTED LOOPS
    .3....2.......NESTED LOOPS (Cost=2 Card=1280 Bytes=10240)
    .4....3.........INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=2 Card=1280 Bytes=5120)
    .5....3.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
    .6....2.......TABLE ACCESS (BY USER ROWID) OF 'TREE'
    .7....1.....NESTED LOOPS
    .8....7.......BUFFER (SORT)
    .9....8.........CONNECT BY PUMP
    10....7.......TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
    11...10.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=20480)
    12....1.....INDEX (UNIQUE SCAN) OF 'SAMPLE_PK' (UNIQUE) (Cost=1 Card=1 Bytes=4)
    Statistics
    .....1..recursive calls
    .....1..db block gets
    .20525..consistent gets
    ....72..physical reads
    ...120..redo size
    224681..bytes sent via SQL*Net to client
    .38281..bytes received via SQL*Net from client
    ...343..SQL*Net roundtrips to/from client
    .....9..sorts (memory)
    .....0..sorts (disk)
    ..5120..rows processed
    ..so, about another 5000 logical reads, corresponding to the extra access of the sample table at the bottom of the query plan. So instead of just visiting the START WITH subquery once, to kick off the treewalk, I seem to be revisiting it for every row returned. Not too bad if that happens to be a unique index scan as here but that's not always the case.
    I know I've got new options for re-writing this as a join under 9i, I'm just curious about those extra lookups and why they're necessary.
    Cheers - Andrew

    There is undocumented parameter in Oracle 9i "_old_connect_by_enabled"
    which controls the behavoiur of hierarchy queries in 9i and above:
    You can try to return to 8i behaviour using it:
    SQL> SELECT parentid, id
      2  FROM tree
      3  CONNECT BY PRIOR parentid = id
      4  START WITH id IN
      5  (
      6  SELECT id FROM SAMPLE
      7  )
      8  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=26)
       1    0   CONNECT BY (WITH FILTERING)
       2    1     TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE)
       3    2       NESTED LOOPS (Cost=2 Card=1 Bytes=26)
       4    3         TABLE ACCESS (FULL) OF 'SAMPLE' (TABLE) (Cost=2 Card
              =1 Bytes=13)
       5    3         INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (C
              ost=0 Card=1 Bytes=13)
       6    1     NESTED LOOPS
       7    6       BUFFER (SORT)
       8    7         CONNECT BY PUMP
       9    6       TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE) (Cost=
              1 Card=1 Bytes=26)
      10    9         INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (C
              ost=1 Card=1)
      11    1     TABLE ACCESS (FULL) OF 'TREE' (TABLE) (Cost=1 Card=1 Byt
              es=26)
      12    1     INDEX (UNIQUE SCAN) OF 'SAMPLE_PK' (INDEX (UNIQUE)) (Cos
              t=1 Card=1 Bytes=13)
    SQL> alter session set "_old_connect_by_enabled" = TRUE;
    Session altered.
    SQL> SELECT parentid, id
      2  FROM tree
      3  CONNECT BY PRIOR parentid = id
      4  START WITH id IN
      5  (
      6  SELECT id FROM SAMPLE
      7  )
      8  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=26)
       1    0   CONNECT BY
       2    1     NESTED LOOPS (Cost=2 Card=1 Bytes=26)
       3    2       TABLE ACCESS (FULL) OF 'SAMPLE' (TABLE) (Cost=2 Card=1
               Bytes=13)
       4    2       INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (Cos
              t=0 Card=1 Bytes=13)
       5    1     TABLE ACCESS (BY USER ROWID) OF 'TREE' (TABLE)
       6    1     TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE) (Cost=1
              Card=1 Bytes=26)
       7    6       INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (Cos
              t=1 Card=1)
    Rgds.

  • Can anyone please help with a Connect by PRIOR sql?

    Hi,
    I am not so well versed in Oracle analytic functions and am having trouble with a sql.
    Oracle Version: 9.2.0.1.0
    I have a tree table storing heirarchies upto 4 levels.
    create table FAMILY_TREE
    TREE_ID NUMBER not null,
    PARENT_ID NUMBER,
    NAME VARCHAR2(100)
    I know that using a CONNECT BY PRIOR, I can find out who the previous ancestar is.
    select
    f.tree_id TreeId,
    f.parent_id ParentId,
    f.Name Name
    from family_tree f
    connect by
    prior f.tree_id = f.parent_id
    start with f.parent_id is null
    I need to display all the ancestars in a single line (in different columns), which is where I am stumped.
    I need the output, in different columns as :
    Joe Jack Harry Rick Ned
    Bascially, I need to display in a single row, all the ancestars.
    I tried to use joins but it was very very slow due to the fact that I had to perform multiple joins.
    Can anyone please point me in the right direction?
    Data:
    insert into FAMILY_TREE (TREE_ID, PARENT_ID, NAME)
    values (1, null, 'Joe');
    insert into FAMILY_TREE (TREE_ID, PARENT_ID, NAME)
    values (2, 1, 'Jack');
    insert into FAMILY_TREE (TREE_ID, PARENT_ID, NAME)
    values (3, 2, 'Harry');
    insert into FAMILY_TREE (TREE_ID, PARENT_ID, NAME)
    values (4, 3, 'Rick');
    insert into FAMILY_TREE (TREE_ID, PARENT_ID, NAME)
    values (5, 4, 'Ned');

    This may give you a start
    SQL> ed
    Wrote file afiedt.buf
      1  select f.tree_id TreeId,f.parent_id ParentId,
      2          trim(',' from sys_connect_by_path(f.Name,',')) name
      3  from family_tree f
      4  connect by
      5  prior f.tree_id = f.parent_id
      6* start with f.parent_id is null
    SQL> /
        TREEID   PARENTID NAME
             1            Joe
             2          1 Joe,Jack
             3          2 Joe,Jack,Harry
             4          3 Joe,Jack,Harry,Rick
             5          4 Joe,Jack,Harry,Rick,Ned
    Message was edited by:
            jeneesh
    Forgot to refresh..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Connect by Prior in Oracle 8i question

    Need help with building tree-structured query in Oracle 8i (Forms 6i front end if it matters).
    Sample structure and data:
    CREATE TABLE table_list
    my_code NUMBER,
    my_level NUMBER,
    my_description VARCHAR2(60)
    CREATE TABLE table_content
    my_code NUMBER,
    term_code NUMBER,
    term_category VARCHAR2(5)
    INSERT into table_list values (101, 1, 'building');
    INSERT into table_list values (102, 2, 'flat');
    INSERT into table_list values (103, 3, 'living room');
    INSERT into table_list values (104, 3, 'bedroom');
    INSERT into table_list values (105, 3, 'bathroom');
    commit;
    INSERT into table_content values (101, 102, 'Sub');
    INSERT into table_content values (102, 103, 'Sub');
    INSERT into table_content values (102, 104, 'Sub');
    INSERT into table_content values (102, 105, 'Sub');
    commit;
    Need to display data in the following order:
    101 'building' --level one
         102 'flat' --level two
              105 'bathroom' --level three
              104 'bedroom' --level three
              103 'living room' --level three
    *(note alphabetical order in level three)*
    Looks like Oracle 8i does not support table joins for CONNECT BY PRIOR. Please advise!

    And you are correct, it does not display level 1. Do
    you think this is this a database structure problem
    or it could be corrected via query modification?No and yes. It's not a "structure" problem, its a data problem (as I explained above). You always fix data problems by making queries overly complex (hint, hint, I don't suggest doing it this way).
    select tl.my_level, tl.my_description , LPAD(' ',3*(my_level-1)) || substr(tl.my_description, 1, 30) description
    from table_list tl,
    (select term_Code from table_content
    start with my_code in (select my_code from table_list where my_level=1)
    connect by prior term_code = my_code
    ) x
    where x.term_code = tl.my_code
    union all
    select my_level, my_description
    from table_list
    where my_level = 1
    order by 1, 2
    better to add a row to table_content with my_code=null, term_code=101.
    otherwise you'll be pulling stupid nonsense like above with every query from here on out.

  • How to use simple SQL instead of Connect By Prior

    Currently, I am using "connect by prior" query in the application, but for reason I don�t want to use this connect by query so can any one please tell how does I get the same result by using SQL, I tried this by using procedure but unable to get the same result, specially LEVEL of the tree.
    So please tell, how would I get the correct data.
    Thanks in advance,
    AMIT.

    Hi,
    Whenever you have a question, it helps to post:
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables
    (3) The results you want from that data
    (4) Your best attempt so far (formatted) I don't believe the unformated code you posted is what you're really running, since it has a syntax error ("... WHERE START WITH ..."). Please post code that really works with the sample data you posrted.
    (5) The full error message (if any), including line number
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    If you can present your problem using commonly available tables (for example, scott.emp, which contains a hierarchy), then you can omit (2).
    Formatted tabular output is okay for (3). Type these 6 characters
    &#123;code&#125;
    (small letters only, inside curly brackets) before and after the tabular text, to preserve spacing.
    As Alex said, why don't you want to use CONNECT BY?
    Are you getting the correct results now, but just looking for a different way of getting them?
    Depending on your exact requirements, you could write a PLSQL function that mimics LEVEL. Don't expect it to be fast.
    Nested Sets is a completely different way of modeling trees.
    Some things are much easier with Nested Sets than they are using the Adjacency Model (the parent-child model that uses CONNECT BY).
    But some things are much harder with Nested Sets, and LEVEL is one of them.

  • How to get the root node for a child using connect by prior

    Hi,
    I searched at many places to do this but not able to get the exact o/p sp posting my question here.
    I have a table with parent_id and child_id columns. The levels of this parent_child can be many but my aim is to find the ultimate parent ( dont know the right term)
    like if I have a child_node= xyz and its parent= pqr and its parents=lmn which might be ultimate parent which doesnt have any further parent.
    So if i start with child_code= "xyz" then i should get the parent as "lmn" and not the immediate parent "pqr".
    Please help.
    Thanks,
    Aashish

    To find the Parent on emp table:
    select empno,ename,level
    from emp
    where level=3
    start with empno=7934
    connect by  empno= prior mgrTo find the Child on emp table:
    select empno,ename,level
    from emp
    where level=1
    start with empno=7934
    connect by prior empno=  mgrBut you need to know the level or position to specify the level of parent or child. But there are some other possible options available if we can know the requirement properly.
    Edited by: Vasista on Jan 11, 2011 2:27 AM
    Edited by: Vasista on Jan 11, 2011 2:30 AM

  • Is there a connection between the performance and the number of photos?

    Is there a connection between the performance of LR 4 (LR 5) and the number of photos in the catalog? Will it slow down LR with a directory of more than 40,000 images (Win7, 4 Gb RAM)?

    I use lots of smart and dumb collections, lots of keywords too, also on Win7/64 though with 12Gb of Ram.
    Have you read through Optimizing performance, especially running a File > Optimize. Also Performance hints is more handy for troubleshooting.
    John

  • Connect imac to performa 500

    Am I able to connect a legacy Performa 500 to my Intel iMac to transfer files to external HD? Performa has an eternet connection.

    How easy this can be done depends a bit upon the operating system on the Performa.
    Typically, with System 7.5.3 or higher, Open Transport networking is possible, meaning that the TCP/IP control panel is active (the earlier classic networking uses MacTCP, which may make things more complicated).
    Because of the differences between the latest versions of Mac OS X and the old systems, do not expect any "built-in" file sharing to work.
    Instead, a good idea can be to use a small FTP server (NetPresenz is now free) on the Performa. One can then connect to this server from a dedicated FTP client (or a web browser) on a modern Mac (or PC). The physical connection would be over Ethernet cables (via the LAN ports of a normal router).
    If you need to install downloaded program files, one solution (providing that the Performa has an internal or external CD-ROM drive) may be to use a CD-R (in an ISO format, burn at a low speed) for transfers from a modern Mac or PC. Keep any downloaded files encoded (typically, MacBinary = .bin) until on the Performa. Use StuffIt Expander on the old computer to decode the files.
    Jan

  • Query tuning for query using connect by prior

    I have written following query to fetch the data. The query is written in this format because there are multiple rows, which make one recrd and we need to bring that record into one row.
    For one CAT(commented here), this query takes around 4 minutes and fetches 6900 records but when it runs for 3 CAT, it takes 17 mins.
    I want to tune this as this has to run for 350 CAT values.
    It is doing FTS on the main table. I tried to use different hints like PARALLEL, APPEND (in insert) but nothing worked.
    The cost of the query is 51.
    Any help/suggestions will be appreciated.
    SELECT DISTINCT MIN(SEQ) SEQ,
    PT, APP, IT, LR, QT,CD, M_A_FLAG,
    STRAGG(REM) REM, -- aggregates the data from different columns to one which is parent
    CAT
    FROM (WITH R AS (SELECT CAT, SEQ, PT, M_A_FLAG, IT, LR,QT,CD, REM, APP
    FROM table1
    WHERE REC = '36' AND M_A_FLAG = '1'
    --AND CAT = '11113')
    SELECT CAT, SEQ,
    CONNECT_BY_ROOT PT AS PT,
    CONNECT_BY_ROOT APP AS APPL,
    M_A_FLAG,
    CONNECT_BY_ROOT IT AS IT,
    CONNECT_BY_ROOT LR AS LR,
    CONNECT_BY_ROOT QT AS QT,
    CONNECT_BY_ROOT CD AS CD,
    REM
    FROM R A
    START WITH PT IS NOT NULL
    CONNECT BY PRIOR SEQ + 1 = SEQ
    AND PRIOR CAT = CAT
    AND PT IS NULL)
    GROUP BY PT, APP, IT,LR, QT, CD, M_A_FLAG, CAT
    ORDER BY SEQ;
    Thanks.
    Edited by: user2544469 on Feb 11, 2011 1:12 AM

    The following threads detail the approach and information required.
    Please gather relevant info and post back.
    How to post a SQL tuning request - HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long - When your query takes too long ...

Maybe you are looking for

  • Tux 9.1: TMS_ORA giving "Assume Started" error while booting.

    Hi, We are migrating our application running on Tuxedo 8.1(32-bit)(Corba C++ servers with Oracle 10g database) to Tuxedo 9.1(32-bit). OS: Suse Linux 9 Installation of Tux 9.1 was done successfully. But while booting the servers, it is giving CMDTUX_C

  • Does the HP Officejet 6500 E709n Series printer support eprint?

    I really like the ability to ePrint using my new printer. I want to be able to set up other printer models at other locations. How do I know what printers support ePrint? I have one printer the HP Officejet 6500 E709. Does it suppoort ePrint?

  • SOAP to File scenario

    Hi experts, I have the following scenario and I don't know if the File Adapter allows me to do. - We have a system that execute Webservices. - On the other hand, we have a file system that manages a files to consult. We need to call the Webservice, a

  • Only prints 2 pages of certain websites

    Using FF3.6.8 I try to print from the URL below: http://www.lds.org/ldsorg/v/index.jsp?hideNav=1&locale=0&sourceId=e9481c90483eb010VgnVCM1000004d82620a____&vgnextoid=f318118dd536c010VgnVCM1000004d82620aRCRD And only 2 pages will print. If I shrink to

  • Gaps appear with Safari, but not in any other browser.

    Hi Guys, working on a site, heres a page from it: Text If you view it in safari, it has gaps at the bottom of the page in the border graphic, it renders fine in other browsers. I have been able to fix this by adding a line break as the entry in the s