SQL query time-out


Hello Experts,

I received 2 days with a performance thing, but no luck.

We have a custom user who runs specific sqls in an instance both Test and Prod. Prod its < 1 sec for each race to test everything taking more than 5 seconds. To do this, we have created a trigger to get the sqls. But I did not how to go further and compare things with env Prod.

While the generation to explain the plan gives

SQL > SELECT * FROM TABLE (dbms_xplan.display_cursor ('cavskqs3j74qr'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID, cavskqs3j74qr, number of children 0

begin XXINT_INV_ITEM_IMPORT.check_item (i_version_number = >: i_version_numb)
o_return_message = >: o_return_message); end;

NOTE: cannot fetch SQL_ID plan: cavskqs3j74qr, CHILD_NUMBER: 0
Check the value of SQL_ID and CHILD_NUMBER;
It could also be that the plan is no longer in the cursor cache (check v$ sql_plan)


11 selected lines.

You will appreciate if someone helps me on the same?

Thank you

Prabhat.

Find out what is in: XXINT_INV_ITEM_IMPORT.check_item

It is a function or a procedure or package, and inside, is the statement that goes wrong.

It is the statement that you will need the execution plan of.

If you have the active trigger (both on the prod and UN-made) you will have a lot of TRC files. This TRC file should mention somewhere

XXINT_INV_ITEM_IMPORT.check_item

Then you TKPROF this trace file, then you should be able to find higher education, even though the total runs only 5 seconds.

Tags: Oracle Applications

Similar Questions

  • query time-out

    Hello
    Oracle version: 8.1.7.4
    I run DBMS_STATS. GATHER_SCHEMA_STATS (ownname = > 'TOM') and now I need the time between one table and another.

    for example in dba_tables I have:
    TABLE_NAME          LAST_ANALYZED
    TAB1               2012/10/01 18:00:00
    TAB2               2012/10/01 19:00:00
    TAB3               2012/10/01 19:30:00
    TAB4               2012/10/01 19:40:20
    ...........................................
    ...........................................
    I want to get this result:
    TABLE_NAME_FIRST     TABLE_NAME_SECOND               ELAPSED_TIME
    TAB1                    TAB2                         1 h
    TAB2                    TAB3                         30 min     
    TAB3                    TAB4                         10 min - 20 sec.     
    How can anyone I write this query?

    Thanks in advance!

    I just checked again the 8i documentation:

    http://docs.Oracle.com/CD/A87860_01/doc/server.817/a85397/function.htm#88260

    Note: This function is limited to use with the analytical functions. It only accepts numbers as arguments and returns the interval literals.

    Then remove it and work directly on the difference in date to extract the days, hours, minutes, etc.

  • SELECT query time-out - huge table

    DBA dear friends,


    DB version 11.1.0.7.  I have a SELECT query that is running long and wedging on. Query joins the 2 tables. It is partitioned hash (16 sheets) and others are not partitioned, each table is with the same volume of data - 230 million lines.

    > Optimizer stats are not outdated

    SELECT only 1 row (as indicated in the PLAN of EXPLAIN) should be fast.

  • SQl query to find out time between the different lines of transactions

    (See both images from an attachment to get the clear picture of the data and understand the question correctly.)

    I have a set of data like this in one of my paintings. (This is a simple representation of the original data.)

    Reference table1.jpg

    Id        | Type               | Value | Start_date | End_date

    ----------------------------------------------------------------------------------------------------------------------

    ZTR0098 | ALLOW | 0 | 1 JUN | 2 JUN |

    ZTR0098 | ADTAX | 0 | 1 JUN | 2 JUN |

    ZTR0098 | MXTAX | 0 | 1 JUN | 9 JUN |

    ZTR0098 | ALLOW | 4. 3 JUN | 15 JUN |

    ZTR0098 | ADTAX | 44.00 | 3 JUN | 17-JUNE |

    ZTR0098 | MXTAX | 2. 10 JUN | 17-JUNE |

    ZTR0098 | ALLOW | 5. 16-JUNE | 20 JUN |

    ZTR0098 | ADTAX | 55,34 | 18 JUN | 22 JUN |

    ZTR0098 | MXTAX | 1. 18 JUN | 25 JUN |

    ZTR0098 | MXTAX | 6. 26 JUN | 31 AUG |

    ZTR0098 | ADTAX | 20.09. 23 JUN | 23 JUL |

    ZTR0098 | ALLOW | 8. 21 JUN | 31 AUG |

    ZTR0098 | ADTAX | 45. 24 JUL | 31 AUG |

    each line has a type and a rasthaus id to it. ID belongs to other parent tables. the value of each type is given, and the validity of each value is followed by a field start_date and end_date.

    All values start from 1 - JUN and expires on 31 - AUG. Now my requirement is to obtain a report that gives three columns for three different types (ALLOW, ADTAX and MXTAX) with combination of unique values in the effective time interval. Let me put the result below.

    Reference table2.jpg

    Id         | ALLOW | ADTAX | MXTAX |  Start_date | End_date

    --------------------------------------------------------------------------------------------------------------------------------------------------

    ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |

    ZTR0098 | 4. 44.00 | 0 | 3 JUN | 9 JUN |

    ZTR0098 | 4. 44.00 | 2. 10 JUN | 15 JUN |

    ZTR0098 | 5. 44.00 | 2. 16-JUNE | 17-JUNE |

    ZTR0098 | 5. 55,34 | 1. 18 JUN | 20 JUN |

    ZTR0098 | 8. 55,34 | 1. 21 JUN | 22 JUN |

    ZTR0098 | 8. 20.09. 1. 23 JUN | 25 JUN |

    ZTR0098 | 8. 20.09. 6. 26 JUN | 23 JUL |

    ZTR0098 | 8. 45. 6. 23 JUL | 31 AUG |

    As you can see there are no duplicate rows for a combination of (ALLOW, ADTAX and MXTAX) with their respective dates in force. resulting in the above table. the first step is to convert lines to the column which is pretty obvious to do that by grouping on start_date and end_date colum, but the real deal is the time interval during which the combination of the values (ALLOW, ADTAX, and MXTAX) has remained constant.

    I wrote under query using Group by.

    Select

    ID,

    NVL (max (decode (type, "ALLOW", value)), 0) as ALLOW

    NVL (max (decode (type, 'ADTAX', value)), 0) as ADTAX

    NVL (max (decode (type, 'MXTAX', value)), 0) as MXTAX

    Start_date,

    End_date

    from my_table

    Group of start_date, end_date, id

    start_date, end_date

    the results it gives are like this:

    Reference table3.jpg

    Id       | ALLOW | ADTAX | MXTAX |  Start_date | End_date

    ------------------------------------------------------------------------------------------------------------------------------------------------

    ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |

    ZTR0098 | 0 | 0 | 2. 1 JUN | 9 JUN |

    ZTR0098 | 4. 0 | 0 | 3 JUN | 15 JUN |

    ZTR0098 | 0 | 44.00 | 0 | 3 JUN | 17-JUNE |

    ZTR0098 | 0 | 0 | 2. 10 JUN | 17-JUNE |

    ZTR0098 | 5. 0 | 0 | 16-JUNE | 20 JUN |

    ZTR0098 | 0 | 55,34 | 0 | 18 JUN | 22 JUN |

    .   .

    . .

    like wise

    but I'm not able to determine the time intervals by using the SQL query.

    with

    Table1 as

    (select the id 'ZTR0098', 'ALLOW' type, 0 val, to_date('1-JUN','dd-MON') start_date, end_date Union to_date('2-JUN','dd-MON') double all the)

    Select 'ZTR0098', 'ADTAX', 0, to_date('1-JUN','dd-MON'), to_date('2-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'MXTAX', 0, to_date('1-JUN','dd-MON'), to_date('9-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'ALLOW', 4, to_date('3-JUN','dd-MON'), to_date('15-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'ADTAX', 44.00, to_date('3-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'MXTAX', 2, to_date('10-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'ALLOW', 5, to_date('16-JUN','dd-MON'), to_date('20-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'ADTAX', 55.34, to_date('18-JUN','dd-MON'), to_date('22-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'MXTAX', 1, to_date('18-JUN','dd-MON'), to_date('25-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'MXTAX', 6, to_date('26-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union

    Select 'ZTR0098', 'ADTAX', 20.09, to_date('23-JUN','dd-MON'), to_date('23-JUL','dd-MON') of all the double union

    Select 'ZTR0098', 'ALLOW', 8, to_date('21-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union

    Select 'ZTR0098', 'ADTAX', 45, to_date('24-JUL','dd-MON'), to_date('31-AUG','dd-MON') of the double

    ),

    days like

    (select level - 1 dte + to_date('1-JUN','dd-MON')

    of the double

    connect by level<= to_date('31-aug','dd-mon')="" -="" to_date('1-jun','dd-mon')="" +="">

    )

    Select id, allow, adtax, mxtax, min (dte) start_date, max (dte) end_date

    (select ID, dte, max (allow) allow, max (adtax) adtax, max (mxtax) mxtax,

    ROW_NUMBER() over (order by dte) row_number() - courses (partition by order max (allow), max (adtax), max (mxtax) by dte) gr

    go (select id, dte,

    -case when type = 'ALLOW' and dte between start_date and end_date then end val 0 otherwise allow.

    -case when type = "ADTAX" and dte between start_date and end_date then val 0 otherwise end adtax.

    -case when type = "MXTAX" and dte between start_date and end_date then val 0 otherwise end mxtax

    Table 1 t,

    days d

    where d.dte between t.start_date and t.end_date

    )

    Group by id, dte

    )

    Group by id, gr, allow, adtax, mxtax

    order by id, gr

    ID ALLOW ADTAX MXTAX START_DATE END_DATE
    ZTR0098 0 0 0 01/06/2015 02/06/2015
    ZTR0098 4 44 0 03/06/2015 09/06/2015
    ZTR0098 4 44 2 10/06/2015 15/06/2015
    ZTR0098 5 44 2 16/06/2015 17/06/2015
    ZTR0098 5 55,34 1 18/06/2015 20/06/2015
    ZTR0098 8 55,34 1 21/06/2015 22/06/2015
    ZTR0098 8 20.09 1 23/06/2015 25/06/2015
    ZTR0098 8 20.09 6 26/06/2015 23/07/2015
    ZTR0098 8 45 6 24/07/2015 31/08/2015

    Concerning

    Etbin

  • Using the MS ODBC driver to connect to Oracle and MS SQL DB - get a time-out error

    I have the driver installed and configured on the Linux host where sits the Oracle DB.  I worked through the configuration and tested along the way.

    If I execute the following SQL statement I get a timeout error after only 15 minutes:

    SQL > select * from host_table@UCMDB806;

    Select * from host_table@UCMDB806

    *

    ERROR on line 1:

    ORA-28511: interruption of the RPC connection to heterogeneous remote agent to help

    SID = ORA-28511: lost RPC connection to heterogeneous remote agent to help

    SID = (Description = (Address = (Protocol = TCP)(Host=localhost) (port = 1521)) (CONNECT_DAT

    A = (SID = UCMDB806)))

    ORA-02063: preceding the line of UCMDB9

    Process ID: 4070

    Session ID: 392 serial number: 40935

    If I limit the SQL to give hosting me only that start with 'a', I get this:

    SQL > select * from host_table@UCMDB806 where (name) lower like 'a % ';

    ID

    ------------------------------------------------------------

    NAME

    --------------------------------------------------------------------------------

    TenantID

    ------------------------------------------------------------

    name of the vendor

    --------------------------------------------------------------------------------

    softwarename

    --------------------------------------------------------------------------------

    4616

    AHOST-B

    76436

    ID

    ------------------------------------------------------------

    NAME

    --------------------------------------------------------------------------------

    TenantID

    ------------------------------------------------------------

    name of the vendor

    --------------------------------------------------------------------------------

    softwarename

    --------------------------------------------------------------------------------

    SYMANTEC

    .

    .

    .

    It seems to be a time-out on this query.  My software is located 20 minutes for a query.  MS SQL server is set to unlimited for remote queries (we did it to help isolate the timeout).  So, I guess the wait time that is happening at the level of ODBC driver.  Someone has all understand how to solve this problem?

    Hello

    Your question is beyond the scope of this community.

    Please repost your question in the SQL Server TechNet Forums.

    https://social.technet.Microsoft.com/forums/SQLServer/en-us/home?category=SQLServer

    See you soon.

  • Calculation of the time wall of a SQL query.

    Hello

    While trying to discover the time of running a SQL query (wall time) I read in one place that CPU_TIME/EXECUTIONS of v$ SQLAREA, is the precise runtime we can come close to.

    I can't use "set timing on ' or 'DBMS_UTILITY. GET_TIME' that I need to extract the execution time of the story because the query will be drawn to an end, and I need to know how long it took to DB level and compare it with the end time before calculating the % of time used in the DB level total.

    Maybe another way to track sessions and the user TKPORPOF but now I donot want to take the help of the ADMINISTRATOR at this initial stage.

    Is CPU_TIME/EXECUTIONS of v$ SQLAREA where (SQL_TEXT) AS "SELECT... OF... %'; should be enough?

    user2925917, yes as Brian already answered your understanding as posted above seems correct.  Except in the case where there has been only a running query you will download an average time.  The problem with averages is that one or two unusual executions that can skew the average, but in most cases the average will be probably fairly accurate.

    - -

    HTH - Mark D Powell.

  • How to display time in 010403 format if the entry is transmitted as ' 1 hour, 4 minutes, 3 seconds"sql query

    How to display time in 010403 format if the entry is transmitted as ' 1 hour, 4 minutes, 3 seconds"sql query @.

    Hello

    You can try:

    Select lpad (regexp_substr ('1 hour, 4 minutes, 3 seconds ',' [[: digit:]] + ""), 2, '0')

    || LPAD (regexp_substr ('1 hour, 4 minutes, 3 seconds ',' [[: digit:]] +', 1, 2), 2, '0')

    || LPAD (regexp_substr ('1 hour, 4 minutes, 3 seconds ',' [[: digit:]] +' 1, 3), 2, '0')

    Double;

    but this requires maximum 99 hours/minutes/seconds ago in your entry.

  • How do I know what sql query is taken on time for the concurrent program

    Hi Sir,

    I am running simultaneous program, which takes time to run, I want to know what sql query causing performance

    Thanaks,

    Anthony

    Hi Anthony,.

    Activate the traces on the simultaneous program and then run tkprof on trace file.

    Octavio

  • Reg: SQL query execution time

    Hi all

    How to identify the oracle sql query execution time.

    Thanks in advance.
    SQL> set timing on
    
  • Help with time operations invloving the SQL query

    I created 2 tables in my SQL. One is the user_info_table table that stores the connection time and time zone of login for each user. The other is the post_table that stores user postid, who makes the post time post and time zone for each message.
    CREATE TABLE user_info
    (
    user_id VARCHAR(20), 
    login_date DATE,
    login_time_zone VARCHAR(20),
    PRIMARY KEY (user_id)
    );
    CREATE TABLE post_table
    (
    post_id VARCHAR(20),  
    user_id VARCHAR(20), 
    datepost DATE,  
    time_zone VARCHAR(20),
    PRIMARY KEY (post_id),
    FOREIGN KEY (user_id) REFERENCES user_info(user_id) ON DELETE CASCADE
    ) ;
    Some examples of data for my paintings is as below.
    INSERT INTO user_info VALUES( 'u1', to_date('9/17/2009 20:00','MM/DD/YYYY mi:ss'), -2 );
    INSERT INTO user_info VALUES( 'u2', to_date('9/17/2009 19:55','MM/DD/YYYY mi:ss'), -4 );
    
    INSERT INTO post_table VALUES( 'p1', 'u1', to_date('9/17/2009 20:50','MM/DD/YYYY mi:ss'), 6 );
    INSERT INTO post_table VALUES( 'p2', 'u2', to_date('9/17/2009 20:30','MM/DD/YYYY mi:ss'), -5 );
    INSERT INTO post_table VALUES( 'p3', 'u2', to_date('9/18/2009 6:00','MM/DD/YYYY mi:ss'), 2 );
    INSERT INTO post_table VALUES( 'p4', 'u1', to_date('9/17/2009 21:00','MM/DD/YYYY mi:ss'), -3 );
    I need to write a SQL query which - is the user whose time difference between the time of the connection and the last time when he or she wrote a post is the smallest. I need to consider the time zones here as well.

    I am not sure if time_zone must be of type VARCHAR or TIMESTAMP then have created as a VARCHAR in my paintings.

    Someone help me please to form this query.

    PS: How can I tags < code > user in this forum to write sql statements.

    Published by: user11994430 on October 9, 2009 17:59

    You can do this by adding a clause of "HAVING" as shown below. However, with your test defined data it returns ZERO rows because for all users of the MAX (DATEPOST) IS LESS than MAX (LOGIN_DATE)

    SELECT     USER_ID
    FROM
    (
         SELECT     USER_ID
         ,     DENSE_RANK() OVER (ORDER BY POST_LOGIN_DIFF) RNK
         FROM
         (
              SELECT     USER_INFO.USER_ID
              ,     MAX(DATEPOST) - MAX(LOGIN_DATE) AS POST_LOGIN_DIFF
              FROM     USER_INFO
              JOIN     POST_TABLE     ON POST_TABLE.USER_ID = USER_INFO.USER_ID
              GROUP BY USER_INFO.USER_ID
              HAVING      MAX(DATEPOST) > MAX(LOGIN_DATE)
         )
    )
    WHERE RNK = 1
    
  • How can I find out whether a patch applied to the sql query

    How can I find out whether a patch applied to the sql query

    Select * from ad_bugs where numero_de_bogue = '';

    HTH
    Srini

  • SQL query problem - (internal has not managed to the outer query)

    Hi all:

    Here is my SQL query:
    SELECT RD.SITE,
      ROUND(
      (SELECT COUNT (DISTINCT PB.EMP_ID)
      FROM BOOK PB
      WHERE PB.EMP_ID IN
        (SELECT PB.EMP_ID FROM BOOK PB
        )
      ) /
      (SELECT COUNT (DISTINCT PB.EMP_ID)
      FROM BOOK PB
      WHERE PB.EMP_ID IN
        (SELECT PB.EMP_ID FROM BOOK PB
    WHERE MO.QUALIFIER > 4
        )
      )* 100, 2) AS PERCENTAGE
    FROM BOOK PB
    LEFT JOIN POSITION MO
    ON PB.EMP_ID = PO.EMP_ID
    INNER JOIN PHYS_LOCATION RD
    ON MO.HOUSED         = RD.SITE_ID
    WHERE MO.ACTUAL_END IS NULL
    GROUP BY RD.SITE;
    Why am I the overall percentage of all Sites as opposed to each percentage calculation for each site. I've grouped by Rd. SITE, so I assume he would calculate the percentages for each site. What I've done wrong?

    Thank you for your help.

    AquaNX4 wrote:
    Hi all:

    Here is my SQL query:

    SELECT RD.SITE,
    ROUND(
    (SELECT COUNT (DISTINCT PB.EMP_ID)
    FROM BOOK PB
    WHERE PB.EMP_ID IN
    (SELECT PB.EMP_ID FROM BOOK PB
    )
    ) /
    (SELECT COUNT (DISTINCT PB.EMP_ID)
    FROM BOOK PB
    WHERE PB.EMP_ID IN
    (SELECT PB.EMP_ID FROM BOOK PB
    WHERE MO.QUALIFIER > 4
    )
    )* 100, 2) AS PERCENTAGE
    FROM BOOK PB
    LEFT JOIN POSITION MO
    ON PB.EMP_ID = PO.EMP_ID
    INNER JOIN PHYS_LOCATION RD
    ON MO.HOUSED         = RD.SITE_ID
    WHERE MO.ACTUAL_END IS NULL
    GROUP BY RD.SITE;
    

    Why am I the overall percentage of all Sites as opposed to each percentage calculation for each site. I've grouped by Rd. SITE, so I assume he would calculate the percentages for each site. What I've done wrong?

    It's what you're asking. Your subquery scalar to get the percentage is not restricted by the current site. Add columns to filter to restrict the values selected for the calculation

    Published by: riedelme on May 8, 2013 07:26

  • SQL query to assign several concurrent programs to the concurrent Manager.

    Hello

    You have any script to assign a list of program contributing to separate concurrent managers. Currently, there are more than 100 programs need to be assigned to the manager.ut

    We do front end, but it will take quite a long time to complete this task.

    Could you please help me on this.

    Thank you and best regards,

    Simone.

    Hi Simone,.

    First of all I need a sql query to find out what custom programs are assigned to which Manager.

    Please see:

    How can I tell which concurrent Manager handled a simultaneous [ID 344011.1] application/program

    Find all programs assigned to the specialization Manager rules? [271283.1 ID]

    Second, I have to give these programs customized to different custom managers.

    See if this helps:

    https://forums.Oracle.com/thread/2343489

    Thank you &

    Best regards

  • SQL Query + long running.

    Dear gurus/masters/All,
    I beg you all to help me with the setting of the SQL query that takes more time. DB version: 10.2.0.4

    Query SQL WHERE condition:
    select column1, column2, .........
    FROM
    SIEBEL.S_ORG_EXT T1,
    SIEBEL.S_PROD_INT T2,
    SIEBEL.S_VOD T3,
    SIEBEL.S_ORG_EXT T4,
    SIEBEL.S_ORG_EXT T5,
    SIEBEL.S_ORG_EXT_X T6,
    SIEBEL.S_PROD_LN T7,
    SIEBEL.S_ASSET_OM T8,
    SIEBEL.S_VOD_VER T9,
    SIEBEL.S_CTLG_CAT T10,
    SIEBEL.S_CONTACT T11,
    SIEBEL.S_PARTY T12,
    SIEBEL.S_PARTY T13,
    SIEBEL.S_PROD_INT T14,
    SIEBEL.S_ASSET_BU T15,
    SIEBEL.S_CTLG_CAT T16,
    SIEBEL.S_ORG_EXT T17,
    SIEBEL.S_ORG_EXT T18,
    SIEBEL.S_ASSET T19,
    SIEBEL.S_ADDR_PER T20,
    SIEBEL.S_ORG_EXT T21,
    SIEBEL.S_ASSET_X T22,
    SIEBEL.S_ASSET T23
    WHERE
    T16.PAR_CAT_ID = T10.ROW_ID (+) AND
    T14.CG_PR_CTLG_CAT_ID = T16.ROW_ID (+) AND
    T3.ROW_ID = T9.VOD_ID AND
    T14.CFG_MODEL_ID = T3.OBJECT_NUM AND
    T23.OWNER_CON_ID = T11.ROW_ID (+) AND
    T23.OWNER_ACCNT_ID = T6.PAR_ROW_ID (+) AND
    T23.PER_ADDR_ID = T20.ROW_ID (+) AND
    T23.PROD_ID = T14.ROW_ID AND
    T23.OWNER_ACCNT_ID = T21.PAR_ROW_ID (+) AND
    T14.PR_PROD_LN_ID = T7.ROW_ID (+) AND
    T23.ROOT_ASSET_ID = T19.ROW_ID (+) AND
    T19.PROD_ID = T2.ROW_ID (+) AND
    T23.BILL_ACCNT_ID = T18.PAR_ROW_ID (+) AND
    T23.RTNG_DLR_ID = T1.PAR_ROW_ID (+) AND
    T23.PREF_SRV_DLR_ID = T17.PAR_ROW_ID (+) AND
    T23.DLR_ID = T4.PAR_ROW_ID (+) AND
    T23.ROW_ID = T22.PAR_ROW_ID (+) AND
    T23.ROW_ID = T8.PAR_ROW_ID (+) AND
    T23.PR_CON_ID = T12.ROW_ID (+) AND
    T23.BU_ID = T15.BU_ID (+) AND T23.ROW_ID = T15.ASSET_ID (+) AND
    T15.BU_ID = T13.ROW_ID (+) AND
    T15.BU_ID = T5.PAR_ROW_ID (+) AND
    ((T23.SERIAL_NUM IS NOT NULL AND T23.PAR_ASSET_ID IS NULL OR T23.X_PHONE_NUMBER IS NOT NULL AND T23.PAR_ASSET_ID IS NOT NULL) AND 
     (T9.VER_NUM = :1));
    Query execution plan:
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 967177145
    
    --------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                                         | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                                  |                | 54117 |    92M|  4435K  (1)| 01:58:43 |
    |   1 |  NESTED LOOPS OUTER                               |                | 54117 |    92M|  4435K  (1)| 01:58:43 |
    |   2 |   NESTED LOOPS OUTER                              |                | 54117 |    87M|  4261K  (1)| 01:54:04 |
    |   3 |    NESTED LOOPS OUTER                             |                | 54117 |    86M|  4154K  (1)| 01:51:13 |
    |   4 |     NESTED LOOPS OUTER                            |                | 54117 |    85M|  4111K  (1)| 01:50:03 |
    |   5 |      NESTED LOOPS OUTER                           |                | 54117 |    84M|  3980K  (1)| 01:46:33 |
    |   6 |       NESTED LOOPS OUTER                          |                | 54117 |    83M|  3937K  (1)| 01:45:24 |
    |   7 |        NESTED LOOPS OUTER                         |                | 54117 |    81M|  3763K  (1)| 01:40:44 |
    |   8 |         NESTED LOOPS OUTER                        |                | 54117 |    81M|  3751K  (1)| 01:40:25 |
    |   9 |          NESTED LOOPS OUTER                       |                | 54117 |    80M|  3621K  (1)| 01:36:57 |
    |  10 |           NESTED LOOPS OUTER                      |                | 54117 |    73M|  3515K  (1)| 01:34:07 |
    |  11 |            NESTED LOOPS OUTER                     |                | 54117 |    71M|  3410K  (1)| 01:31:18 |
    |  12 |             NESTED LOOPS OUTER                    |                | 54117 |    69M|  3410K  (1)| 01:31:18 |
    |  13 |              NESTED LOOPS OUTER                   |                | 54117 |    67M|  3410K  (1)| 01:31:18 |
    |  14 |               NESTED LOOPS OUTER                  |                | 54117 |    66M|  3410K  (1)| 01:31:18 |
    |  15 |                NESTED LOOPS OUTER                 |                | 54117 |    64M|  3324K  (1)| 01:28:59 |
    |  16 |                 NESTED LOOPS OUTER                |                | 54117 |    62M|  3237K  (1)| 01:26:40 |
    |  17 |                  NESTED LOOPS                     |                | 54117 |    57M|  3106K  (1)| 01:23:10 |
    |  18 |                   NESTED LOOPS OUTER              |                |    71 | 43665 |   381   (2)| 00:00:01 |
    |  19 |                    NESTED LOOPS OUTER             |                |    71 | 42316 |   323   (2)| 00:00:01 |
    |  20 |                     NESTED LOOPS OUTER            |                |    71 | 41322 |   322   (2)| 00:00:01 |
    |  21 |                      NESTED LOOPS                 |                |    71 | 24708 |   265   (3)| 00:00:01 |
    |  22 |                       NESTED LOOPS                |                |    77 |  2772 |   141   (4)| 00:00:01 |
    |* 23 |                        TABLE ACCESS FULL          | S_VOD_VER      |    75 |  1350 |    72   (7)| 00:00:01 |
    |  24 |                        TABLE ACCESS BY INDEX ROWID| S_VOD          |     1 |    18 |     1   (0)| 00:00:01 |
    |* 25 |                         INDEX UNIQUE SCAN         | S_VOD_P1       |     1 |       |     1   (0)| 00:00:01 |
    |  26 |                       TABLE ACCESS BY INDEX ROWID | S_PROD_INT     |     1 |   312 |     2   (0)| 00:00:01 |
    |* 27 |                        INDEX RANGE SCAN           | S_PROD_INT_F9  |     1 |       |     1   (0)| 00:00:01 |
    |  28 |                      TABLE ACCESS BY INDEX ROWID  | S_PROD_LN      |     1 |   234 |     1   (0)| 00:00:01 |
    |* 29 |                       INDEX UNIQUE SCAN           | S_PROD_LN_P1   |     1 |       |     1   (0)| 00:00:01 |
    |  30 |                     TABLE ACCESS BY INDEX ROWID   | S_CTLG_CAT     |     1 |    14 |     1   (0)| 00:00:01 |
    |* 31 |                      INDEX UNIQUE SCAN            | S_CTLG_CAT_P1  |     1 |       |     1   (0)| 00:00:01 |
    |  32 |                    TABLE ACCESS BY INDEX ROWID    | S_CTLG_CAT     |     1 |    19 |     1   (0)| 00:00:01 |
    |* 33 |                     INDEX UNIQUE SCAN             | S_CTLG_CAT_P1  |     1 |       |     1   (0)| 00:00:01 |
    |* 34 |                   TABLE ACCESS BY INDEX ROWID     | S_ASSET        |   760 |   375K| 43753   (1)| 00:01:11 |
    |* 35 |                    INDEX RANGE SCAN               | S_ASSET_U2     | 55873 |       |   312   (3)| 00:00:01 |
    |  36 |                  TABLE ACCESS BY INDEX ROWID      | S_ASSET_OM     |     1 |    94 |     2   (0)| 00:00:01 |
    |* 37 |                   INDEX RANGE SCAN                | S_ASSET_OM_U1  |     1 |       |     2   (0)| 00:00:01 |
    |  38 |                 TABLE ACCESS BY INDEX ROWID       | S_CONTACT      |     1 |    39 |     2   (0)| 00:00:01 |
    |* 39 |                  INDEX UNIQUE SCAN                | S_CONTACT_P1   |     1 |       |     1   (0)| 00:00:01 |
    |  40 |                TABLE ACCESS BY INDEX ROWID        | S_ADDR_PER     |     1 |    29 |     2   (0)| 00:00:01 |
    |* 41 |                 INDEX UNIQUE SCAN                 | S_ADDR_PER_P1  |     1 |       |     1   (0)| 00:00:01 |
    |  42 |               TABLE ACCESS BY INDEX ROWID         | S_ORG_EXT      |     1 |    32 |     1   (0)| 00:00:01 |
    |* 43 |                INDEX UNIQUE SCAN                  | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  44 |              TABLE ACCESS BY INDEX ROWID          | S_ORG_EXT      |     1 |    32 |     1   (0)| 00:00:01 |
    |* 45 |               INDEX UNIQUE SCAN                   | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  46 |             TABLE ACCESS BY INDEX ROWID           | S_ORG_EXT      |     1 |    32 |     1   (0)| 00:00:01 |
    |* 47 |              INDEX UNIQUE SCAN                    | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  48 |            TABLE ACCESS BY INDEX ROWID            | S_ORG_EXT      |     1 |    36 |     2   (0)| 00:00:01 |
    |* 49 |             INDEX UNIQUE SCAN                     | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  50 |           TABLE ACCESS BY INDEX ROWID             | S_ORG_EXT      |     1 |   139 |     2   (0)| 00:00:01 |
    |* 51 |            INDEX UNIQUE SCAN                      | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  52 |          TABLE ACCESS BY INDEX ROWID              | S_ORG_EXT_X    |     1 |    16 |     2   (0)| 00:00:01 |
    |* 53 |           INDEX RANGE SCAN                        | S_ORG_EXT_X_U1 |     1 |       |     2   (0)| 00:00:01 |
    |* 54 |         INDEX UNIQUE SCAN                         | S_PARTY_P1     |     1 |    12 |     1   (0)| 00:00:01 |
    |  55 |        TABLE ACCESS BY INDEX ROWID                | S_ASSET_BU     |     1 |    34 |     3   (0)| 00:00:01 |
    |* 56 |         INDEX RANGE SCAN                          | S_ASSET_BU_U1  |     1 |       |     2   (0)| 00:00:01 |
    |* 57 |       INDEX UNIQUE SCAN                           | S_PARTY_P1     |     1 |    12 |     1   (0)| 00:00:01 |
    |  58 |      TABLE ACCESS BY INDEX ROWID                  | S_ASSET        |     1 |    37 |     2   (0)| 00:00:01 |
    |* 59 |       INDEX UNIQUE SCAN                           | S_ASSET_P1     |     1 |       |     2   (0)| 00:00:01 |
    |  60 |     TABLE ACCESS BY INDEX ROWID                   | S_PROD_INT     |     1 |    16 |     1   (0)| 00:00:01 |
    |* 61 |      INDEX UNIQUE SCAN                            | S_PROD_INT_P1  |     1 |       |     1   (0)| 00:00:01 |
    |  62 |    TABLE ACCESS BY INDEX ROWID                    | S_ORG_EXT      |     1 |    14 |     2   (0)| 00:00:01 |
    |* 63 |     INDEX UNIQUE SCAN                             | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  64 |   TABLE ACCESS BY INDEX ROWID                     | S_ASSET_X      |     1 |    93 |     3   (0)| 00:00:01 |
    |* 65 |    INDEX RANGE SCAN                               | S_ASSET_X_U1   |     1 |       |     2   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
      23 - filter("T9"."VER_NUM"=TO_NUMBER(:1))
      25 - access("T3"."ROW_ID"="T9"."VOD_ID")
      27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM")
      29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID"(+))
      31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID"(+))
      33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID"(+))
      34 - filter("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL OR "T23"."X_PHONE_NUMBER" IS
                  NOT NULL AND "T23"."PAR_ASSET_ID" IS NOT NULL)
      35 - access("T23"."PROD_ID"="T14"."ROW_ID")
      37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID"(+))
      39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID"(+))
      41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID"(+))
      43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID"(+))
      45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID"(+))
      47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID"(+))
      49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID"(+))
      51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID"(+))
      53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID"(+))
      54 - access("T23"."PR_CON_ID"="T12"."ROW_ID"(+))
      56 - access("T23"."ROW_ID"="T15"."ASSET_ID"(+) AND "T23"."BU_ID"="T15"."BU_ID"(+))
      57 - access("T15"."BU_ID"="T13"."ROW_ID"(+))
      59 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID"(+))
      61 - access("T19"."PROD_ID"="T2"."ROW_ID"(+))
      63 - access("T15"."BU_ID"="T5"."PAR_ROW_ID"(+))
      65 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID"(+))
    
    Note
    -----
       - dynamic sampling used for this statement
    
    105 rows selected.

    Hello

    It is not necessary to display the trace file - everything is clear from the plans that you have posted. The optimizer is the selectivity calculation assuming the absence of correlation between the columns. You can do these calculations that yourself and you see that if the entries are correct and if the hypothesis of lack of correlation is also correct, then the results should be correct, too. Since they are not, it's one of two things: optimizer stats are wrong, or the columns are in fact related.

    First of all check the optimizer statistics: i.e. take NUM_ROWS and NUM_NULLS of DBA_TAB_COL_STATISTICS and compare them with the actual rowcounts. If they are correct (in a reasonable error margin), then it means that the columns are correlated, and the optimizer will need additional assistance to obtain right of cardinalities.

    Best regards
    Nikolai

  • Efficient SQL query

    Hello
    I need to write an efficient query because the query about 4 checks to be made on the lines before you return one row. Here's a sample script in query to create the table:

    CREATE TABLE "myschema". "" Complaint. "
    (
    "Compalint_ID" NUMBER (20.0).
    "ReplyTime' NUMBER,-it would be in a few minutes
    "CREATION_TIME' TIMESTAMP (6).
    NUMBER OF 'STATUS ',.
    "TYPE" NUMBER


    "CH_PKRTBL_Complaint_ID" ("Compalint_ID") PRIMARY KEY CONSTRAINT
    USING INDEX PCTFREE, INITRANS 10 2 MAXTRANS 255 CALCULATES STATISTICS
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    TABLESPACE 'myspace' ENABLE
    ) PCTFREE, PCTUSED, INITRANS 40 10 1 MAXTRANS 255 NOCOMPRESS SLAUGHTER
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    TABLESPACE "myspace";

    CREATE UNIQUE INDEX "myschema". "" CH_PKRTBL_Complaint_ID "WE"myschema ". "" Complaint "("Compalint_ID")
    PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    TABLESPACE "myspace";

    ALTER TABLE 'myschema. ' ' KEY PRIMARY complaint ' ADD CONSTRAINT 'CH_PKRTBL_TKTID' ('Compalint_ID')
    USING INDEX PCTFREE, INITRANS 10 2 MAXTRANS 255 CALCULATES STATISTICS
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    TABLESPACE 'myspace' ENABLE;



    I want to write an efficient pl/sql-sql query with the least time to return a row based on four following priorities/controls in the order specified below:

    1 return any line that contains a TYPE = 11

    2. If no line found for 1 check then
    calculate a difference in time for all of the lines as: time_difference (CREATION_TIME - ReplyTime)
    and back to the line that has more big differene in - ve (it is the line which expired first)

    3. If now the found line to check then the 2
    rank next where STATUS = 22

    4. If no line found to check then the 3
    calculate a difference in time for all of the lines as: time_difference (CREATION_TIME - ReplyTime)
    and back to the line that has a smaller difference in + ve (it is the line that will expire then)


    Kindly help me in this task.

    Thank you.

    @1
    I have the suggestion of Daniel while avoiding reserved words and now I see an error in copy/paste complaint_ casetypestatus when 22 then 22 end check3

    @2
    Bilal already you made in the right direction, anyway: as many others pointed out that you can not combine functions of the group the way which you intend to so using functions analytical has been the only issue keeping all lines and the calculation of the required amounts and charges in the query internal to combine in the outer query.
    complaint_type case when 11 11 then end keeps only the 11 complaint_type all other complaint_type null values
    Max (case complaint_type when 11 11 then complete) on check1_max (order by NULL rows between unbounded preceding and following unbounded), calculates the global maximum of the expression (in all the rows of the table)

    @3
    I used systimestamp - (creation_time + reply_time / 60/24) just to produce a positive or negative number as your time_difference (CREATION_TIME - ReplyTime) somehow confused me (timestamp less number gives timestamp if positive or negative is not an appropriate question) so the above expression as used so far is something you know how (re) set. Other required clarification/explanation at this stage.

    @4
    If the fraction of the second precision is not necessary using the date data type should be sufficient (environmental CAR you cannot rule out dealing with the events with the same timestamp) and what is the thrown error using systimestamp

    Concerning

    Etbin

Maybe you are looking for

  • V iPhoto photo

    Hi, I have just this week improved my MBP 5 years to a nice shiny new slimline MPB. I managed to migrate everything with great success and have my old MBP for my daughter to use Believe it or not?  I only just realized that I have TWO official Apple

  • HP4630: while a single 4630 - printer disconnects despite a wifi connection

    I installed the drivers from HP4630 on my Windows laptop, 10, it says that it is connected to the wifi by the test pages.  As soon as I try to print it tells me that the printer is 'offline' to the right of the description.  I spent 2 hours trying to

  • Laptop suspended

    Hello everyone. I have an Alienware m17x r4. I got it for four years and its been absolutely brilliant. But these last three days its been acting weird vey. It starts on the first of these three days and hang just at the moment where he slowed. Then

  • Cisco VPN two LANs inside

    Hi all We hope that you do very well. I checked the other questions, but unfortunately, I have found nothing to do with my request. I'm just a newbie here. So, I really would appreciate if Pros help me here. Thank you! That is the problem. I've imple

  • The Adobe servers isn't reachable... these latest updates of LR CC and CC PS starts do not

    HelloI tried to install the updates for LR CC and CC PS which where published yesterday to my windows 10 PC and portable through the CreativeCloud app but it does not work on two machines with the message that the Adobe servers are not accessible.I u