explain the research plan

Hi all

I have a SQL query that joined with temporary tables total and normal tables.
I created indexes on global temporary tables with the column that is used
in where condition.

But when I check the explain command plan I see this full table access with cost like 2.
This full table access is child of nested loops.

Is that with plan or should I adjust more.
Please advice

Thanks and rgds
Saaz

Are the line estimates accurate?

Given that all say 1 and dynamic sampling has been used, it is likely that you have no stats gathered for these objects?

Tags: Database

Similar Questions

  • explain the in9i plan

    Hello

    on 9.2.0.4 under Unix.

    is it possible to import a plan for a query to explain from a (9.2.0.2) database to another (9.2.0.4)?

    Thank you.

    Difference is that the statistics of optimizer based on CSSTidy based on costs are different.

    Objects with the same data can be different segment size, then the execution plan may differ in function.

  • To the topic to explain the query Plan

    Hello

    I have a question about the explain plan command. While gather us statistics and optimize, then choose the best possible plan out the plans explain command available. If we collect statistics on a table for a long time while the system choose:

    Whether it will continue to use the same plan, since it uses at startup when statistics have been collected, or will change the plan as soon as dml activities and statistics grow old.

    Thank you
    GK

    Gulshan says:
    Hello

    I have a question about the explain plan command. While gather us statistics and optimize, then choose the best possible plan out the plans explain command available. If we collect statistics on a table for a long time while the system choose:

    The same plan he chose to start with previous statistics. The plan will not change automatically as long as you update the statistics.

    Whether it will continue to use the same plan, since it uses at startup when statistics have been collected, or will change the plan as soon as dml activities and statistics grow old.

    The DML will not be able to change the statistics stored in the data dictionary views themselves. There must be a statistic explicit collection that has come to reflect the change in the data dictionary. 10 g from, there is automatically a task (a special 11 g automatic) is there who can detect the change in the ongoing dml on the table and can trigger the table for update statistics.

    Aman...

  • Explain the advantage plan

    Hello
    to use the map feature to explain within the spreadsheet (sqldev 2.1, 15 Dec 09), sqldev requires the SELECT_CATALOG_ROLE and the privileges to SELECT ANY DICTIONARY.

    Why?

    1. even with only the roles CONNECT and classic RESOURCE course, I can run "explains the plan for...» ' and ' select * from table (dbms_xplan.display); "and get the xplan.

    2. do you not see that the problems in persuading those hard core DBAs, that developers need xplan - and Yes, they can read them?

    1 seems one of these bugs... There are more areas that require privileges. DEV?
    2. a request to the Exchange, but unfortunately rejected. You can ask once again, but given the unusual support on votes, it would be simply rejected again.

    Kind regards
    K.

  • Explain the different Plans

    Hello

    in 11.2.0.3 the same query on two different DBs (on the same server) have different explain Plans (differnet number of rows returned 9690K vs M 14):

    DBDEV:

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

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

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

    |   0 | INSERT STATEMENT.                  |  9690K |  4482M |   344K (1) | 01:08:49 |

    |   1.  LOAD TABLE CLASSIC | PS_PROJ_RES_TA14 |       |       |            |          |

    |*  2 |   TABLE ACCESS FULL | PS_PROJ_RESOURCE |  9690K |  4482M |   344K (1) | 01:08:49 |

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

    DBTST

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

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

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

    |   0 | INSERT STATEMENT.                  |    14 M |  6534M |   344K (1) | 01:08:50 |

    |   1.  LOAD TABLE CLASSIC | PS_PROJ_RES_TA14 |       |       |            |          |

    |*  2 |   TABLE ACCESS FULL | PS_PROJ_RESOURCE |    14 M |  6534M |   344K (1) | 01:08:50 |

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

    The optimizer settings are the same:

    VALUE OF TYPE NAME

    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

    the string ALL_ROWS optimizer_mode

    optimizer_secure_view_merging boolean TRUE

    optimizer_use_invisible_indexes boolean FALSE

    optimizer_use_pending_statistics boolean FALSE

    Boolean optimizer_use_sql_plan_baselines TRUE

    And the number of lines:

    In DBTST

    Select Count (*) from ps_proj_resource

    COUNT(*)

    --------

    18072893

    In DBDEV

    COUNT(*)

    --------

    18070581

    Thanks for the explanation and ideas.

    Hello

    Yes will not change the plan to explain it, but the number of rows must / may change in the case otherwise we must understand why the number of rows returned is so different (14 M against 9M) with almost the same number of rows in the PS_PROJ_RESOURCE table.

    Thank you and best regards.

  • Question about a research plan

    Original title: ask the community

    To the right,.

    Through this mail, I want to express a series of questions on the research plan.

    I would be happy to know if Microsoft Corporation would cooperate on a research project or not.

    If so, what conditions the cooperation is based on.

    Looking forward to you soon.

    Best regards fak

    Hello

    I suggest you take a peek on the site Web of Microsoft Research here:

    http://research.microsoft.com/en-us/defaultb.aspx .

    Contact information for Microsoft Research can be found here:

    http://research.microsoft.com/en-us/about/contactus.aspx .

    In addition, so that you understand your message here has been on a public forum designed to provide support for some Microsoft products and services. Most of the respondents is volunteers. You're not in general at Microsoft here and you have not sent an e-mail to Microsoft.

    Hope that helps.

  • Reg: Explain the Plan-

    Hi Experts,

    I had a doubt about the Plan to explain it.

    Is there a relationship between the cost amount in the Plan to explain and the number of lines read by the query?
    In other words - if the number of lines read by the query increases, which will increase the cost also?

    Can someone please give me some advice on this?


    Thank you and best regards,
    Vanessa B.

    ranitB wrote:
    Hi Experts,

    I had a doubt about the Plan to explain it.

    Is there a relationship between the cost amount in the Plan to explain and the number of lines read by the query?
    In other words - if the number of lines read by the query increases, which will increase the cost also?

    Can someone please give me some advice on this?

    "The answer is 'not really' the cost is single block read disc of research time. But if the number of lines that are expected + coming in overall result are higher, the work expected by Oracle would be also higher. Thus, indirectly, the answer may be Yes. That said, the number of rows contained in the plan of the explain command (you should check the execution plan, explain plan is not the real plan) are the lines that the optimizer is expected to pick up and extracted from the number ofrows real may or may not match with her.

    Aman...

  • Explain the explain plan

    decide to move to optimization soon. Book says join faster that the subquery in this example because the analyses involved. The "cost" to the subquery appears lower than the cost for the join. So it is confusing to me - aka How should I be interpreting this.

    Plan of subquery:

    image2.png.jpg

    join plan

    image2.png.jpg

    as you can see that the plan for the subquery has less than a cost. Could someone explain these outputs as to which application is more effective. I need to start somewhere.

    Thank you!

    The BEST way to get help when you ask questions is:

    1 ask questions on SPECIFIC things

    2. tell us EXACTLY what term, value, etc. ask abaout

    Book says join faster that the subquery in this example because the analyses involved. The "cost" to the subquery appears lower than the cost for the join. So it is confusing to me - aka How should I be interpreting this.

    OK - what BOOK are you talking about? There is not much interest to mention a book if you're not going to tell us which book it and provide a link to it and even a page number. This gives us the SCOPE of your question.

    This "cost for the subquery" are you talking about? Be specifc. It is in one of the plans that you posted? What plan? Whose cost is it? For example, you could say:

    I have a question for the foreground below. Why is the cost to the xx line lower than the cost of the second plan on line AA?

    This question refers CLEARLY to the info we're talking. The way in which you stating the question, we try to guess what plan and the lines you want to say.

    subquery plan:
    
    
    join plan
    
    
    as you can see the subquery plan has less of a cost. Could someone explain from these outputs as to which query is more efficient. I need to start from somewhere.
    

    Are you talking about line #1 in each of these plans?

    Please edit your post and tell us EXACTLY what you ask in the topic and refer to values and SPECIFIC lines. Also post a link to the book and a reference to a page number you got the information from.

    The optimizer generally chooses the REAL implementation with the lowest cost plan. It is not clear whether the plans that you have posted are ACTUAL spending plans that Oracle really determined and used or just explain plans.for what Oracle thought it might use.

    If the statistics are not up-to-date these plans do not yet reflect the reality of the data.

    And if the amount of data is a small number of blocks or other of these plans can run better than the other in reality.

    You can find this Oracle white paper "Explain the Plan explaining" useful

    http://www.Oracle.com/technetwork/database/bi-Datawarehousing/TWP-explain-the-explain-plan-052011-393674.PDF

  • Question about cardinality (lines) to explain the plan

    I have two tables (names have been changed to protect the innocent):


    TABLE 1:


    The Null columns?    Type

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

    Table1_Primary_Key NOT NULL NUMBER

    more than 10 columns


    TABLE2:


    The Null columns?    Type

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

    Table2_Primary_Key NOT NULL NUMBER

    more than 8 columns


    Lines of table1 has 1097172


    Rows of table2 has 160960


    I am analysis request and get explain below:


    SELECT t1. Table1_Primary_Key

    --

    FROM TABLE1 t1,

    From TABLE2 T2

    --

    WHERE t1. Table1_Primary_Key = t1. Table1_Primary_Key

    AND t2. Table2_Primary_Key = 3432798

    /


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

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

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

    |   0 | SELECT STATEMENT |                 |     1.    21.     5 (0) | 00:00:01 |

    |   1.  NESTED LOOPS |                 |     1.    21.     5 (0) | 00:00:01 |

    |   2.   TABLE ACCESS BY INDEX ROWID | TABLE2.     1.    12.     3 (0) | 00:00:01 |

    |*  3 |    INDEX UNIQUE SCAN | TABLE2_PK |     1.       |     2 (0) | 00:00:01 |

    |   4.   TABLE ACCESS BY INDEX ROWID | TABLE1.  1096K |  9634K |     2 (0) | 00:00:01 |

    |*  5 |    INDEX UNIQUE SCAN | TABLE1_PK |     1.       |     1 (0) | 00:00:01 |

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


    As you can see it table2 is exactly 1 row and join table1 on a correspondence of single line.


    My question is this:


    Why the plan of the explain command seems (at least for me) to indicate that it looked like all the rows in TABLE1?


    Thank you


    Thomas

    the optimizer's decisions are based on the object (and maybe system) statistics: so it's a good idea to provide as much information as possible in these statistics. Basically, there is nothing wrong with statistics automatic collection job - so I would count on that if I don't have very good reason to use anything else. Of course, there are some situations in which it's a good idea to add a few adjustions for automatic collection: sometimes, there is too much created histograms, sometimes there is too little (basically you have histograms when the distribution of the data is not yet). And if there are columns with correlated values who serve together in boundary conditions then create extensive statistics may be a good idea. To make these adjustions, you can use the routines of pref dbms_stats. And sometimes, it may even be a good idea is not to collect statistics for an object and use the sample dynamic (dynamic statistics) for more detailed information on the cardinality of distribution and join.

    In the book of my opinion Jonathan Lewis cost base Oracle Fundamentals still contains the best explanation of the use of optimizer statistics - and Christian Antognini Oracle performance troubleshooting also provides a lot of valuable information about statistics and their gathering. Of course the documentation also explains the basics in detail: Managing optimizer statistics - 11 g Release 2 (11.2). And if you want to get a shorter summary, then you can always take a look at the Web of Tim Hall site: https://oracle-base.com/articles/misc/cost-based-optimizer-and-database-statistics.

  • Explain the Plan of DBA_HIST_SQL_PLAN

    Hello

    I have the SQL_ID of a poor performing stmt of sql and I need to get the plan to explain the same DBA_HIST_SQL_PLAN.

    Please let me how can know I generate an explain plan of DBA_HIST_SQL_PLAN using sql_id.

    Kind regards

    VN

    That's fine - the service is available in this version.  (I asked because I thought that might be a function g 11 - but I just checked, and it's in 10 gr 2 as well).

    Concerning

    Jonathan Lewis

  • a sql id have more than explain the plan so I'd like to come up with plan used at runtime.

    Hi all


    In a sql oracle11g having id several explain the plan so I'd like to come up with plan used at runtime.

    For example SQlID:-8yczg5zav14vt have 5 sql plan and I want to check that we execute at any time, please let me how I can check by sql queries


    Concerning

    Ranjeet

    RanjeetSohale wrote:

    I am ok for that but active only plans is right, but in accordance with the foregoing, two data line table in the table SQL V$ so both active and plan cost is high and the other is low.

    Yes that's right cost is different, he means here another effective plan for oracle will analyze the declaration again and stored as new slider of the child. Especially since I explained that.

  • Explain the interpretation of the Plan

    Hi friends!

    I ve an anomaly in time of response of two databases that are equal between the two when I run the same query.

    On the first DB, when I run the query it takes 20 seconds, but on the second DB, the same query at 02:40 minutes.

    This Don t of sense to me, because the first DB contains a lot of data as second DB...

    I ve got the plan to explain both, but I Don t know how to interpret.

    It's the first DB EP, which is the fastest to execute the query (20 "):

    ********************************************************************************************************************************************************************************************

    SELECT STATEMENT CHOOSECost: 4 K bytes: 934 K cardinality: 4 K

    ORDER of 17 SORTING BY cost: 4 K bytes: 934 K cardinality: 4 K

    FILTER 16

    13 LOOPS IMBRIQUEES SEMI cost: 4 K bytes: 934 K cardinality: 4 K

    TABLE 11 ACCESS BY INDEX ROWID IMO. IDDPAR cost: 4 K bytes: 892 K cardinality: 4 K

    BITMAP 10 ROWID CONVERSION

    9 BITMAP AND

    5 BITMAP OR

    2 BITMAP CONVERSION TO ROWID

    1 INDEX RANGE SCAN NON-UNIQUE IMO. IDDPARX10 Cost: 306

    CONVERSION OF BITMAP ROWID 4

    3 INDEX RANGE SCAN NON-UNIQUE IMO. IDDPARX10 Cost: 3

    CONVERSION OF BITMAP TO 8 ROWID

    7 SORT ORDER BY

    6 INDEX RANGE SCAN NON-UNIQUE IMO. IDDPARX3 Cost: 455

    12 INDEX UNIQUE SCAN UNIQUE IMO. PK_IDDPACX1 bytes: 670 K cardinality: 62 K

    TABLE 15 ACCESS BY INDEX ROWID IMO. IDDPARE cost: 1 bytes: cardinality 1: 16

    14 INDEX UNIQUE SCAN UNIQUE IMO. Cardinality of PK_IDDPAREX1: 1

    ********************************************************************************************************************************************************************************************

    And it's the second DB, for the same query of course EP (2'40 "):

    **********************************************************************************************************************************************************

    SELECT STATEMENT CHOOSECost: 6 K bytes: 886 K cardinality: 4 K

    7 FILTER

    4 LOOPS IMBRIQUEES SEMI cost: 6 K bytes: 886 K cardinality: 4 K

    TABLE 2 ACCESS BY INDEX ROWID IMO. IDDPAR cost: 6 K bytes: 850 K cardinality: 4 K

    1 INDEX RANGE SCAN NON-UNIQUE IMO. IDDPARX5 cost: 298 cardinality: 11 K

    UNIQUE 3 INDEX SCAN UNIQUE IMO. PK_IDDPACX1 bytes: 417KO cardinality: 43 K

    TABLE 6 ACCESS BY INDEX ROWID IMO. IDDPARE cost: 1 bytes: cardinality 1: 16

    5 INDEX UNIQUE SCAN UNIQUE IMO. Cardinality of PK_IDDPAREX1: 1

    **********************************************************************************************************************************************************

    As you can see, second EP is as simple, but its effectiveness is much poorer.

    I m intends to interpret my experience with Plans to explain, but it is virtually zero. The most obvious difference I found is the BITMAP CONVERSION OF LINES and CONVERSION of bitmap to LINES Kael'thas appear in the first EP.

    I searched ´ve documentation CONVERSION BITMAP and I ve include, more or less. But I Don t know what measures to take to optimizer are Oracle do the same conversion on the second EP.

    I Don t pretend that someone to teach me everything on explains Plans for interpretation, I m aware of the track of this.

    But would like advice on how I can solve this problem. Any suggestion will be welcome.

    Thanks in advance

    AlexTutor wrote:

    All databases are Enterprise Edition.

    And I ve already tried with advice like that of...

    Okay - so now that you have shown us the request, can you show us EXACTLY what the real "index_combine" referring to the fact that you used looked like and tell us if the execution plan has changed at all with this suspicion.

    Note: Oracle does not ignore the advice, so if your data structures are the same, and you have the right to hint, Oracle would HAVE to give you the plan you want. The only reason why he could not is if the presence of the indication caused Oracle to examine an alternative implementation plan which was (a) cheaper than suggested and (b) a plan which the index was illegal.

    Concerning

    Jonathan Lewis

  • explain the plan without permissions?

    We have some rules on production. one of them is that we can query the database as a developer, but we cannot change it. There are other connections (application) that can change the data. because we can not all DML on the production, we cannot see why a DML statements plan that modifies data. whenever we ask a DBA to send us a plan of enforcement, which is simply embarrassing.

    QUESTION: is it possible to pack "explain plan" statement in a procedure that would accept DML code as a parameter that developer is not able to run/don't have permissions of tun by itself and would assess such plan explanation as another, privileged user ("application") and returns the result (ie. assess the implementation plan) to the original user who invoke this procedure?

    the idea is to have a mechanism among the users of unpliviliged to see what happens really with the code which, after all, we change and correct, but can not run anyway (it is run under "user application" later).

    I would appreciate any idea how to solve this problem. There is no copy of production or something like this where we could do that loves us and play with the code as another user etc.

    Thank you

    943276 wrote:

    QUESTION: is it possible to pack "explain plan" statement in a procedure that would accept DML code as a parameter that developer is not able to run/don't have permissions of tun by itself and would assess such plan explanation as another, privileged user ("application") and returns the result (ie. assess the implementation plan) to the original user who invoke this procedure?

    Yes, possible. Basic example:

    // as schema production or whatever
    SQL> create or replace type TStrings is table of varchar2(4000);
      2  /
    Type created.
    
    SQL>
    SQL> create or replace function ExplainPlan( sqlStatement varchar2 )
      2          return TStrings pipelined authid definer is
      3          pragma autonomous_transaction;
      4          statementName   varchar2(50)    default 'sql.1';
      5  begin
      6          execute immediate
      7                  'explain plan set statement_id = '''||statementName||''' for '||sqlStatement;
      8          commit;
      9
     10          for c in (
     11                  select
     12                          plan_table_output as LINE
     13                  from TABLE(DBMS_XPLAN.Display('PLAN_TABLE',statementName,'TYPICAL'))
     14          ) loop
     15                  pipe row( c.line );
     16          end loop;
     17
     18          return;
     19  end;
     20  /
    
    Function created.
    
    SQL>
    SQL> grant execute ExplainPlan to some_other_user;
    ..
    

    As another user (requiring only a create session privilege):

    SQL> select * from TABLE(SchemaProd.ExplainPlan('select count(*) from emp'));
    
    COLUMN_VALUE
    --------------------------------------------------------------------------------
    Plan hash value: 2937609675
    
    -------------------------------------------------------------------
    | Id  | Operation        | Name   | Rows  | Cost (%CPU)| Time     |
    -------------------------------------------------------------------
    |   0 | SELECT STATEMENT |        |     1 |     1   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE  |        |     1 |            |          |
    |   2 |   INDEX FULL SCAN| PK_EMP |    14 |     1   (0)| 00:00:01 |
    -------------------------------------------------------------------
    
    9 rows selected.
    
    SQL> 
    

    Word of warning however. This example uses dynamic SQL. This is dangerous.

    It creates a very weak point in the scheme of production - as a non-privilege user is permitted to cross the dynamic SQL to a pattern of production, in the example above, blindly executed.

    If you want to continue this basic approach, then you will need to do some serious hardening to the ExplainPlan() function to ensure that SQL cannot be injected and cause the production of data being compromised safety.

  • explain the plan and so on

    Hello world


    could someone please provide me with details of explained the plan and I would appreciate some related details explain plan, trace and tkprof

    Thank you
    Shareef

    Hello

    PLAN of EXPLAINING is an Oracle utility that analyzes a statement and shows the expected execution plan. It may be different from the implementation plan real for a number of reasons.

    Extended SQL trace (10046 event) is a way to gather advanced diagnostic information. There are different levels, at levels 8 and 12 provide the greatest level of detail (you will be able to see the events of waiting and the bind variable values).

    TKProf is a utility that processes the raw trace files and makes shaped the output in a more readable way. However, some experts prefer to work with trace files "gross" - they are not so difficult to read, especially if you get some practice.

    There are other events of tracing: 10053 allows you to see what is happening inside the Oracle optimizer, 10104 allows to see the stats of hash etc join.

    Best regards
    Nikolai

  • difference between the execution plan and explain the plan?

    What is the difference between the execution plan & explain the plan?

    an execution plan is the actual steps that oracle will pass by when it executes a query.

    explain plan is a tool that is used to generate the steps of an execution plan for a query.

Maybe you are looking for