Does SQL Query run faster with/without Conditions....

Hi All, forgive my novice question.
Was just wondering" In general if we run a SQL query on a single table; does my query run faster if there are multiple where conditions? or without. What happens if the conditions increase? My table is a big one with 5 million rows and some bitmap indexes defined on it.
Thanks,
Kon

I think it's difficult to give general rule because there are too much dependencies on the fact that the columns are indexed or not, on the way tables and indexes statistics are computed or not, on the possible session or instance parameters that the optimizer may use, on the Oracle version, etc.
Message was edited by:
Pierre Forstmann

Similar Messages

  • 10g query running faster with RBO than CBO

    I am running a query in Oracle 10g that is taking 1minute 15 seconds to run using the CBO. All the tables and indexes in the query are fully analyzed. However if i add a /*+ Rule */ hint to the query and force the optimizer to RBO it runs in 5 seconds.
    Anyone any ideas why this would occur? it's contrary to everything Oracle says about CBO and problematic as RBO is no longer supported in 10g
    Any help / advice greatfully appreciated
    Thanks
    Declan

    My "best" CBO explain plan is......
    Explain complete.
    Elapsed: 00:00:01:90
    PLAN_TABLE_OUTPUT                                                                                                                           
    | Id  | Operation                          |  Name                          | Rows  | Bytes |TempSpc| Cost  |                               
    |   0 | SELECT STATEMENT                   |                                |  3364K|  2553M|       |   666K|                               
    |   1 |  SORT ORDER BY                     |                                |  3364K|  2553M|  5840M|   666K|                               
    |   2 |   VIEW                             |                                |  3364K|  2553M|       |   273K|                               
    |   3 |    UNION-ALL                       |                                |       |       |       |       |                               
    |*  4 |     HASH JOIN                      |                                |  2269K|  1415M|       |   255K|                               
    |*  5 |      TABLE ACCESS FULL             | NODE                           |     6 |   198 |       |   183 |                               
    |*  6 |      HASH JOIN OUTER               |                                |  2269K|  1344M|       |   255K|                               
    |*  7 |       HASH JOIN                    |                                |   710 |   266K|       |  2179 |                               
    |*  8 |        HASH JOIN OUTER             |                                |  1219 |   165K|       |   355 |                               
    |*  9 |         HASH JOIN                  |                                |  1219 |   154K|       |   318 |                               
    |* 10 |          HASH JOIN                 |                                |  1219 |   138K|       |   260 |                               
    |* 11 |           HASH JOIN                |                                |  1219 |   127K|       |   224 |                               
    |  12 |            TABLE ACCESS FULL       | TMP_NODE_WALK_ALL_NODES        |  8168 |   311K|       |    17 |                               
    |* 13 |            HASH JOIN               |                                | 10896 |   723K|       |   201 |                               
    |  14 |             INDEX FAST FULL SCAN   | PK_NODE_RULES_NODE_ID_RULE_ID  | 10896 |   106K|       |     6 |                               
    |  15 |             TABLE ACCESS FULL      | NODE                           | 73004 |  4134K|       |   183 |                               
    |  16 |           INDEX FAST FULL SCAN     | IDX_NODE_CIX2                  | 73004 |   641K|       |    33 |                               
    PLAN_TABLE_OUTPUT                                                                                                                           
    |  17 |          INDEX FAST FULL SCAN      | IDX_NODE_CIX1                  | 73004 |   998K|       |    54 |                               
    |  18 |         INDEX FAST FULL SCAN       | IDX_NODE_CIX2                  | 73004 |   641K|       |    33 |                               
    |* 19 |        TABLE ACCESS FULL           | RULES                          |  6344 |  1517K|       |  1820 |                               
    |  20 |       VIEW                         |                                |   405M|    89G|       | 43581 |                               
    |* 21 |        HASH JOIN OUTER             |                                |   405M|    23G|       | 43581 |                               
    |  22 |         TABLE ACCESS FULL          | TMP_NODE_WALK_ALL_NODES        |  8168 |   103K|       |    17 |                               
    |  23 |         TABLE ACCESS FULL          | UNIVERSAL_RULES                |  3377K|   157M|       | 43256 |                               
    |* 24 |     HASH JOIN OUTER                |                                |  1094K|   410M|   148M| 17453 |                               
    |  25 |      MERGE JOIN CARTESIAN          |                                |   390K|   143M|       | 15029 |                               
    |  26 |       NESTED LOOPS                 |                                |    70 | 25060 |       |  2849 |                               
    |  27 |        NESTED LOOPS                |                                |    70 | 21000 |       |  2779 |                               
    |  28 |         TABLE ACCESS BY INDEX ROWID| UNIVERSAL_RULES                |  1392 | 76560 |       |  1387 |                               
    |* 29 |          INDEX RANGE SCAN          | IDX_UNIVERSAL_RULES_ACCOUNT    |  1392 |       |       |     6 |                               
    |* 30 |         TABLE ACCESS BY INDEX ROWID| RULES                          |     1 |   245 |       |     1 |                               
    |* 31 |          INDEX UNIQUE SCAN         | PK_RULES_RULE_ID_VERSION_ID    |    20 |       |       |       |                               
    |* 32 |        TABLE ACCESS BY INDEX ROWID | NODE                           |     1 |    58 |       |     1 |                               
    |* 33 |         INDEX UNIQUE SCAN          | PK_NODE_NODE_ID                |     6 |       |       |       |                               
    |  34 |       BUFFER SORT                  |                                |  5616 |   153K|       | 15028 |                               
    |  35 |        TABLE ACCESS BY INDEX ROWID | NODE                           |  5616 |   153K|       |   174 |                               
    |* 36 |         INDEX RANGE SCAN           | IDX_NODE_NODE_TYPE_ID          |  5616 |       |       |    11 |                               
    |* 37 |      INDEX FAST FULL SCAN          | IDX_RULES_RULE_ID_STATUS       | 42293 |   289K|       |    48 |                               
    PLAN_TABLE_OUTPUT                                                                                                                           
    Predicate Information (identified by operation id):                                                                                         
       4 - access("NODE"."NODE_TYPE_ID"="SN"."HIERARCHY_TYPE_ID")                                                                               
       5 - filter("NODE"."PARENT_NODE_ID" IS NULL)                                                                                              
       6 - access("SYS_ALIAS_1"."RULE_ID"="UR"."RULE_ID"(+) AND "SYS_ALIAS_1"."VERSION_ID"="UR"."VERSION_ID"(+))                                
       7 - access("NR"."RULE_ID"="SYS_ALIAS_1"."COMBINED_RULE_ID")                                                                              
       8 - access("SN"."PARENT_NODE_ID"="SP"."NODE_ID"(+))                                                                                      
       9 - access("AN"."START_NODE_ID"="SN"."NODE_ID")                                                                                          
      10 - access("AN"."EFFECTIVE_NODE_ID"="EN"."NODE_ID")                                                                                      
      11 - access("AN"."SHORTCUT_NODE_ID"="N"."NODE_ID")                                                                                        
      13 - access("N"."NODE_ID"="NR"."NODE_ID")                                                                                                 
      19 - filter(',A,P,' LIKE '%,'||"SYS_ALIAS_1"."STATUS"||',%')                                                                              
      21 - access("UR"."NODE_ID"(+)="AN"."START_NODE_ID")                                                                                       
      24 - access("R"."RULE_ID"="RP"."RULE_ID"(+))                                                                                              
      29 - access("UR"."ACCOUNT_ID"='0069')                                                                                                     
      30 - filter(',A,P,' LIKE '%,'||"R"."STATUS"||',%')                                                                                        
      31 - access("UR"."RULE_ID"="R"."RULE_ID" AND "UR"."VERSION_ID"="R"."VERSION_ID")                                                          
      32 - filter("N"."HIERARCHY_TYPE_ID"=9)                                                                                                    
    PLAN_TABLE_OUTPUT                                                                                                                           
      33 - access("UR"."NODE_ID"="N"."NODE_ID")                                                                                                 
      36 - access("NODE"."NODE_TYPE_ID"=9)                                                                                                      
      37 - filter("RP"."STATUS"(+)='P')                                                                                                         
    Note: cpu costing is off                                                                                                                    
    28 rows selected.
    Elapsed: 00:00:02:45
    68 rows selected.
    Elapsed: 00:00:05:76While my RBO explain plan is
    Explain complete.
    Elapsed: 00:00:01:23
    PLAN_TABLE_OUTPUT                                                                                                                           
    | Id  | Operation                                |  Name                        | Rows  | Bytes | Cost  |                                   
    |   0 | SELECT STATEMENT                         |                              |       |       |       |                                   
    |   1 |  SORT ORDER BY                           |                              |       |       |       |                                   
    |   2 |   VIEW                                   |                              |       |       |       |                                   
    |   3 |    UNION-ALL                             |                              |       |       |       |                                   
    |   4 |     MERGE JOIN OUTER                     |                              |       |       |       |                                   
    |   5 |      SORT JOIN                           |                              |       |       |       |                                   
    |*  6 |       TABLE ACCESS BY INDEX ROWID        | NODE                         |       |       |       |                                   
    |   7 |        NESTED LOOPS                      |                              |       |       |       |                                   
    |   8 |         NESTED LOOPS                     |                              |       |       |       |                                   
    |   9 |          NESTED LOOPS                    |                              |       |       |       |                                   
    |  10 |           NESTED LOOPS                   |                              |       |       |       |                                   
    |  11 |            NESTED LOOPS                  |                              |       |       |       |                                   
    |  12 |             NESTED LOOPS OUTER           |                              |       |       |       |                                   
    |  13 |              NESTED LOOPS                |                              |       |       |       |                                   
    |  14 |               TABLE ACCESS FULL          | TMP_NODE_WALK_ALL_NODES      |       |       |       |                                   
    |  15 |               TABLE ACCESS BY INDEX ROWID| NODE                         |       |       |       |                                   
    |* 16 |                INDEX UNIQUE SCAN         | PK_NODE_NODE_ID              |       |       |       |                                   
    PLAN_TABLE_OUTPUT                                                                                                                           
    |  17 |              TABLE ACCESS BY INDEX ROWID | NODE                         |       |       |       |                                   
    |* 18 |               INDEX UNIQUE SCAN          | PK_NODE_NODE_ID              |       |       |       |                                   
    |  19 |             TABLE ACCESS BY INDEX ROWID  | NODE                         |       |       |       |                                   
    |* 20 |              INDEX UNIQUE SCAN           | PK_NODE_NODE_ID              |       |       |       |                                   
    |  21 |            TABLE ACCESS BY INDEX ROWID   | NODE                         |       |       |       |                                   
    |* 22 |             INDEX UNIQUE SCAN            | PK_NODE_NODE_ID              |       |       |       |                                   
    |  23 |           TABLE ACCESS BY INDEX ROWID    | NODE_RULES                   |       |       |       |                                   
    |* 24 |            INDEX RANGE SCAN              | IDX_NODE_RULES_NODE_ID       |       |       |       |                                   
    |* 25 |          TABLE ACCESS BY INDEX ROWID     | RULES                        |       |       |       |                                   
    |* 26 |           INDEX RANGE SCAN               | IDX_RULES_COMBINED_RULE_ID   |       |       |       |                                   
    |* 27 |         INDEX RANGE SCAN                 | IDX_NODE_NODE_TYPE_ID        |       |       |       |                                   
    |* 28 |      SORT JOIN                           |                              |       |       |       |                                   
    |  29 |       VIEW                               |                              |       |       |       |                                   
    |  30 |        NESTED LOOPS OUTER                |                              |       |       |       |                                   
    |  31 |         TABLE ACCESS FULL                | TMP_NODE_WALK_ALL_NODES      |       |       |       |                                   
    |  32 |         TABLE ACCESS BY INDEX ROWID      | UNIVERSAL_RULES              |       |       |       |                                   
    |* 33 |          INDEX RANGE SCAN                | IDX_UNIVERSAL_RULES_NODE     |       |       |       |                                   
    |  34 |     NESTED LOOPS OUTER                   |                              |       |       |       |                                   
    |  35 |      NESTED LOOPS                        |                              |       |       |       |                                   
    |  36 |       NESTED LOOPS                       |                              |       |       |       |                                   
    |  37 |        NESTED LOOPS                      |                              |       |       |       |                                   
    PLAN_TABLE_OUTPUT                                                                                                                           
    |  38 |         TABLE ACCESS BY INDEX ROWID      | NODE                         |       |       |       |                                   
    |* 39 |          INDEX RANGE SCAN                | IDX_NODE_NODE_TYPE_ID        |       |       |       |                                   
    |  40 |         TABLE ACCESS BY INDEX ROWID      | UNIVERSAL_RULES              |       |       |       |                                   
    |* 41 |          INDEX RANGE SCAN                | IDX_UNIVERSAL_RULES_ACCOUNT  |       |       |       |                                   
    |* 42 |        TABLE ACCESS BY INDEX ROWID       | NODE                         |       |       |       |                                   
    |* 43 |         INDEX UNIQUE SCAN                | PK_NODE_NODE_ID              |       |       |       |                                   
    |* 44 |       TABLE ACCESS BY INDEX ROWID        | RULES                        |       |       |       |                                   
    |* 45 |        INDEX UNIQUE SCAN                 | PK_RULES_RULE_ID_VERSION_ID  |       |       |       |                                   
    |* 46 |      INDEX RANGE SCAN                    | IDX_RULES_RULE_ID_STATUS     |       |       |       |                                   
    Predicate Information (identified by operation id):                                                                                         
       6 - filter("NODE"."PARENT_NODE_ID" IS NULL)                                                                                              
      16 - access("AN"."START_NODE_ID"="SN"."NODE_ID")                                                                                          
      18 - access("SN"."PARENT_NODE_ID"="SP"."NODE_ID"(+))                                                                                      
      20 - access("AN"."EFFECTIVE_NODE_ID"="EN"."NODE_ID")                                                                                      
      22 - access("AN"."SHORTCUT_NODE_ID"="N"."NODE_ID")                                                                                        
      24 - access("N"."NODE_ID"="NR"."NODE_ID")                                                                                                 
      25 - filter(',A,P,' LIKE '%,'||"SYS_ALIAS_1"."STATUS"||',%')                                                                              
    PLAN_TABLE_OUTPUT                                                                                                                           
      26 - access("NR"."RULE_ID"="SYS_ALIAS_1"."COMBINED_RULE_ID")                                                                              
      27 - access("NODE"."NODE_TYPE_ID"="SN"."HIERARCHY_TYPE_ID")                                                                               
      28 - access("SYS_ALIAS_1"."RULE_ID"="UR"."RULE_ID"(+))                                                                                    
           filter("SYS_ALIAS_1"."VERSION_ID"="UR"."VERSION_ID"(+) AND                                                                           
                  "SYS_ALIAS_1"."RULE_ID"="UR"."RULE_ID"(+))                                                                                    
      33 - access("UR"."NODE_ID"(+)="AN"."START_NODE_ID")                                                                                       
      39 - access("NODE"."NODE_TYPE_ID"=9)                                                                                                      
      41 - access("UR"."ACCOUNT_ID"='0069')                                                                                                     
      42 - filter("N"."HIERARCHY_TYPE_ID"=9)                                                                                                    
      43 - access("UR"."NODE_ID"="N"."NODE_ID")                                                                                                 
      44 - filter(',A,P,' LIKE '%,'||"R"."STATUS"||',%')                                                                                        
      45 - access("UR"."RULE_ID"="R"."RULE_ID" AND "UR"."VERSION_ID"="R"."VERSION_ID")                                                          
      46 - access("R"."RULE_ID"="RP"."RULE_ID"(+) AND "RP"."STATUS"(+)='P')                                                                     
    Note: rule based optimization                                                                                                               
    28 rows selected.
    Elapsed: 00:00:04:42
    78 rows selected.
    Elapsed: 00:00:08:86Any additional help appreciated
    I am going to try and run a trace against the sql now and see if i can get any more information
    Thanks in advance
    Declan

  • Strange problem... Query runs faster, but report runs slow...

    Hi Gurus,
    We are using Report 10g on 10g Application server and solaris. we created a report on a table which has 10,000 rows. The report has 25 columns. when we run this query in Toad it took 12 sec for fetching all these 10,000 rows
    But when we run the report with Destype = 'FILE' and Desformat = 'DELIMITEDDDATA', it is taking 5 to 8 minutes
    to open in excel ( we concatenated mimetype=vnd-msexcel at the end of the url if the Destype=FILE). We removed the layout in the report as it is taking 10 to 15 mins to run to Screen with Desformat=HTML/PDF(formating pages taking more time). We are wondering why DELIMITEDDATA format is taking long time as it runs only query.
    Does RWSERVLET take more time of writing the data to the Physical file in the cache dir? Our cache size is 1 GB. we have 2 report servers clustered. Tracing is off.
    Please advise me if there are any report server settings to boost the performance.
    Thanks alot,
    Ram.

    Duplicate of Strange problem... Query runs faster, but report runs slow... in the Reports forum.
    [Thread closed]

  • What are the ways to make Query run fast?

    Hi Experts,
    When a query runs slow, we generally go for creating an aggregate. My doubt is - what other things can be done to make a query run faster before creating an aggregate? What is the thumb rule to be carried out for creating an aggregate?
    Regards,
    Shreeem

    Hi Shreem,
    If you keep Query simple not complicate it with runtime calculations , it would be smooth. However as per business requirements we will have to go for it anyways mostly.
    regarding aggregates:
    Please do not use the standard proposal , it will give you hundreds based on std. rules , which consumes lots of space and adds up to load times. If you have users already using the Query and you are planning to tune it  then go for the statistics tables:
    1.RSDDSTAT_OLAP    find the query with long runtimes  get the Stepuid
    2. RSDDSTAT_DM
    3. RSDDSTATAGGRDEF  - use the stepuid above to see which aggregate is necessary for which cube.
    Another way to check ; check the users as in 1 to find the highest runtime users and find the last used bookmarks by user thru RSZWBOOKMARK for this query and check if the time matches and create the aggregates as in 3 above.
    You can also Use Transaction RSRT > execute & debug  (display stats ) - to create generic aggregates to support navigations for New queries and later refine as above.
    Hope it helps .
    Thnks
    Ram

  • Any settings that can be adjusted to make everything run faster with Mountain Lion

    Hello,
    Does anyone know of any settings or adjustments that can be tweeked to make my machine run faster with Mountain Lion?
    Thanks, Jason

    yes you can do it yourself - it's actually a simple upgrade - i use a ssd in my macbook and have the RAM maxed out to 16GB.
    as for what brands should you consider, here are some good ones.
    Sandisk Extreme - Currently the fastest one out there.
    Kingston HyperX - Second fastest - this is what I have in my 13 Inch Late 2011.
    Samsung 830 series - Fast and uses less battery power - this is what's installed in the Macbook Retina.
    Crucial M4 - Also a fast SSD - I have the 512GB installed in my 15 inch Late 2011.
    If you decide to install one of these ssd in your Macbook - let me know if you need a step by step on how to clone your drive.
    Good luck..

  • Oracle Apex - when I open a page the sql query runs

    What do I need to change to stop the sql query running when a page is opened in Apex
    the page accepts a value to search a table for relevant data. I have set a default value
    every time I open the page it runs the sql query using the default value

    Does it need a default value?  Why I am asking is, you could add a conditional display to your report region that would not show the report until the item has a value entered by the user..
    Thank you,
    Tony Miller
    LuvMuffin Software
    Salt Lake City, UT

  • See sql query from crystal report without crystal report

    see sql query from crystal report without crystal report 

    Hi,
    Depends on datasource type but you could have a look at ODBC trace or if you have access to the SQL Server you could use profiler to monitor the session.
    Regards,
    Craig
    And this will only be of use if you know which Server/Insstance/Database the Report is connecting to...
    Please click "Mark As Answer" if my post helped. Tony C.

  • SQL Query updateable report with row selector. Update process.

    I have a SQL Query updateable report with the row selector(s).
    How would I identify the row selector in an update process on the page.
    I would like to update certain columns to a value of a select box on the page.
    Using the basic:
    UPDATE table_name
    SET column1=value
    WHERE some_column=some_value
    I would need to do:
    UPDATE table_name
    SET column1= :P1_select
    WHERE [row selector] = ?
    Now sure how to identify the [row selector] and/or validate it is checked.
    Thanks,
    Bob

    I don't have the apex_application.g_f01(i) referenced in the page source...In the page source you wouldn't find anything by that name
    Identify the tabular form's checkbox column in the page(firebug/chrome developer panel makes this easy)
    It should be like
    <input id="..." value="" type="checkbox" name="fXX" >we are interested in the name attribute , get that number (between 01 and 50)
    Replace that number in the code, for instance if it was f05 , the code would use
    apex_application.g_f05
    --i'th checked record' primary keyWhen you loop through a checkbox array, it only contains the rows which are checked and it is common practice to returns the record's primary key as the value of the checkbox(available as the the i'th array index as apex_application.g_f05(i) , where i is sequence position of the checked row) so that you can identify the record.

  • SQL query to get the without SCCM agent for a Server

    Hello every one,
    Can I get the SQL query for a server without a SCCM agent . 

    Here you go!!
    Add the version for windows 2012 server if you have them as well in your environment
       v_R_System.Netbios_Name0
      ,v_R_System.Full_Domain_Name0
      ,v_R_System.User_Name0
      ,case
    When v_R_System.Operating_System_Name_and0 LIKE N'%Server 6.1'THEN 'Windows Server 2008 R2'
    When v_R_System.Operating_System_Name_and0 LIKE N'%Server 6.0'THEN 'Windows Server 2008'
    When v_R_System.Operating_System_Name_and0 LIKE N'%Server 5.2'THEN 'Windows Server 2003 R2'
     ELSE 'Unknown Version' END AS 'OS version'
    FROM
      v_R_System
    WHERE
      v_R_System.Operating_System_Name_and0 LIKE N'%server%' and v_R_System.Client0 is null
    Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. Delphin

  • My computer is taking forever to boot up and when it finally does it starts running fast and then freezes...

    My computer is taking forever to boot up and when it finally does it starts running fast and then freezes...I have cleaned out and backed up files, as well as utilitzed Mac Keeper...Do I need to upgrade to Mountain Lion. or download new firmware?

    Uninstall MacKeeper, it's crap.
    http://applehelpwriter.com/2011/09/21/how-to-uninstall-mackeeper-malware/
    When that's done, then run through the Steps and tune up your machine.
    ..Step by Step to fix your Mac

  • Does the ipad run faster/slower with verizon 4g or 4g wifi without the verizon 4g option

    I'm looking at purchasing my first iPad and I'm not sure if it's worth spending the extra money to get the wifi and wireless or would it be just as fast to get the wifi version and use my 4g mifi card from Verizon?

    What will you use the 4g for? Do you travel often for work, go to very remote places? Why do you have mifi? Do you use your mifi with your phone on a regular basis? Can you use it for your phone and ipad? And don't you pay for mifi on a monthly basis even if you rarely use it? With 4g, you pay on a monthly basis so you might only need to do that a few times a year during the months you use it. I would call Verizon and find out. And I'm sure you're aware that they're always trying to sell you on spending more money so be careful how you word your questions.
    I quickly googled the mifi question and saw this article. http://www.zdnet.com/blog/apple/why-i-ordered-a-wi-fi-only-ipad/12470. Please read the comments to the article, too. Some agreed with the writer, while others had very different opinions. If you google your question, you'll get many opinions from professional tech people, users, and former users of 3g and 4g. This might help you make a decision.
    We got our first ipad, (64gb ipad 2 wi-fi only) for my husband in June and one of my sons got the same today. Both are refurbs from the Apple online store. They come with brand new outer shell, brand new battery, and full one year warranty (other places that sell refurbs probably do not refresh their refurbs as Apple does, so if you go refurb, use the Apple online store. They're great! We saved a lot of money, even with the 64gb. (I know people love their new ipads, but this way we didn't have to deal with the possible overheating, yellow hue on screens, etc. We did not get 3g because if we are somewhere and need 3g, we all have phones that we can use. And though we won't get Siri on ipad 2 when it comes out, we don't care about it - just enjoying the freedom of 64gb, etc.
    So, I suggest you evaluate your needs, check with Verizon, and google your questions. I'm sure you'll make the decision that is best for you!
    At any rate, enjoy your first ipad! We think you'll love it!
    Message was edited by: appleuser1322
    Forgot to tell you -- to answer your question - I have no idea if the ipad runs faster or slower with or without 4g! (Verizon would probably tell you faster because they'll make more money, so I suggest you also google that.)
    Hope this helps!

  • Query runs faster when there is no statistics

    Hi Gurus
    I have a Oracle 10.2.0.1 instance and I'm seeing the following weird behavior, I appreciate any pointers or references to resolve this problem.
    Thank you very much.
    1. Run the below mentioned query for 10 times continuously from sqlplus. Elapsed time is around 115 seconds (around 2
    min) for each execution. Elapsed time is constant, no increase or decrease. Tables involved in the query have statistics with 100% sampling.
    2. delete the statistics on 2 tables involved in query. Flush the shared_pool
    (alter system flush shared_pool).
    3. Run the query for 10 times. Elapsed time is less than 2 seconds for each execution. Elapsed time is constant, no
    increase or decrease.
    The Query: (it is a generated query, no option for modifying it).
    select count(distinct itm1.itm_id) FROM ita ita1, ita ita2, itm itm1, itm itm2, itm itm3
    where itm1.itm_container_id = 2812
    and itm1.itm_version_id <= 999999999
    and itm1.itm_next_version_id >= 999999999
    and itm2.itm_primary_key = 'RAYBESTOS'
    and itm3.itm_primary_key = '1'
    and ita1.ita_node_id = 3111
    and itm2.itm_container_id = 2020
    and ita1.ita_item_id = itm1.itm_id
    and ita1.ita_version_id <= 999999999
    and ita1.ita_next_version_id >= 999999999
    and itm2.itm_id = ita1.ita_value_numeric
    and itm2.itm_version_id <= 999999999
    and itm2.itm_next_version_id >= 999999999
    and ita2.ita_node_id = 3118
    and itm3.itm_container_id = 2025
    and ita2.ita_item_id = itm1.itm_id
    and ita2.ita_version_id <= 999999999
    and ita2.ita_next_version_id >= 999999999
    and itm3.itm_id = ita2.ita_value_numeric
    and itm3.itm_version_id <= 999999999
    and itm3.itm_next_version_id >= 999999999;
    Query uses dynamic sampling when there is no statistics.
    tkprof report shows there is a small difference in execution plan between 2 cases. When there is no statistics, there is table access by index rowid. It may be the reason for faster response time.
    Rows Row Source Operation
    1 SORT GROUP BY (cr=47235 pr=0 pw=0 time=919461 us)
    758 {color:#ff0000}TABLE ACCESS BY INDEX ROWID TCTG_ITA_ITEM_ATTRIBUTES (cr=47235 pr=0 pw=0 time=600473 us){color}
    14163 NESTED LOOPS (cr=40652 pr=0 pw=0 time=299694 us)
    7081 NESTED LOOPS (cr=25708 pr=0 pw=0 time=538463 us)
    12771 NESTED LOOPS (cr=90 pr=0 pw=0 time=255699 us)
    1 MERGE JOIN CARTESIAN (cr=6 pr=0 pw=0 time=271 us)
    1 INDEX RANGE SCAN ICTG_ITM_1 (cr=3 pr=0 pw=0 time=74 us)(object id 105409)
    1 BUFFER SORT (cr=3 pr=0 pw=0 time=112 us)
    1 INDEX RANGE SCAN ICTG_ITM_1 (cr=3 pr=0 pw=0 time=43 us)(object id 105409)
    12771 INDEX RANGE SCAN ICTG_ITA_1 (cr=84 pr=0 pw=0 time=102210 us)(object id 105399)
    7081 INDEX RANGE SCAN ICTG_ITM_0 (cr=25618 pr=0 pw=0 time=363715 us)(object id 105408)
    7081 INDEX RANGE SCAN ICTG_ITA_0 (cr=14944 pr=0 pw=0 time=239803 us)(object id 105398)

    Hi Jonathan,
    Thanks again for your response. Yes, you are correct. Most of the rows have all 9s, and a small percentage have something else - and there are only a small number of distinct values.
    Here is the histogram info when there is statistics (some old data have been trimmed for this test).
    TABLE_NAME                            COLUMN_NAME                    NUM_DISTINCT NUM_BUCKETS   HISTOGRAM
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_COMPANY_ID                             2             2FREQUENCY
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_CATALOG_ID                            62            62FREQUENCY
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_ITEM_ID                           720867             1NONE
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_NODE_ID                              118           118FREQUENCY
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_VALUE_NUMERIC                     587504           254HEIGHT BALANCED
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_VALUE_STRING                     1060930           254HEIGHT BALANCED
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_VERSION_ID                            48            48FREQUENCY
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_NEXT_VERSION_ID                        1             1FREQUENCY
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_OCCURRENCE_ID                      16250           254HEIGHT BALANCED
    TCTG_ITA_ITEM_ATTRIBUTES              ITA_VALUE_STRING_IGNORECASE          1498257           254HEIGHT BALANCED
    TCTG_ITM_ITEM                         ITM_COMPANY_ID                             2             2FREQUENCY
    TCTG_ITM_ITEM                         ITM_ID                                720867             1NONE
    TCTG_ITM_ITEM                         ITM_CONTAINER_ID                          62            62FREQUENCY
    TCTG_ITM_ITEM                         ITM_PRIMARY_KEY                       531960             1NONE
    TCTG_ITM_ITEM                         ITM_VERSION_ID                            48            48FREQUENCY
    TCTG_ITM_ITEM                         ITM_NEXT_VERSION_ID                        1             1FREQUENCY
    TCTG_ITM_ITEM                         ITM_STATUS                                 3             1NONE
    TCTG_ITM_ITEM                         ITM_COLLAB_INFO                            7             1NONE
    TCTG_ITM_ITEM                         ITM_LAST_MODIFIED                     717098             1NONEdisplay_cursor without statistics
    SQL> @disp-cursor
                           756
    Elapsed: 00:00:03.81
    SQL_ID  d9q6j48ns19zv, child number 0
    select /*+ gather_plan_statistics */ count(distinct itm1.itm_id)   FROM ita ita1, ita ita2, itm itm1, itm itm2, itm itm3 where
    itm1.itm_container_id = 2812      and itm1.itm_version_id <= 999999999      and itm1.itm_next_version_id >= 999999999      and
    itm2.itm_primary_key = 'RAYBESTOS'      and itm3.itm_primary_key = '1'      and ita1.ita_node_id = 3111      and
    itm2.itm_container_id = 2020      and ita1.ita_item_id = itm1.itm_id      and ita1.ita_version_id <= 999999999      and
    ita1.ita_next_version_id >= 999999999      and itm2.itm_id = ita1.ita_value_numeric      and itm2.itm_version_id <= 999999999
    and itm2.itm_next_version_id >= 999999999      and ita2.ita_node_id = 3118      and itm3.itm_container_id = 2025      and
    ita2.ita_item_id = itm1.itm_id      and ita2.ita_version_id <= 999999999      and ita2.ita_next_version_id >= 999999999      and
    itm3.itm_id = ita2.ita_value_numeric      and itm3.itm_version_id <= 999999999      and itm3.itm_next_version_id >= 999999999
    Plan hash value: 2184662757
    | Id  | Operation                    | Name                     | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    |   1 |  SORT GROUP BY               |                          |      1 |      1 |      1 |00:00:03.61 |     178K| 73728 | 73728 |      |
    |*  2 |   TABLE ACCESS BY INDEX ROWID| TCTG_ITA_ITEM_ATTRIBUTES |      1 |      1 |    756 |00:00:00.96 |     178K|       |  |           |
    |   3 |    NESTED LOOPS              |                          |      1 |      1 |  69879 |00:00:01.27 |     145K|       |  |           |
    |   4 |     NESTED LOOPS             |                          |      1 |      1 |  34939 |00:00:02.66 |   71815 |       |  |           |
    |   5 |      NESTED LOOPS            |                          |      1 |      1 |  35695 |00:00:00.71 |     229 |       |  |           |
    |   6 |       MERGE JOIN CARTESIAN   |                          |      1 |      1 |      1 |00:00:00.01 |       6 |       |  |           |
    |*  7 |        INDEX RANGE SCAN      | ICTG_ITM_1               |      1 |      1 |      1 |00:00:00.01 |       3 |       |  |           |
    |   8 |        BUFFER SORT           |                          |      1 |      1 |      1 |00:00:00.01 |       3 | 73728 | 73728 |      |
    |*  9 |         INDEX RANGE SCAN     | ICTG_ITM_1               |      1 |      1 |      1 |00:00:00.01 |       3 |       |  |           |
    |* 10 |       INDEX RANGE SCAN       | ICTG_ITA_1               |      1 |      1 |  35695 |00:00:00.29 |     223 |       |  |           |
    |* 11 |      INDEX RANGE SCAN        | ICTG_ITM_0               |  35695 |      1 |  34939 |00:00:01.14 |   71586 |       |  |           |
    |* 12 |     INDEX RANGE SCAN         | ICTG_ITA_0               |  34939 |      1 |  34939 |00:00:01.20 |   73590 |       |  |           |
    Predicate Information (identified by operation id):
       2 - filter("ITM3"."ITM_ID"="ITA2"."ITA_VALUE_NUMERIC")
       7 - access("ITM2"."ITM_PRIMARY_KEY"='RAYBESTOS' AND "ITM2"."ITM_CONTAINER_ID"=2020 AND "ITM2"."ITM_NEXT_VERSION_ID">=999999999 AND
                  "ITM2"."ITM_VERSION_ID"<=999999999)
           filter("ITM2"."ITM_VERSION_ID"<=999999999)
       9 - access("ITM3"."ITM_PRIMARY_KEY"='1' AND "ITM3"."ITM_CONTAINER_ID"=2025 AND "ITM3"."ITM_NEXT_VERSION_ID">=999999999 AND
                  "ITM3"."ITM_VERSION_ID"<=999999999)
           filter("ITM3"."ITM_VERSION_ID"<=999999999)
      10 - access("ITA1"."ITA_NODE_ID"=3111 AND "ITM2"."ITM_ID"="ITA1"."ITA_VALUE_NUMERIC" AND "ITA1"."ITA_NEXT_VERSION_ID">=999999999
                  AND "ITA1"."ITA_VERSION_ID"<=999999999)
           filter("ITA1"."ITA_VERSION_ID"<=999999999)
      11 - access("ITA1"."ITA_ITEM_ID"="ITM1"."ITM_ID" AND "ITM1"."ITM_NEXT_VERSION_ID">=999999999 AND "ITM1"."ITM_CONTAINER_ID"=2812 AND
                  "ITM1"."ITM_VERSION_ID"<=999999999)
           filter(("ITM1"."ITM_CONTAINER_ID"=2812 AND "ITM1"."ITM_VERSION_ID"<=999999999))
      12 - access("ITA2"."ITA_ITEM_ID"="ITM1"."ITM_ID" AND "ITA2"."ITA_NEXT_VERSION_ID">=999999999 AND "ITA2"."ITA_NODE_ID"=3118 AND
                  "ITA2"."ITA_VERSION_ID"<=999999999)
           filter(("ITA2"."ITA_NODE_ID"=3118 AND "ITA2"."ITA_VERSION_ID"<=999999999))
    Note
       - dynamic sampling used for this statement
    54 rows selected.
    Elapsed: 00:00:00.04Display_cursor with statistics
    SQL> @disp-cursor
                           756
    Elapsed: 00:01:57.53
    SQL_ID  d9q6j48ns19zv, child number 0
    select /*+ gather_plan_statistics */ count(distinct itm1.itm_id)   FROM ita ita1, ita ita2, itm itm1, itm itm2, itm
    itm3 where itm1.itm_container_id = 2812      and itm1.itm_version_id <= 999999999      and itm1.itm_next_version_id
    = 999999999 and itm2.itm_primary_key = 'RAYBESTOS' and itm3.itm_primary_key = '1' andita1.ita_node_id = 3111      and itm2.itm_container_id = 2020      and ita1.ita_item_id = itm1.itm_id      and
    ita1.ita_version_id <= 999999999      and ita1.ita_next_version_id >= 999999999      and itm2.itm_id =
    ita1.ita_value_numeric      and itm2.itm_version_id <= 999999999      and itm2.itm_next_version_id >= 999999999
    and ita2.ita_node_id = 3118      and itm3.itm_container_id = 2025      and ita2.ita_item_id = itm1.itm_id      and
    ita2.ita_version_id <= 999999999      and ita2.ita_next_version_id >= 999999999      and itm3.itm_id =
    ita2.ita_value_numeric      and itm3.itm_version_id <= 999999999      and itm3.itm_next_version_id >= 999999999
    Plan hash value: 332134648
    | Id  | Operation                | Name       | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    |   1 |  SORT GROUP BY           |            |      1 |      1 |      1 |00:01:54.75 |    3041K| 73728 | 73728 |          |
    |   2 |   NESTED LOOPS           |            |      1 |      1 |    756 |00:00:30.95 |    3041K|       |       |          |
    |   3 |    NESTED LOOPS          |            |      1 |      1 |  34939 |00:00:02.73 |   71818 |       |       |          |
    |   4 |     NESTED LOOPS         |            |      1 |      1 |  35695 |00:00:00.75 |     230 |       |       |          |
    |   5 |      MERGE JOIN CARTESIAN|            |      1 |      1 |      1 |00:00:00.01 |       6 |       |       |          |
    |*  6 |       INDEX RANGE SCAN   | ICTG_ITM_1 |      1 |      1 |      1 |00:00:00.01 |       3 |       |       |          |
    |   7 |       BUFFER SORT        |            |      1 |      1 |      1 |00:00:00.01 |       3 | 73728 | 73728 |          |
    |*  8 |        INDEX RANGE SCAN  | ICTG_ITM_1 |      1 |      1 |      1 |00:00:00.01 |       3 |       |       |          |
    |*  9 |      INDEX RANGE SCAN    | ICTG_ITA_1 |      1 |      1 |  35695 |00:00:00.32 |     224 |       |       |          |
    |* 10 |     INDEX RANGE SCAN     | ICTG_ITM_0 |  35695 |      1 |  34939 |00:00:01.19 |   71588 |       |       |          |
    |* 11 |    INDEX RANGE SCAN      | ICTG_ITA_1 |  34939 |      1 |    756 |00:01:52.76 |    2969K|       |       |          |
    Predicate Information (identified by operation id):
       6 - access("ITM3"."ITM_PRIMARY_KEY"='1' AND "ITM3"."ITM_CONTAINER_ID"=2025 AND
                  "ITM3"."ITM_NEXT_VERSION_ID">=999999999 AND "ITM3"."ITM_VERSION_ID"<=999999999)
           filter("ITM3"."ITM_VERSION_ID"<=999999999)
       8 - access("ITM2"."ITM_PRIMARY_KEY"='RAYBESTOS' AND "ITM2"."ITM_CONTAINER_ID"=2020 AND
                  "ITM2"."ITM_NEXT_VERSION_ID">=999999999 AND "ITM2"."ITM_VERSION_ID"<=999999999)
           filter("ITM2"."ITM_VERSION_ID"<=999999999)
       9 - access("ITA1"."ITA_NODE_ID"=3111 AND "ITM2"."ITM_ID"="ITA1"."ITA_VALUE_NUMERIC" AND
                  "ITA1"."ITA_NEXT_VERSION_ID">=999999999 AND "ITA1"."ITA_VERSION_ID"<=999999999)
           filter(("ITA1"."ITA_VALUE_NUMERIC" IS NOT NULL AND "ITA1"."ITA_VERSION_ID"<=999999999))
      10 - access("ITA1"."ITA_ITEM_ID"="ITM1"."ITM_ID" AND "ITM1"."ITM_NEXT_VERSION_ID">=999999999 AND
                  "ITM1"."ITM_CONTAINER_ID"=2812 AND "ITM1"."ITM_VERSION_ID"<=999999999)
           filter(("ITM1"."ITM_CONTAINER_ID"=2812 AND "ITM1"."ITM_VERSION_ID"<=999999999))
      11 - access("ITA2"."ITA_NODE_ID"=3118 AND "ITM3"."ITM_ID"="ITA2"."ITA_VALUE_NUMERIC" AND
                  "ITA2"."ITA_NEXT_VERSION_ID">=999999999 AND "ITA2"."ITA_ITEM_ID"="ITM1"."ITM_ID" AND
                  "ITA2"."ITA_VERSION_ID"<=999999999)
           filter(("ITA2"."ITA_VALUE_NUMERIC" IS NOT NULL AND "ITA2"."ITA_VERSION_ID"<=999999999 AND
                  "ITA2"."ITA_ITEM_ID"="ITM1"."ITM_ID"))
    51 rows selected.
    Elapsed: 00:00:00.28

  • SECURITY query running slow with Prompts!!

    Hello All,
    Version: PeopleSoft HRMS 9 with PeopleTools 8.49.09
    DB Version: 10.2.0.3 (Oracle)
    My client is running a security query, given below, with and without prompts. Without prompts it is completing in 35 seconds but with prompts (even if the values in the prompts are blank!), the query is taking more than 4-5 hours but not completing!!
    SELECT /*+ OPT_PARAM('_optimizer_mjc_enabled', 'false')
    opt_param('_optimizer_cartesian_enabled', 'false') opt_param('optimizer_index_caching', 0) opt_param('optimizer_index_cost_adj', 0)*/ B.OPRID, A.EMPLID, A.PWCUK_LEGACY_ID, A.NAME, A.EMPL_STATUS, A.EMPL_CLASS,
    to_char(to_date( TO_CHAR(A.HIRE_DT, 'YYYY-MM-DD'), 'yyyy-mm-dd'), 'dd/mm/yyyy'),
    to_char(to_date(decode( TO_CHAR(A.REHIRE_DT, 'YYYY-MM-DD'), '',
    TO_CHAR(A.HIRE_DT, 'YYYY-MM-DD'), TO_CHAR(A.REHIRE_DT, 'YYYY-MM-DD')), 'yyyy-mm-dd'), 'dd/mm/yyyy'),
    to_char(to_date( TO_CHAR(A.TERMINATION_DT, 'YYYY-MM-DD'), 'yyyy-mm-dd'), 'dd/mm/yyyy'), A.DEPTID, A.DEPT_DESCR, A.PWCUK_BUSINESSUNIT, A.PWCUK_BU_DESCR, A.PWCUK_SUBREGION, A.PWCUK_SR_DESCR,
    A.PWCUK_REGION, A.PWCUK_R_DESCR, B.ROWSECCLASS, E.CLASSDEFNDESC, C.ROLENAME, D.DESCR,
    Case C.ROLENAME When 'UK_OTG_Query_Access' then 'Y' When 'UK_Self_Service_Query_Access' then 'Y' When 'UK_Prtner_Affairs_Query_Acces' then 'Y' When 'UK_SelfServ_Sens_Basic_Query' then 'Y' When 'UK_ESC_Extra_Query_Access' then 'Y' When 'UK_BCI_Query_Access' then 'Y' When 'UK_Self_Service_Non_Sens_Q Acc' then 'Y' Else 'N' END, TO_CHAR(A.EFFDT, 'YYYY-MM-DD'),
    TO_CHAR(A.EFFDT, 'YYYY-MM-DD'), D.ROLENAME FROM PS_PWCUK_EMP_C_VW A, PS_PERS_SRCH_QRY A1, PSOPRDEFN B, PS_ROLEU SER_VW C, PSROLEDEFN D, PSCLASSDEFN E WHERE A.EMPLID = A1.EMPLID
    AND A1.OPRID = 'kcooper001a' AND ( B.OPRID = A.PWCE_GUID AND B.OPRID = C.OPRID AND C.ROLENAME NOT IN ('Orbit User', 'PWCUK_LOS_ADMIN_PLANNER', 'Query Designer', 'Query User', 'PWCE_EMEA_AUDIT_RLE_NO_BSE_TBL', 'PWCE_REPORT_DIST', 'EOPP_USER', 'PAPP_USER', 'PWCUK_XMLP_REPORT_DEVELOPER', 'GBR_PEOPLE_MANAGER_CONFIG_UPD', 'PWCUK_EX_EMPLOYEE', 'ReportSuperUser', 'PWCE JOBCODE LOAD UTILITY',
    'PWCE EMPLOYEE RVW LOAD ACCESS', 'PwCE Bonus Upload Access', 'GBR_EP_SYSADMIN') AND ( C.ROLENAME NOT LIKE 'PWCUK_EP%' OR C.ROLENAME = 'PWCUK_EP_ADMIN') AND C.ROLENAME NOT LIKE 'PWCUK_SP%' AND C.ROLENAME NOT LIKE 'GBR_PMGR%' AND 0 < INSTR(:1, decode(trim(:2), null, ' ', B.OPRID)) AND 0 < INSTR(:3, decode(trim(:4), null, ' ', B.EMPLID)) AND 0 < INSTR(:5, decode(trim(:6), null, ' ', A.PWCUK_LEGACY_ID)) A
    ND 0 < INSTR(:7, decode(trim(:8), null, ' ', C.ROLENAME)) AND 0 < INSTR(:9, decode(trim(:10), null, ' ', E.CLASSID)) AND C.ROLENAME = D.ROLENAME AND E.CLASSID = B.ROWSECCLASS ) ORDER BY 4, 20Below are some more useful information I have gathered from DB level for this query:
    +--------------------------------------------------------------------------------------------------+
    |Plan HV     Min Snap  Max Snap  Execs       LIO            PIO            CPU         Elapsed     |
    +--------------------------------------------------------------------------------------------------+
    |770792495   39602     39747     5           1,181,648,326  6,823          7,433.93    7,481.60    |
    +--------------------------------------------------------------------------------------------------+
    ========== PHV = 770792495==========
    First seen from "10/19/12 10:00:44" (snap #39602)
    Last seen from  "10/25/12 11:00:28" (snap #39747)
    Execs          LIO            PIO            CPU            Elapsed
    =====          ===            ===            ===            =======
    5              1,181,648,326  6,823          7,433.93       7,481.60
    Plan hash value: 770792495
    | Id  | Operation                           | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                    |                    |       |       |    35 (100)|          |
    |   1 |  SORT ORDER BY                      |                    |     1 |   645 |    35   (6)| 00:00:01 |
    |   2 |   NESTED LOOPS                      |                    |     1 |   645 |    34   (3)| 00:00:01 |
    |   3 |    NESTED LOOPS                     |                    |     6 |  1122 |    10  (10)| 00:00:01 |
    |   4 |     NESTED LOOPS                    |                    |     1 |   165 |     5   (0)| 00:00:01 |
    |   5 |      NESTED LOOPS                   |                    |     1 |   122 |     4   (0)| 00:00:01 |
    |   6 |       NESTED LOOPS                  |                    |     1 |    81 |     3   (0)| 00:00:01 |
    |   7 |        NESTED LOOPS                 |                    |   552 | 29256 |     2   (0)| 00:00:01 |
    |   8 |         INDEX FULL SCAN             | PSAPSROLEUSER      |   550 | 15950 |     1   (0)| 00:00:01 |
    |   9 |         TABLE ACCESS BY INDEX ROWID | PS_ROLEXLATOPR     |     1 |    24 |     1   (0)| 00:00:01 |
    |  10 |          INDEX UNIQUE SCAN          | PS_ROLEXLATOPR     |     1 |       |     1   (0)| 00:00:01 |
    |  11 |        TABLE ACCESS BY INDEX ROWID  | PSOPRDEFN          |     1 |    28 |     1   (0)| 00:00:01 |
    |  12 |         INDEX UNIQUE SCAN           | PS_PSOPRDEFN       |     1 |       |     1   (0)| 00:00:01 |
    |  13 |       TABLE ACCESS BY INDEX ROWID   | PSCLASSDEFN        |     1 |    41 |     1   (0)| 00:00:01 |
    |  14 |        INDEX UNIQUE SCAN            | PS_PSCLASSDEFN     |     1 |       |     1   (0)| 00:00:01 |
    |  15 |      TABLE ACCESS BY INDEX ROWID    | PSROLEDEFN         |     1 |    43 |     1   (0)| 00:00:01 |
    |  16 |       INDEX UNIQUE SCAN             | PS_PSROLEDEFN      |     1 |       |     1   (0)| 00:00:01 |
    |  17 |     VIEW                            | PS_PERS_SRCH_QRY   |   483 | 10626 |     5  (20)| 00:00:01 |
    |  18 |      SORT UNIQUE                    |                    |   483 | 62790 |     5  (20)| 00:00:01 |
    |  19 |       NESTED LOOPS                  |                    |   483 | 62790 |     4   (0)| 00:00:01 |
    |  20 |        NESTED LOOPS                 |                    |   483 | 49749 |     3   (0)| 00:00:01 |
    |  21 |         NESTED LOOPS                |                    |     1 |    67 |     2   (0)| 00:00:01 |
    |  22 |          TABLE ACCESS BY INDEX ROWID| PSOPRDEFN          |     1 |    40 |     1   (0)| 00:00:01 |
    |  23 |           INDEX UNIQUE SCAN         | PS_PSOPRDEFN       |     1 |       |     1   (0)| 00:00:01 |
    |  24 |          TABLE ACCESS BY INDEX ROWID| PS_SJT_OPR_CLS     |     1 |    27 |     1   (0)| 00:00:01 |
    |  25 |           INDEX RANGE SCAN          | PS_SJT_OPR_CLS     |     1 |       |     1   (0)| 00:00:01 |
    |  26 |         TABLE ACCESS BY INDEX ROWID | PS_SJT_CLASS_ALL   |   482 | 17352 |     1   (0)| 00:00:01 |
    |  27 |          INDEX RANGE SCAN           | PS_SJT_CLASS_ALL   |  1158 |       |     1   (0)| 00:00:01 |
    |  28 |        INDEX RANGE SCAN             | PS_SJT_PERSON      |     1 |    27 |     1   (0)| 00:00:01 |
    |  29 |    VIEW                             | PS_PWCUK_EMP_C_VW  |     1 |   458 |     4   (0)| 00:00:01 |
    |  30 |     UNION ALL PUSHED PREDICATE      |                    |       |       |            |          |
    |  31 |      TABLE ACCESS BY INDEX ROWID    | PS_PWCUK_EMPLOYEES |     1 |   169 |     1   (0)| 00:00:01 |
    |  32 |       INDEX RANGE SCAN              | PS_PWCUK_EMPLOYEES |     1 |       |     1   (0)| 00:00:01 |
    |  33 |      FILTER                         |                    |       |       |            |          |
    |  34 |       NESTED LOOPS OUTER            |                    |     1 |   220 |     3   (0)| 00:00:01 |
    |  35 |        NESTED LOOPS OUTER           |                    |     1 |   208 |     2   (0)| 00:00:01 |
    |  36 |         TABLE ACCESS BY INDEX ROWID | PS_PWCUK_EX_EMPLS  |     1 |   161 |     1   (0)| 00:00:01 |
    |  37 |          INDEX RANGE SCAN           | PS_PWCUK_EX_EMPLS  |     1 |       |     1   (0)| 00:00:01 |
    |  38 |         TABLE ACCESS BY INDEX ROWID | PS_PWCE_EP_ROLES   |     1 |    47 |     1   (0)| 00:00:01 |
    |  39 |          INDEX RANGE SCAN           | PS_PWCE_EP_ROLES   |     1 |       |     1   (0)| 00:00:01 |
    |  40 |        INDEX RANGE SCAN             | PS_PWCUK_EMPLOYEES |     1 |    12 |     1   (0)| 00:00:01 |
    |  41 |       SORT AGGREGATE                |                    |     1 |    23 |            |          |
    |  42 |        INDEX RANGE SCAN             | PS_PWCE_EP_ROLES   |     1 |    23 |     1   (0)| 00:00:01 |
                                                  Summary Execution Statistics Over Time
                                                                                  Avg                 Avg
    Snapshot                          Avg LIO             Avg PIO          CPU (secs)      Elapsed (secs)
    Time            Execs            Per Exec            Per Exec            Per Exec            Per Exec
    19-OCT 10:00        1      374,309,812.00            1,469.00            2,286.32            2,291.32
    25-OCT 10:00        3       86,033,085.00            1,567.67              543.68              546.11
    25-OCT 11:00        1      549,239,259.00              651.00            3,516.56            3,551.96
    avg                        336,527,385.33            1,229.22            2,115.52            2,129.80
    sum                 5
                                                  Per-Plan Execution Statistics Over Time
                                                                                             Avg                 Avg
          Plan Snapshot                          Avg LIO             Avg PIO          CPU (secs)      Elapsed (secs)
    Hash Value Time            Execs            Per Exec            Per Exec            Per Exec            Per Exec
    770792495 19-OCT 10:00        1      374,309,812.00            1,469.00            2,286.32            2,291.32
               25-OCT 10:00        3       86,033,085.00            1,567.67              543.68              546.11
               25-OCT 11:00        1      549,239,259.00              651.00            3,516.56            3,551.96
    avg                                   336,527,385.33            1,229.22            2,115.52            2,129.80
    sum                            5I'm not at all proficient in PeopleSoft.
    Please advice how we can get faster runs for this query.
    Note: We have already checked all other possibilities, like network, application, web services, etc, and they look normal.
    Thanks,
    Suddhasatwa

    If the hints are there only for the "cost", then I'm sorry to say, but they are useless. Did you say that was not efficient to the Oracle Support ?
    I asked earlier if that query already ran in a reasonnable time, is it the case, or always took that time ? Is it a change of behaviour after a db upgrade ?
    Have you tried to work with AWR snapshots with a short gap in between ? I mean between the AWR snapshots (every 15 minutes or so), not between the runs of the query.
    If there's no values for the bind variables, I assume this is what you mean when you said "no prompts", then Oracle can go much faster because of the few (or no?) data repartition to retrieve.
    However, when given values to some (all?) of the bind variables, then all the problem will be on the data repartition. That's why I was asking how you gathered statistics on the involved objects, in other words, the histograms may be wrong somehow.
    There's a lot of litterature on this, have a look to the Jonathan Lewis blog for more information.
    Anyway, I think there's not enough information here and does not look easy to work on it in that state from the other side of the network.
    Nicolas.

  • How to set a sql query time out with jdbc:oracle:thin

    should i change the JDBC driver with jdbc:oralce:XA:thin or other driver with XA?

    SQL query timeout may be set with setQueryTimeout.
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#setQueryTimeout(int)
    A query timeout bug is fixed in Oracle JDBC Drivers release
    10.1.0.2.0 (10g)
    FIXED BUG-2249191
    In the Server Internal Driver, setting the query timeout does not
    +(and likely will never) work. The query execution will not be+
    canceled when the timeout expires, even if the query runs forever.
    Further, after the query returns, the execution of your code
    may pause for the length of the timeout.
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_readme101020.html

  • What can I do to make this query run faster

    Hi All,
    The below query is taking a long time. Is there any thing that I can do to shorten its time.
    SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E     where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) = TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
    SQL>
    SQL> show parameter user_dump_dest
    NAME                                 TYPE        VALUE
    user_dump_dest                       string      /u01/app/oracle/diag/rdbms/ebi
    zfile/EBIZFILE1/trace
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.2.0.2
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUE
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     128
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL> select
      2  sname, pname, pval1, pval2
      3  from
      4  sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          09-11-2010 14:25
    SYSSTATS_INFO        DSTOP                           09-11-2010 14:25
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW           739.734748
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.
    Elapsed: 00:00:00.06
    SQL>
    SQL> explain plan for
      2  SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when  decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when  decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E     where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) =  TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
    Explained.
    Elapsed: 00:00:00.09
    SQL>
    SQL> set pagesize 1000;
    SQL> set linesize 170;
    SQL> @/u01/app/oracle/product/11.2.0/rdbms/admin/utlxpls.sql
    SQL> Rem
    SQL> Rem $Header: utlxpls.sql 26-feb-2002.19:49:37 bdagevil Exp $
    SQL> Rem
    SQL> Rem utlxpls.sql
    SQL> Rem
    SQL> Rem Copyright (c) 1998, 2002, Oracle Corporation.     All rights reserved.
    SQL> Rem
    SQL> Rem    NAME
    SQL> Rem      utlxpls.sql - UTiLity eXPLain Serial plans
    SQL> Rem
    SQL> Rem    DESCRIPTION
    SQL> Rem      script utility to display the explain plan of the last explain plan
    SQL> Rem      command. Do not display information related to Parallel Query
    SQL> Rem
    SQL> Rem    NOTES
    SQL> Rem      Assume that the PLAN_TABLE table has been created. The script
    SQL> Rem      utlxplan.sql should be used to create that table
    SQL> Rem
    SQL> Rem      With SQL*plus, it is recomended to set linesize and pagesize before
    SQL> Rem      running this script. For example:
    SQL> Rem      set linesize 100
    SQL> Rem      set pagesize 0
    SQL> Rem
    SQL> Rem    MODIFIED   (MM/DD/YY)
    SQL> Rem    bdagevil     02/26/02 - cast arguments
    SQL> Rem    bdagevil     01/23/02 - rewrite with new dbms_xplan package
    SQL> Rem    bdagevil     04/05/01 - include CPU cost
    SQL> Rem    bdagevil     02/27/01 - increase Name column
    SQL> Rem    jihuang     06/14/00 - change order by to order siblings by.
    SQL> Rem    jihuang     05/10/00 - include plan info for recursive SQL in LE row source
    SQL> Rem    bdagevil     01/05/00 - add order-by to make it deterministic
    SQL> Rem    kquinn     06/28/99 - 901272: Add missing semicolon
    SQL> Rem    bdagevil     05/07/98 - Explain plan script for serial plans
    SQL> Rem    bdagevil     05/07/98 - Created
    SQL> Rem
    SQL>
    SQL> set markup html preformat on
    SQL>
    SQL> Rem
    SQL> Rem Use the display table function from the dbms_xplan package to display the last
    SQL> Rem explain plan. Force serial option for backward compatibility
    SQL> Rem
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
    PLAN_TABLE_OUTPUT
    Plan hash value: 2520189693
    | Id  | Operation                         | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                  |                         |   592 | 85248 | 16573   (1)| 00:03:19 |
    |   1 |  TABLE ACCESS BY INDEX ROWID      | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX UNIQUE SCAN               | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   3 |  TABLE ACCESS BY INDEX ROWID      | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  4 |   INDEX UNIQUE SCAN               | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   5 |   TABLE ACCESS BY INDEX ROWID     | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  6 |    INDEX UNIQUE SCAN              | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   7 |  SORT ORDER BY                    |                         |   592 | 85248 | 16573   (1)| 00:03:19 |
    |   8 |   NESTED LOOPS                    |                         |       |       |            |          |
    |   9 |    NESTED LOOPS                   |                         |   592 | 85248 | 16572   (1)| 00:03:19 |
    |  10 |     NESTED LOOPS OUTER            |                         |   477 | 54855 | 15329   (1)| 00:03:04 |
    |  11 |      NESTED LOOPS OUTER           |                         |   477 | 41499 | 14374   (1)| 00:02:53 |
    |  12 |       INLIST ITERATOR             |                         |       |       |            |          |
    |* 13 |        TABLE ACCESS BY INDEX ROWID| CO_TRANS_MASTER         |   477 | 22896 | 14367   (1)| 00:02:53 |
    |* 14 |         INDEX RANGE SCAN          | IDX_CO_TRANS_ID         | 67751 |       |   150   (1)| 00:00:02 |
    |  15 |       TABLE ACCESS BY INDEX ROWID | SC_AGENT_EMP            |     1 |    39 |     1   (0)| 00:00:01 |
    |* 16 |        INDEX UNIQUE SCAN          | PK_SC_AGENT_EMP         |     1 |       |     0   (0)| 00:00:01 |
    |  17 |      TABLE ACCESS BY INDEX ROWID  | PEOPLE_PROFILE          |     1 |    28 |     2   (0)| 00:00:01 |
    |* 18 |       INDEX UNIQUE SCAN           | SYS_C0063100            |     1 |       |     1   (0)| 00:00:01 |
    |* 19 |     INDEX RANGE SCAN              | IDX_PAY_DETAIL_TRANS_NO |     1 |       |     2   (0)| 00:00:01 |
    |  20 |    TABLE ACCESS BY INDEX ROWID    | PAYMENT_DETAIL          |     1 |    29 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("F"."CO_TRANS_NO"=:B1)
       4 - access("F"."CO_TRANS_NO"=:B1)
       6 - access("F"."CO_TRANS_NO"=:B1)
      13 - filter(TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL
                  OR "SYS_ALIAS_3"."VOID_IND"='N'))
      14 - access("SYS_ALIAS_3"."CO_TRANS_ID"='A020' OR "SYS_ALIAS_3"."CO_TRANS_ID"='AR03' OR
                  "SYS_ALIAS_3"."CO_TRANS_ID"='AR20')
      16 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO"(+) AND
                  "SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID"(+))
      18 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID"(+))
      19 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
    42 rows selected.
    Elapsed: 00:00:00.53
    SQL>
    SQL>
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.01
    SQL>
    SQL> rem Set the ARRAYSIZE according to your application
    SQL> set autotrace traceonly arraysize 100
    SQL>
    SQL> alter session set tracefile_identifier = 'mytrace1';
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    SQL> rem if you're using bind variables
    SQL> rem define them here
    SQL>
    SQL> rem variable b_var1 number
    SQL> rem variable b_var2 varchar2(20)
    SQL>
    SQL> rem and initialize them
    SQL>
    SQL> rem exec :b_var1 := 1
    SQL> rem exec :b_var2 := 'DIAG'
    SQL> set pagesize 1000;
    SQL> set linesize 170;
    SQL> alter session set events '10046 trace name context forever, level 8';
    Session altered.
    Elapsed: 00:00:00.01
    SQL> SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when  decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when  decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E     where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) =  TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
    10 rows selected.
    Elapsed: 00:03:42.27
    Execution Plan
    Plan hash value: 2520189693
    | Id  | Operation                         | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                  |                         |   592 | 85248 | 16573   (1)| 00:03:19 |
    |   1 |  TABLE ACCESS BY INDEX ROWID      | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX UNIQUE SCAN               | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   3 |  TABLE ACCESS BY INDEX ROWID      | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  4 |   INDEX UNIQUE SCAN               | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   5 |   TABLE ACCESS BY INDEX ROWID     | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  6 |    INDEX UNIQUE SCAN              | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   7 |  SORT ORDER BY                    |                         |   592 | 85248 | 16573   (1)| 00:03:19 |
    |   8 |   NESTED LOOPS                    |                         |       |       |            |          |
    |   9 |    NESTED LOOPS                   |                         |   592 | 85248 | 16572   (1)| 00:03:19 |
    |  10 |     NESTED LOOPS OUTER            |                         |   477 | 54855 | 15329   (1)| 00:03:04 |
    |  11 |      NESTED LOOPS OUTER           |                         |   477 | 41499 | 14374   (1)| 00:02:53 |
    |  12 |       INLIST ITERATOR             |                         |       |       |            |          |
    |* 13 |        TABLE ACCESS BY INDEX ROWID| CO_TRANS_MASTER         |   477 | 22896 | 14367   (1)| 00:02:53 |
    |* 14 |         INDEX RANGE SCAN          | IDX_CO_TRANS_ID         | 67751 |       |   150   (1)| 00:00:02 |
    |  15 |       TABLE ACCESS BY INDEX ROWID | SC_AGENT_EMP            |     1 |    39 |     1   (0)| 00:00:01 |
    |* 16 |        INDEX UNIQUE SCAN          | PK_SC_AGENT_EMP         |     1 |       |     0   (0)| 00:00:01 |
    |  17 |      TABLE ACCESS BY INDEX ROWID  | PEOPLE_PROFILE          |     1 |    28 |     2   (0)| 00:00:01 |
    |* 18 |       INDEX UNIQUE SCAN           | SYS_C0063100            |     1 |       |     1   (0)| 00:00:01 |
    |* 19 |     INDEX RANGE SCAN              | IDX_PAY_DETAIL_TRANS_NO |     1 |       |     2   (0)| 00:00:01 |
    |  20 |    TABLE ACCESS BY INDEX ROWID    | PAYMENT_DETAIL          |     1 |    29 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("F"."CO_TRANS_NO"=:B1)
       4 - access("F"."CO_TRANS_NO"=:B1)
       6 - access("F"."CO_TRANS_NO"=:B1)
      13 - filter(TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL
                  OR "SYS_ALIAS_3"."VOID_IND"='N'))
      14 - access("SYS_ALIAS_3"."CO_TRANS_ID"='A020' OR "SYS_ALIAS_3"."CO_TRANS_ID"='AR03' OR
                  "SYS_ALIAS_3"."CO_TRANS_ID"='AR20')
      16 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO"(+) AND
                  "SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID"(+))
      18 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID"(+))
      19 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
    Statistics
             51  recursive calls
              0  db block gets
         651812  consistent gets
          92202  physical reads
              0  redo size
           1594  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             10  rows processed
    SQL>
    SQL> disconnect
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Testing options
    SQL> Thanks in advance!

    Hi Raj,
    I have given the output below as you requested....
    QL>  select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  0taz7ckjm41yv, child number 1
    SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE,
    'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME)
    LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID),
    Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID))
    DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select
    nvl(base_trans_id,co_trans_id) from co_form5a_trans f where
    f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when
    decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from
    co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR2
    0' then 1 when  decode(c.co_trans_id,'A020',(select
    nvl(base_trans_id,co_trans_id) from co_form5a_trans f where
    f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end)
    TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP,
    SC_AGENT_EMP D, M_CAA_TRANS E where '1' <> TRIM(UPPER('S0750070Z')) and
    (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in
    TRIM(UPPER('AR03'))OR c.co
    Plan hash value: 4175354585
    | Id  | Operation                        | Name                    | E-Rows |  OMem |  1Mem | Used-Mem |
    |   0 | SELECT STATEMENT                 |                         |        |       |       |          |
    |   1 |  TABLE ACCESS BY INDEX ROWID     | CO_FORM5A_TRANS         |      1 |       |       |          |
    |*  2 |   INDEX UNIQUE SCAN              | SYS_C0059692            |      1 |       |       |          |
    |   3 |  TABLE ACCESS BY INDEX ROWID     | CO_FORM5A_TRANS         |      1 |       |       |          |
    |*  4 |   INDEX UNIQUE SCAN              | SYS_C0059692            |      1 |       |       |          |
    |   5 |   TABLE ACCESS BY INDEX ROWID    | CO_FORM5A_TRANS         |      1 |       |       |          |
    |*  6 |    INDEX UNIQUE SCAN             | SYS_C0059692            |      1 |       |       |          |
    |   7 |  SORT ORDER BY                   |                         |     12 |  2048 |  2048 | 2048  (0)|
    |   8 |   NESTED LOOPS                   |                         |        |       |       |          |
    |   9 |    NESTED LOOPS                  |                         |     12 |       |       |          |
    |  10 |     NESTED LOOPS OUTER           |                         |     10 |       |       |          |
    |  11 |      NESTED LOOPS OUTER          |                         |     10 |       |       |          |
    |* 12 |       TABLE ACCESS FULL          | CO_TRANS_MASTER         |     10 |       |       |          |
    |  13 |       TABLE ACCESS BY INDEX ROWID| SC_AGENT_EMP            |      1 |       |       |          |
    |* 14 |        INDEX UNIQUE SCAN         | PK_SC_AGENT_EMP         |      1 |       |       |          |
    |  15 |      TABLE ACCESS BY INDEX ROWID | PEOPLE_PROFILE          |      1 |       |       |          |
    |* 16 |       INDEX UNIQUE SCAN          | SYS_C0063100            |      1 |       |       |          |
    |* 17 |     INDEX RANGE SCAN             | IDX_PAY_DETAIL_TRANS_NO |      1 |       |       |          |
    |  18 |    TABLE ACCESS BY INDEX ROWID   | PAYMENT_DETAIL          |      1 |       |       |          |
    Predicate Information (identified by operation id):
       2 - access("F"."CO_TRANS_NO"=:B1)
       4 - access("F"."CO_TRANS_NO"=:B1)
       6 - access("F"."CO_TRANS_NO"=:B1)
      12 - filter((INTERNAL_FUNCTION("SYS_ALIAS_3"."CO_TRANS_ID") AND
                  TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL OR
                  "SYS_ALIAS_3"."VOID_IND"='N')))
      14 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO" AND "SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID")
      16 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID")
      17 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
    Note
       - cardinality feedback used for this statement
       - Warning: basic plan statistics not available. These are only collected when:
           * hint 'gather_plan_statistics' is used for the statement or
           * parameter 'statistics_level' is set to 'ALL', at session or system level
    65 rows selected.

Maybe you are looking for

  • Import Manager MDM 3.0 Updating old Maps

    Dear MDM Catalog gurus, After having upgraded from MDM 2.0 to MDM 3.0 the maps have to be updated in Import Manager. 1. When trying to update MDM import Maps in the new "SAP Import Manager" messages like - "There are multiple roots for the XML Schema

  • Firefox won't go

    When I had Firefox 3.6, whenever I would enter in a letter, there was a drop down menu that would appear below the search bar. If I found the thing I want, I was able to click on it, and Firefox would go directly to the page, no other clicks required

  • JApplet and the Images --PLEASE reply fast

    the problem is i am trying to put a .gif image into JApplet. no matter what i do it just DOESNT WANNA WORK! can anyone please post an example of working one?

  • I have purchase at nokia E6 PHONE .

    HELLO SIR lot off intrest purchase at nokia e6 but few problem read at website divert my mind  notification light  back light bluetooth wifi connection problem slow volume at ring tone  pls help me purchase at new nokia e6 phone  solve this problem ?

  • Copy contacts from memory card to BB

    Hi!  I just got my blackberry curve 9300 and i'd like to know if it is possible to copy my contacts from Memory Card to BB or would I need a PC/laptop for this function?  I've been trying to find the copy finctions for this but could'nt get any on th