Does bigger explain plan in TKPROF output indicate something wrong with SQL

We were tracing some database sessions.
Using TKPROF we were able to read the trace file.
we have noticed that some of the SQL ( 1-2 lines SQL statements) were showing up atleast
150 lines of explain plan.
So we realized that the sql statements are badly written.
Based on that above can we come into the following conclusion:
- for 1-2 lines of SQL Statement if there is 100+ lines of explain plan in TKPROF report, it indicates the SQL statement
is wrongly written ?

johnpau2013 wrote:
We were tracing some database sessions.
Using TKPROF we were able to read the trace file.
we have noticed that some of the SQL ( 1-2 lines SQL statements) were showing up atleast
150 lines of explain plan.
So we realized that the sql statements are badly written.
Based on that above can we come into the following conclusion:
- for 1-2 lines of SQL Statement if there is 100+ lines of explain plan in TKPROF report, it indicates the SQL statement
is wrongly written ?The only rule that is always true for tuning SQL, is that NO rule is ALWAYS true for every SQL statement &
every data distribution.
it depends
post actual example, so we can see what you see.

Similar Messages

  • My FaceTime is active but it does not connect. Any one know what is wrong with it or how to solve the problem?

    My FaceTime is active but it does not connect. Any one know what is wrong with it or how to solve the problem?

    Please sign out of FaceTime and sign back in. If there's no change, log out or restart the computer and try again.

  • Explain Plan from TKPROF trace file.

    Hello,
    My procedure is taking time for that i have trace on in procedure fo find explain plan of particular query.
    Using below statement Trace is on.
       EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE = TRUE';
       EXECUTE IMMEDIATE 'ALTER SESSION SET TIMED_STATISTICS = TRUE';Now for getting expalin plan from TKPROF i have used below statement but for some query i have found explain paln and some case i cant found explain plan.
    tkprof mf_ora_23773.trc mf_ora_23773.txt explain =abc/abc
    can u please help me to analyze where i m wrong?
    Thanks.

    First of all, you should best avoid using the explain= clause on the tkprof command line.
    This will run explain plan on the statement in the trace file, and that explain plan can even be wrong, as there is no information on datatypes in the trace file.
    The real explain plan data is flushed to the trace file, when the program issues commit or rollback. Oracle always issues an implicit commit when the program disconnects, so when you run the program to completion you should have explain plan output in your trace files.
    You won't get explain plan output if you don't have access to the objects in the SQL statement. Also recursive SQL won't produce explain plan result.
    One would need to see part of your trace file to verify your assertion the explain clause doesn't always work.
    Sybrand Bakker
    Senior Oracle DBA

  • Explain Plan for a simple join seems wrong

    I have been investigating some performance issues and I have discovered that a seemingly simple join generates a counter-intuitive execution plan.
    I have two tables, one of which represents users and the other of which represents learning activity transcripts (courses). Each user can have many transcripts. The transcripts each contain the user id of the user. The query provides the primary key of the transcript.
    There are 124853 users 148894 transcripts in the database.
    The plan I expect is to look up the transcript, find the user id, then look up the user. What I get is an index scan of the user table, apparently probing the index of the transcript table for each entry in the user table.
    select U.userLocale
    FROM DRUser U, DRLearningActivityTranscript LATF
    WHERE LATF.userID = U.userID AND LATF.ID=165066;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=3 Card=1 Bytes=14)
    1 0 NESTED LOOPS (Cost=3 Card=1 Bytes=14)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'DRLEARNINGACTIVITYTRANSCRIPT' (Cost=2 Card=1 Bytes=8)
    3 2 INDEX (UNIQUE SCAN) OF 'DRPK13' (UNIQUE) (Cost=1 Card= 2)
    4 1 TABLE ACCESS (BY INDEX ROWID) OF 'DRUSER' (Cost=1 Card=125649 Bytes=753894)
    5 4 INDEX (UNIQUE SCAN) OF 'DRPK1' (UNIQUE)
    Note that DRPK1 is the index on the userid in the user table and DRPK13 is the index on the ID field of the transcript.
    I can get the plan I want if I express the join as a sub-select, but I don't want to do that throughout the application.
    select U.userLocale
    FROM DRUser U
    WHERE U.userID = (SELECT userid FROM DRLearningActivityTranscript WHERE ID = 165066);
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=6)
    1 0 TABLE ACCESS (BY INDEX ROWID) OF 'DRUSER' (Cost=2 Card=1 Bytes=6)
    2 1 INDEX (UNIQUE SCAN) OF 'DRPK1' (UNIQUE) (Cost=1 Card=1)
    3 2 TABLE ACCESS (BY INDEX ROWID) OF 'DRLEARNINGACTIVITYTRANSCRIPT' (Cost=2 Card=1 Bytes=8)
    4 3 INDEX (UNIQUE SCAN) OF 'DRPK13' (UNIQUE) (Cost=1 Card=2)
    Am I just interpreting the plan incorrectly or does it really do what I'm afraid it seems to be doing? I've tried using /*+ RULE */ and other optimizer hints, but I can't get the plan I think I want without rewriting the query as a sub-select.
    Thanks,
    Mark H. Zellers

    Yes, you're misinterpreting the plan. It's work like you want it to. At the same level, the steps are performed top to bottom so that plan is showing:
    1. lookup the id 165066 on the index DPRK13
    2. retrieve the row from DRLEARNINGACTIVITYTRANSCRIPT
    3. lookup the userid ? on the index DPRK1
    4. retrieve the row from DRUSER
    If Oracle was actually starting with the DRUSER table then it would have to HASH or MERGE join those results with the other table (or worse use the userid index). In fact, you can demonstrate this for yourself by just adding an ORDERED hint to that query (SELECT /*+ ORDERED */ ...) and looking at the plan (as well as the horrible performance you should observe).

  • Want output in this way with SQL Query

    I have string "GOOD".
    I am in need of output Like
    G
    O
    O
    D
    Thanks

    select substr('abcdefghijk' ,a,1)
    from (select rownum a
    from dual
    connect by level <= length('abcdefghijk'));

  • Having issue syncing a blue tooth to my itouch. Purchased one and all it does is keep thinking and not syncing with the device have also tryed headsets with microphone and still nothing is there something wrong with my itouch?

    have tryed multipe brands and nothing. Its possible its a first generation itouch which maybe the problem not sure. I also only seem to get about 4hrs of doing anything on my itouch if under constain use is that normal.

    The first generation (1G) iPod does not have bluetooth.
    See:
    iPhone, iPad, iPod touch: Supported Bluetooth profiles
    The short 4 hours is problably due to you battery degrading.

  • My itunes on my macbook pro does not have a "add folder to library option". Is there something wrong with my mac ?, my itunes on my macbook pro does not have a "add folder to library option". Is there something wrong with my mac ?

    I purchased a Mac Book Pro and find the Itunes a bit strange as the "add folder to library" option under the menu is not available
    is my itunes corrupt or what can i do to transfer folders to my itunes?
    please help

    Ruggernaut wrote:
    I purchased a Mac Book Pro and find the Itunes a bit strange as the "add folder to library" option under the menu is not available
    is my itunes corrupt or what can i do to transfer folders to my itunes?
    iTunes for Mac has never had an "Add folder to library" option. This is only available on Windows version.
    Select Add to library, select the folder then click OK.
    Or drag the folder(s) to the iTunes library at top left of iTunes.

  • How do I access technical support. There is something wrong with my program - it gvies and error message - can't open but will fix the problem the next time it opens.  Which it does not do.  I uninstalled and reinstalled the program, but the same error ap

    How do I access someone for technical support?  what telephone number can I use?

    Find the LR cache folder and delete it. Find the LR preview folder and delete it. Then try opening LR.

  • I just got a Macbook Pro three weeks ago, and it is already freezing up on me. What is wrong with it? Also, the battery life does not extend to 7 hours when connected to the internet. Is there something wrong with my computer, or is this normal?

    It's also really slow. And the mouse key on my screen sometimes doesn't switch back to normal.
    Do I have a virius? How do I know if I do? How do I get rid of it? Are there any free anti virius systems that are available and good?

    I doubt you will have any virus, must never say never
    Free for Home use
    Sophos
    http://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-mac-home-ed ition.aspx
    also free  from app store Clam XAV
    http://www.usatoday.com/story/tech/columnist/komando/2013/02/14/tech-myths-mac-s oftware-megapixels-camera/1910521/
    Your Battery will not last long if you keep it on full brightness.
    see this read
    https://discussions.apple.com/thread/964075?start=0&tstart=0
    http://support.apple.com/kb/PH3738
    http://support.apple.com/kb/index?page=search&src=support_site.home.search&local e=en_US&q=Battery%2095%25
    Open LaunchPad/Other/Activity Monitor/CPU
    and check if any of your  processes are high% CPU  if so select it and press the Red Quit process Button
    Mac101 may assist you
    http://www.apple.com/support/macbasics/

  • Firefox home for the iPhone sync's initially but, it does not continue to sync after that. Is there something wrong with firefox sync or an issue with my app?

    Once firefox on the computer is closed for the first time after sync is setup it will not longer sync to the iPhone. I have tried deleteing and reading account several times. I refresh the app on iPhone. Nothing will work. One the initial sync is complete. Thats it.

    hello, mozilla has [https://blog.mozilla.org/services/2012/08/31/retiring-firefox-home/ stopped development & further support for firefox home] on ios devices halve a year ago. as an alternative you might want to try the following app & see if it is fixing the issue: https://itunes.apple.com/us/app/bookmarks-on-the-go/id550037184

  • Lost my passwords doing something wrong with Sync. Want to restore. Can I do it?

    I wanted to clear all my passwords from computer on my word. I deleted them and forgot to switch off the sync before I did it. And Firefox Sync deleted all passwords on my home computer!(

    It is very difficult to do this if you want it to look a bit convincing, but if you don't want something very realistic but just to do it for fun it may be doable.
    What you  want is to put one clip atop the other and use a mask.
    If you use a still image of your baby and your moving lips do not move a lot within the frame, this looks possible and not too difficult.
    Apply the "Vignette Mask" to your clip and adjust its size, position an fallof parameters so that the vignette captures just your mouth. And use the Transform tool to resize and position over your baby's mouth.
    You may end up with something a little better than this quick and dirty example I just made :-)
    Edit: just after I posted I realized that Karsten beat me :-)

  • Does anyone els's macbook pro battery die very quick or is there something wrong with mine?

    I haven't even had it a year yet i close all applications when i'm not useing them it dies within an hour, hour and a half

    Post this information from your MBP found in System Profiler.
    Also describe the applications that you are using when you experience this short battery life.
    Ciao.

  • Oem explain plan produced doesn't correspond to explain plan with tkprof

    Hello all,
    I am running OEM on a 10.2.0.3 database and I have a very slow query with cognos 8 BI on my data warehouse.
    I went to the dbconsole through OEM and connected to target database I went to look at the query execution and then got an explain plan.
    Then I did a trace file and ran it throught tkprof.
    When I look at both produced explain plan, I can see the tree looks the same exept the corresponding values. In OEM, it says I am going throug 18000 rows and in the tkprof result it says more like millions of records.
    As anybody had these kind of results?
    Shall I have more confidence in TKprof then OEM?
    It is very important to me since I am being chalanged by an external DBA.

    I would recommend you to get Christian Antogini´s book "Troublshooting Oracle Performance", (http://www.antognini.ch/top/) which explains everything you need to know when analyzing Oracle SQL Performance and Explain Plans.
    If you properly trace your SQL Statement, you will get "STAT" lines in the trace file. These stat lines show you the actual number of rows processed per row source operation. Explain plan per default does only show you the "estimated" row counts for the row source operations no matter whether you use "explain=" in the tkprof call or OEM to get the explain plan. Tkprof reads the STAT lines from the trace and outputs a section which is similar to an execution plan but contains the "real" number of rows.
    However, if you want to troubleshoot Oracle Performance, I would recommend you to run the statement with the hint /*+ GATHER_PLAN_STATISTICS */ or set statistics_level=ALL in your session (not database-wide!).
    If you do, you can get an excellent execution plan with DBMS_XPLAN.DISPLAY_CURSOR containing both estimated rows as well as actual rows combined with the "number of starts" for e.g. nested loop joins.
    Get the book, read it, and you will be able to discuss this issue with your external dba in a professional way. ;-)
    Regards,
    Martin
    www.ora-solutions.net

  • Sub Partitioning does not have considerable impact Explain Plan

    Hi Guys,
    I have a table that is list - list sub partitioned on Oracle 11g - 11.2.0.3.
    The first partition is on the CIRCLE_ID column and the second sub partition is on the LOAD_DTTM.
    Now i have tried 2 queries on the database
    1 - select MOBILENUMBER, CLOSING_BAL from GSM_PRR_SUM a1
    where A1.CIRCLE_ID ='AK'
    AND a1.LOAD_DTTM BETWEEN '28-MAR-2012' AND '03-APR-2012';
    2 - select MOBILENUMBER, CLOSING_BAL from GSM_PRR_SUM a1
    where A1.CIRCLE_ID ='AK'
    AND to_char(a1.LOAD_DTTM) like '%MAR%'
    Ideally the 2nd query should take a much higher time than the first query.
    But the explain plan shows a difference of less than 1%.
    Can you pls provide some insights as why Oracle is not understanding that subpartitioning will be faster?
    Thanks,
    Manish

    Hi Dom
    Thanks for your reply.
    Is the first query using partition pruning? - Yes
    Have you gathered stats, etc, etc? - No. All our queries always need to access the entire table and not a particular subset and the where criteria always uses partition and sub partition columns. so we dont see the need to collect stats. Can you pls advise what stats need to be collected and what will be the advantage of those?
    Below are the output of the Explain Plan and Trace Output -
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    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.3
    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 cursor_sharing
    NAME TYPE VALUE
    cursor_sharing string EXACT
    SQL> column sname format a20
    SQL> column pname foramt 20
    SP2-0158: unknown COLUMN option "foramt"
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL> select
    2 sname
    3 , pname
    4 , pval1
    5 ,pval2
    6 from sys.aux_stats$;
    from sys.aux_stats$
    ERROR at line 6:
    ORA-00942: table or view does not exist
    SQL> explain plan for
    select MOBILENUMBER, CLOSING_BAL from GSM_PRR_SUM_NEW a1
    where A1.CIRCLE_ID ='KA'
    AND a1.LOAD_DTTM BETWEEN '28-MAR-2012' AND '03-APR-2012'
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3032220315
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)
    | Time | Pstart| Pstop |
    PLAN_TABLE_OUTPUT
    | 0 | SELECT STATEMENT | | 41M| 1643M| 548M(100)
    |999:59:59 | | |
    | 1 | PARTITION LIST SINGLE | | 41M| 1643M| 548M(100)
    |999:59:59 | KEY | KEY |
    | 2 | PARTITION LIST ITERATOR| | 41M| 1643M| 548M(100)
    |999:59:59 | KEY | KEY |
    | 3 | TABLE ACCESS FULL | GSM_PRR_SUM_NEW | 41M| 1643M| 548M(100)
    |999:59:59 | KEY | KEY |
    PLAN_TABLE_OUTPUT
    Note
    - dynamic sampling used for this statement (level=2)
    14 rows selected.
    SQL> explain plan for
    select MOBILENUMBER, CLOSING_BAL from GSM_PRR_SUM_NEW a1
    where A1.CIRCLE_ID ='KA'
    AND to_char(a1.LOAD_DTTM) like '%MAR%';
    2 3 4
    Explained.
    SQL> SQL> SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    PLAN_TABLE_OUTPUT
    Plan hash value: 189546713
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| T
    ime | Pstart| Pstop |
    PLAN_TABLE_OUTPUT
    | 0 | SELECT STATEMENT | | 62M| 2521M| 5435M(100)|99
    9:59:59 | | |
    | 1 | PARTITION LIST SINGLE| | 62M| 2521M| 5435M(100)|99
    9:59:59 | KEY | KEY |
    | 2 | PARTITION LIST ALL | | 62M| 2521M| 5435M(100)|99
    9:59:59 | 1 | 305 |
    |* 3 | TABLE ACCESS FULL | GSM_PRR_SUM_NEW | 62M| 2521M| 5435M(100)|99
    9:59:59 | KEY | KEY |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
    3 - filter(TO_CHAR(INTERNAL_FUNCTION("A1"."LOAD_DTTM")) LIKE '%MAR%')
    Note
    PLAN_TABLE_OUTPUT
    - dynamic sampling used for this statement (level=2)
    19 rows selected.
    SQL>
    SQL> SET AUTOTRACE TRACEONLY ARRAYSIZE 100
    SQL> select MOBILENUMBER, CLOSING_BAL from GSM_PRR_SUM_NEW a1
    where A1.CIRCLE_ID ='KA'
    AND a1.LOAD_DTTM BETWEEN '28-MAR-2012' AND '03-APR-2012' 2 3 ;
    49637012 rows selected.
    Execution Plan
    Plan hash value: 3032220315
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)
    | Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 41M| 1643M| 546M(100)
    |999:59:59 | | |
    | 1 | PARTITION LIST SINGLE | | 41M| 1643M| 546M(100)
    |999:59:59 | KEY | KEY |
    | 2 | PARTITION LIST ITERATOR| | 41M| 1643M| 546M(100)
    |999:59:59 | KEY | KEY |
    | 3 | TABLE ACCESS FULL | GSM_PRR_SUM_NEW | 41M| 1643M| 546M(100)
    |999:59:59 | KEY | KEY |
    Note
    - dynamic sampling used for this statement (level=2)
    Statistics
    0 recursive calls
    7 db block gets
    530220 consistent gets
    33636 physical reads
    0 redo size
    644311477 bytes sent via SQL*Net to client
    5460594 bytes received via SQL*Net from client
    496372 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    49637012 rows processed
    SQL> SET AUTOTRACE TRACEONLY ARRAYSIZE 100
    SQL> select MOBILENUMBER, CLOSING_BAL from GSM_PRR_SUM_NEW a1
    where A1.CIRCLE_ID ='KA'
    AND to_char(a1.LOAD_DTTM) like '%MAR%' 2 3
    4 ;
    219166976 rows selected.
    Execution Plan
    Plan hash value: 189546713
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| T
    ime | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 228M| 9155M| 3552M(100)|99
    9:59:59 | | |
    | 1 | PARTITION LIST SINGLE| | 228M| 9155M| 3552M(100)|99
    9:59:59 | KEY | KEY |
    | 2 | PARTITION LIST ALL | | 228M| 9155M| 3552M(100)|99
    9:59:59 | 1 | 274 |
    |* 3 | TABLE ACCESS FULL | GSM_PRR_SUM_NEW | 228M| 9155M| 3552M(100)|99
    9:59:59 | KEY | KEY |
    Predicate Information (identified by operation id):
    3 - filter(TO_CHAR(INTERNAL_FUNCTION("A1"."LOAD_DTTM")) LIKE '%MAR%')
    Note
    - dynamic sampling used for this statement (level=2)
    Statistics
    38 recursive calls
    107 db block gets
    2667792 consistent gets
    561765 physical reads
    0 redo size
    2841422984 bytes sent via SQL*Net to client
    24108883 bytes received via SQL*Net from client
    2191671 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    219166976 rows processed
    SQL>
    Thanks,
    Manish

  • Help with interpreting explain plan (dbms_xplan) output

    Hi all,
    I'm trying to get to grips with reading and interpreting the explain plan or dbms_xplan output, and so I hope someone can help with the output below.
    So, with the explain shown below, does it mean that...
    a) it starts with step 8 and sends all rows to the nested loop in step 5
    b) it only sends (or thinks it sends) 1 row to step 5 from step 8
    c) For each row supplied from step 5, there will be an index lookup at step 8 to access the table at step 6
    d) Step 8 only gets (or think it gets) 1 row
    If it does mean that only 1 row is expected by the optimizer, and yet the full table scan should return 150,000 records, and the table has up to date statistiucs, what else would cause the cardinality to be so far off?
    If it doesn't mean it will return 1 row then what does it mean ?
    | Id  | Operation                           | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                    |                                |       |       |   945 (100)|          |
    |   1 |  SORT GROUP BY                      |                                |     1 |   283 |   945   (3)| 00:00:05 |
    |*  2 |   FILTER                            |                                |       |       |            |          |
    |   3 |    NESTED LOOPS                     |                                |       |       |            |          |
    |   4 |     NESTED LOOPS                    |                                |     1 |   283 |   944   (3)| 00:00:05 |
    |   5 |      NESTED LOOPS                   |                                |     1 |   108 |   929   (3)| 00:00:05 |
    |*  6 |       MAT_VIEW ACCESS FULL          | DEMOGRAPHICS_MV                |     1 |    97 |   927   (3)| 00:00:05 |
    |*  7 |       MAT_VIEW ACCESS BY INDEX ROWID| NAMES_MV                       |     1 |    11 |     2   (0)| 00:00:01 |
    |*  8 |        INDEX RANGE SCAN             | ORG_MV_IDX1                    |     1 |       |     1   (0)| 00:00:01 |
    |*  9 |      INDEX RANGE SCAN               | PAY_IDX8                       |   252 |       |     4   (0)| 00:00:01 |
    |* 10 |     TABLE ACCESS BY INDEX ROWID     | PAY_ALL                        |     1 |   175 |    15   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
          8 - access("ORG_MV"."ORG_ID"="DEMO_MV"."ORG_ID")Many thanks for your help.

    Thank you Hemant and rp0428,
    I read through that white paper which was really useful.
    I ran query using GATHER_PLAN_STATISTICS and go tthe Estimate and Actual rows - wow - it is a long way out!!
    | Id  | Operation                           | Name                           | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |   0 | SELECT STATEMENT                    |                                |      1 |        |       |   945 (100)|          |      0 |00:18:11.39 |    2552K|    361K|       |       |          |
    |   1 |  SORT GROUP BY                      |                                |      1 |      1 |   283 |   945   (3)| 00:00:05 |      0 |00:18:11.39 |    2552K|    361K|  1024 |  1024 |          |
    |*  2 |   FILTER                            |                                |      1 |        |       |            |          |      0 |00:18:11.39 |    2552K|    361K|       |       |          |
    |   3 |    NESTED LOOPS                     |                                |      1 |        |       |            |          |      0 |00:18:11.39 |    2552K|    361K|       |       |          |
    |   4 |     NESTED LOOPS                    |                                |      1 |      1 |   283 |   944   (3)| 00:00:05 |     44M|00:04:59.03 |     598K|  63442 |       |       |          |
    |   5 |      NESTED LOOPS                   |                                |      1 |      1 |   108 |   929   (3)| 00:00:05 |    109K|00:00:01.73 |    7807 |      7 |       |       |          |
    |*  6 |       MAT_VIEW ACCESS FULL          | DEMOGRAPHICS_MV                |      1 |      1 |    97 |   927   (3)| 00:00:05 |    126K|00:00:00.26 |    5417 |      1 |       |       |          |
    |*  7 |       MAT_VIEW ACCESS BY INDEX ROWID| NAMES_MV                       |    126K|      1 |    11 |     2   (0)| 00:00:01 |    109K|00:00:01.27 |    2390 |      6 |       |       |          |
    |*  8 |        INDEX RANGE SCAN             | ORG_MV_IDX1                    |    126K|      1 |       |     1   (0)| 00:00:01 |    126K|00:00:00.69 |    2023 |      6 |       |       |          |
    |*  9 |      INDEX RANGE SCAN               | PAY_IDX8                       |    109K|    252 |       |     4   (0)| 00:00:01 |     44M|00:04:03.07 |     590K|  63435 |       |       |          |
    |* 10 |     TABLE ACCESS BY INDEX ROWID     | PAY_ALL                        |     44M|      1 |   175 |    15   (0)| 00:00:01 |      0 |00:13:09.85 |    1954K|    297K|       |       |          |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------When I unravel the WHERE clause and remove the decode(nvl statements (which only evaluate the passed in parameters and provide default values where they are NULL) I get a much better plan and values
    | Id  | Operation                        | Name                           | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |   0 | SELECT STATEMENT                 |                                |      1 |        |       |   157K(100)|          |      0 |00:00:43.10 |     343K|  45190 |       |       |          |
    |   1 |  SORT GROUP BY                   |                                |      1 |      1 |   283 |   157K  (1)| 00:13:47 |      0 |00:00:43.10 |     343K|  45190 |  1024 |  1024 |          |
    |   2 |   NESTED LOOPS                   |                                |      1 |        |       |            |          |      0 |00:00:43.10 |     343K|  45190 |       |       |          |
    |   3 |    NESTED LOOPS                  |                                |      1 |      1 |   283 |   157K  (1)| 00:13:47 |      0 |00:00:43.10 |     343K|  45190 |       |       |          |
    |*  4 |     HASH JOIN                    |                                |      1 |      1 |   272 |   157K  (1)| 00:13:47 |      0 |00:00:43.10 |     343K|  45190 |   720K|   720K|  171K (0)|
    |*  5 |      TABLE ACCESS BY INDEX ROWID | PAY_ALL                        |      1 |      2 |   350 |   156K  (1)| 00:13:43 |      0 |00:00:43.10 |     343K|  45190 |       |       |          |
    |*  6 |       INDEX RANGE SCAN           | PAY_IDX7                       |      1 |   3596K|       | 15565   (1)| 00:01:22 |   7251K|00:00:50.88 |   45190 |  45190 |       |       |          |
    |*  7 |      MAT_VIEW ACCESS FULL        | DEMOGRAPHICS_MV                |      0 |    126K|    11M|   919   (2)| 00:00:05 |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |*  8 |     INDEX RANGE SCAN             | ORG_MV_IDX1                    |      0 |      1 |       |     1   (0)| 00:00:01 |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |*  9 |    MAT_VIEW ACCESS BY INDEX ROWID| NAMES_MV                       |      0 |      1 |    11 |     2   (0)| 00:00:01 |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Even though the result set is zero, the time to establish this came down from 35 minutes to 30 seconds and the plan has changed and is using a different index now!
    Thanks for your help!

Maybe you are looking for

  • Grayish grid on zoomin in. How to get rid of it?

    Hello everybody. So, here you see this monster above who kills my view when zooming picture in more than 500%... I looked out for some checkbox in preferences to turn it out, but can not see it. How can I get this of?? Thanks for christmas's help;)

  • Error when trying to connect

    Hi. When I try to connect to the Administration Client or to Excel Client, I receive the next error: "Error on uncompressing file: Error: Class does not support Automation or does not support expected interface" In other computer I have been able to

  • LR3 Flickr export plugin. Is the export without ICC profile available?

    Hey guys, I want to use the new integrated Flickr export plugin in LR3 to publish my picture on my photostream. Since I want my pictures to look the same accross all browsers I want to convert them to sRGB and I don't want to embed the ICC profile. I

  • BAPI_SALESORDER_SIMULATE is  hangs up when running for multiple users

    Hi SAP Gurus, I am using BAPI_SALESORDER_SIMULATE for price repricing . However when multiple users or same user runs in multiple sessions, one session will run , however other sessions till it reaches BAPI it is fast and once it enters to BAPI, it g

  • Add a sticky note

    This question was posted in response to the following article: http://help.adobe.com/en_US/acrobat/standard/using/WS58a04a822e3e50102bd615109794195ff-7e7 7.w.html