Effect of RLS policy (VPD) on execution plan of a query

Hi
I have been working on tuning of few queries. A RLS policy is defined on most of the tables which appends an extra where condition (something like AREA_CODE=1). I am not able to understand the effect of this extra where clause on the execution plan of the query. In the execution plan there is no mention of the clause added by VPD. In 10046 trace it does show the policy function being executed but nothing after that.
Can someone shed some light on the issue that has VPD any effect on the execution plan of the query ? Also would it matter whether the column on which VPD is applied, was indexed or non-indexed ?
Regards,
Amardeep Sidhu

Amardeep Sidhu wrote:
I have been working on tuning of few queries. A RLS policy is defined on most of the tables which appends an extra where condition (something like AREA_CODE=1). I am not able to understand the effect of this extra where clause on the execution plan of the query. In the execution plan there is no mention of the clause added by VPD. In 10046 trace it does show the policy function being executed but nothing after that.
VPD is supposed to be invisible - which is why you get minimal information about security predicates in the standard trace file. However, if you reference a table with a security preidcate in your query, the table is effectively replaced by an inline view of the form: "select * from original_table where {security_predicate}", and the result is then optimised. So the effects of the security predicate is just the same as you writing the predicate into the query.
Apart from your use of v$sql_plan to show the change in plan and the new predicates, you can see the effects of the predicates by setting event 10730 with 10046. In current versions of Oracle this causes the substitute view being printed in the trace file.
Bear in mind that security predicates can be very complex - including subqueries - so the effect isn't just that of including the selectivity of "another simple predicate".
Can someone shed some light on the issue that has VPD any effect on the execution plan of the query ? Also would it matter whether the column on which VPD is applied, was indexed or non-indexed ?
Think of the effect of changing the SQL by hand - and how you would need to optimise the resultant query. Sometimes you do need to modify your indexing to help the security predicates, sometimes it won't make enough difference to matter.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
"Science is more than a body of knowledge; it is a way of thinking"
Carl Sagan
To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to capture the execution plan for a query

    HI All,
    Can anyone please help me in finding out the command to capture the execution plan for a query.
    Execution plan for select * from EMP where <Condtions>
    it is getting executed successfully but i need to get the proper execution plan for the same.
    Thanks

    971830 wrote:
    i want to know where execution plan gets generated??
    in PMON of server process or in shared pool??
    i know that optimixer create execution plan..It is stored in Library Cache (present inside Shared Pool ).
    select * from v$sql_plan;An absolute beautiful white paper :
    Refer this -- www.sagelogix.com/sagelogix/SearchResults/SAGE015052
    Also -- http://www.toadworld.com/KNOWLEDGE/KnowledgeXpertforOracle/tabid/648/TopicID/XPVSP/Default.aspx
    HTH
    Ranit B.

  • How to skip existing execution plan for a query

    Hi,
    I want to skip existng execution plan for a query which I am executing often. I dont want it to use the same execution plan everytime. Please let me know if any method is there skip the existing execution plan.
    Thanks in advance.......
    Edited by: 900105 on Dec 1, 2011 4:52 AM

    Change the query so it is syntactically different, but has the same semantics (meaning). That way CBO will reparse it and you might get a new execution plan.
    One simple way to do that is to add a dummy predicate ( 45=45) to the where clause. The predicate must be changed every time the query is executed ( 46=46 , 47=47 ,… ).
    Iordan Iotzov
    http://iiotzov.wordpress.com/

  • Execution plan of a query changed

    Dear Experts,
    One of the SQL's running fine prior has a problem now. It just takes too long to execute. Tuning advisor recommends a profile setting with 55% benefit and no other recommendations.
    Using profile hasn't helped much. I would like to check execution plan history of this SQL. Is there V$ view where this info gets populated in terms of hash values??
    Thanks.

    See DBA_HIST_SQLSTAT for historic execution stats and get the plans from DBMS_XPLAN.DISPLAY_AWR.
    e.g.
    select sn.snap_id
    ,      sn.end_interval_time
    ,      st.module
    ,      st.sql_id
    ,      st.plan_hash_value
    ,      rows_processed_delta rws
    ,      executions_delta     execs
    ,      elapsed_time_delta   elp
    ,      cpu_time_delta       cpu
    ,      buffer_gets_delta    gets
    ,      iowait_delta         io
    from   dba_hist_snapshot sn
    ,      dba_hist_sqlstat  st
    where  st.snap_id            = sn.snap_id
    and    st.sql_id             = '<sql_id>'
    order by sn.snap_id desc; and
    select * from table(dbms_xplan.display_awr('<sql_id>'));This AWR data depends on your AWR retention period - which is far too short at the default 8 days but requires more space for longer obviously - and whether the SQL is regularly in the top N.
    Edited by: Dom Brooks on Jul 12, 2012 9:29 AM

  • Execution plans for a Query

    Hi,
           As per documentation i learnt, For Every SQL statement i.e Executed , it will generate 23 Executions plan for a single query. The Runtime Engine will choose the Best Execution plan for Fetch Operation.
        In which Data dictionary view , do i have to check all those 23 Executions plans..
    Thanks

    startup wrote:
    Hi,
           As per documentation i learnt, For Every SQL statement i.e Executed , it will generate 23 Executions plan for a single query. The Runtime Engine will choose the Best Execution plan for Fetch Operation.
        In which Data dictionary view , do i have to check all those 23 Executions plans..
    Thanks
    please post URL to document that says 23 Execute Plans are generated.

  • Different execution plan for same query but for different condition value

    Hi All,
    I'm facing a strange situation where same query for different condition not working.
    1--
    Select  top 10 * from revenuefact(nolock) 
    where feecode ='OW4'
    2--
    Select  top 10 * from revenuefact(nolock)
    where feecode ='BTE'
    1st query is returning result easily but 2nd query is taking too long. Column
    feecode has already Non-clustered index and Clustered index is also available for another col RevenueSID.
    I was surprised when checked the query execution plan for both the above queries  which is quite different (as per attached below). Can anyone suggest me the reason behind it.
    And solution for the same. One more thing that data for feecode BTE is inserting through different source instead of others feecode and table contains more than 300 million rows.

    When I speak with people inside Microsoft who work with the optimizer, the refuse to accept the work "bug" when a query produces the correct result, but with a suboptimal plan. They prefer to use the word "limitation".
    The limitation here is that when the optimizer compares two plans, it only looks at the estimated cost. As far as I know, it does not perform any analysis from the perspective "what if the statistics are wrong"? They do provide the hint OPTIMIZE
    FOR UNKNOWN, but that does not work then there is a constant as in this case.
    The optimizer will surely distinguish between TOP 10 and TOP 10000000. With the latter, you have all reason to expect a Clustered Index Scan no matter which value you search for - unless you pick a value for which the histogram indicates that there are no
    rows.
    Interesting enough, I was able to reproduce the situation in my Northgale database, which is an inflated version of Northwind, and where statistics should be accurate.
    SELECT TOP 10 * FROM Orders WHERE EmployeeID = 8
    results in a CI scan, and so does also EmployeeID = 7, and even 5. There are only 2292 rows out of a total of 344305 rows. If I try EmployeeID 808 for which there are 1797, the optimizer goes for the index seek.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Execution plan change when querying count(*)

    Hi,
    Could any one please help me....
    Here are my queries
    1. select * from my_vew
    2. select count(*) from my_view
    Explain plan on the above queries are giving differnt plans. I would like to get the plan for count(*) as exactkly same as query no 1. Even I tried explain plan for the below query, which is also not giving the same plan..
    select count(*) from (select * from my_view);
    All I am trying to do here is to find the total run time without spending much time on passing the result to the client over a network (I beleive set autotrace traceonly option is also passing the result to the network.. only thing is that traceonly option wont display the results). count(*) query is chaning the plan in many ways such as index scan in place of full_table scan and etc.,
    Thanks in advance.
    Vasanth

    why you want select count(*) from <table>,cause count(*) did single call neednt arraysize to be big which in turn less
    LIO,when less LIO then high throughput which is not the case with select * from <table>,i dont know the internals of count(*)
    but there would be some mechanics behind this code which always return with less IO
    SQL> conn scott/tiger
    Connected.
    SQL> column plan_plus_exp format a100
    SQL> set linesize 1000
    SQL> desc t
    Name                                                                                                                  
    A                                                                                                                     
    OBJECT_NAME                                                                                                           
    SQL> select index_name from user_indexes where lower(table_name)='t'
      2  /
    no rows selected
    SQL> select count(*) from t
      2  /
      COUNT(*)
         23486
    SQL> set autotrace traceonly
    SQL> select * from t
      2  /
    23486 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=13 Card=23486 Bytes=681094)
       1    0   TABLE ACCESS (FULL) OF 'T' (Cost=13 Card=23486 Bytes=681094)
    Statistics
             23  recursive calls
              0  db block gets
           1678  consistent gets
              0  physical reads
              0  redo size
         923712  bytes sent via SQL*Net to client
          17714  bytes received via SQL*Net from client
           1567  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
          23486  rows processed
    SQL> select count(*) from t
      2  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=13 Card=1)
       1    0   SORT (AGGREGATE)
       2    1     TABLE ACCESS (FULL) OF 'T' (Cost=13 Card=23486)
    Statistics
              0  recursive calls
              0  db block gets
            118  consistent gets
              0  physical reads
              0  redo size
            381  bytes sent via SQL*Net to client
            499  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processedyou need to compare boths query result consistent gets as well bytes sent via SQL*Net to client and bytes received via SQL*Net from client.
    What yours requirment to get alls record as well as maximum throughput,its not the way to do.Just a clue try to implement bulk collect in this case.
    Khurram

  • How do you view the execution plan of a query?

    I want to see if a particular index was used for a specific query....

    Becareful. You are in the Forum of OBIEE. It's much more a database question.
    You can read an plan with a lot of tool. Toad permit it and I assume that Sql Developer also must give it.
    Otherwise, you can use the basic command of Oracle as explain plan :
    http://gerardnico.com/wiki/database/oracle/explain_plan
    Cheers
    Nico

  • How to get execution plan in a CLOB?

    Hello,
    I want to get execution plans of a query in a CLOB format. I am trying to run following query against v$sql view. One of the columns I want is the execution plan for the query. I am getting following error. Eventually, I am going to insert this data into a log table to keep history of all SQLs and their execution plans.
    How can I do that?
    Thank you in advance.
    SQL> SELECT sql_id,
      2         plan_hash_value,
      3         TO_CLOB (DBMS_XPLAN.display_awr (sql_id            => sql_id,
      4                                          plan_hash_value   => plan_hash_value,
      5                                          format            => '+PEEKED_BINDS'))
      6            sql_plan_clob,
      7         buffer_gets,
      8         executions
      9    FROM v$sql
    10   WHERE ROWNUM < 5;
           TO_CLOB (DBMS_XPLAN.display_awr (sql_id            => sql_id,
    ERROR at line 3:
    ORA-00932: inconsistent datatypes: expected NUMBER got SYS.DBMS_XPLAN_TYPE_TABLE

    try first
    select *
      from table(DBMS_XPLAN.display_awr(sql_id          => sql_id,
                                        plan_hash_value => plan_hash_value,
                                        format          => '+PEEKED_BINDS'
                )to see the table returned
    then try to adapt http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:68212348056 to produce fixed length rows.
    look for describe_columns procedures in http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_sql.htm#i1025449 for column length information available in internal tables and write the rows directly to clob instead of writing to disk and loading your clob from there.
    Regards
    Etbin
    Edited by: Etbin on 31.10.2012 19:56
    pointing to dbms_sql package added

  • Oracle 10g Diff in execution plan query with binding var Vs without

    We recently did 10g upgrade. In 10g, execution plan differs for query with binding var(thru jdbc etc) Vs without it as given below. For query with binding var,
    it chooses poor execution plan(no index is used, full scan is done etc). everything worked fine in 9i. To rectify the problem, we have to hint query with right index,join etc. but i dont like this solution.
    I would rather prefer to correct database to choose right execution path instead of eacy query level. but not sure what causes the issue.
    Does anybody came across this issue? if so, Please share your experiences. Thanks for the help. Do let me know if you need more info.
    1. Query without binding bar:
    select * from test where col1 = :1 and col2 = :2
    1. Query without binding bar:
    select * from test where col1 = 'foo' and col2= 'bar'

    I am not an expert but in my humble opinion it is the developer's responsability to ensure the correct explain plan is used before deploying code to production, if the explain plan returned by the DB is bad, then the use of a hint is perfectly acceptable.
    Check this out: http://lcgapp.cern.ch/project/CondDB/snapshot/performance.html
    Excerpt:
    Bind variable peeking. If an SQL query contains bind variables, the optimal execution plan may depend on the values of those variables. When the Oracle query optimizer chooses the execution plan for such a query, it may indeed look at the values of all bind variables involved: this is known as "bind variable peeking".
    In summary, the execution plan used for a given SQL query cannot be predicted a priori because it depends on the presence and quality of statistics and on the values of bind variables used at the time the query was first executed (hard-parsed). As a consequence of this instability of execution plans, very different performances may be observed for the same SQL query. In COOL, this issue is addressed by adding Oracle hints to the queries, to make sure that the same (good) plan is used in all cases, even with unreliable statistics or unfavourable bind variables.
    Edited by: Rodolfo Ferrari on Jun 3, 2009 9:40 PM

  • Query Rewrite (QSM-01263) and Views in Execution Plan

    Hello!
    I created a query rewrite enabled materialized view from a query, which contains only tables (no views). Query rewrite didn't work, so i checked the query with dbms_mview.explan_rewrite, which told my that my query contains references to views or dictionary tables. I checked my query again, but there are only tables, no views, no dictionary tables.
    When I look in the execution plan of my query I see that the query optimizer generates views, I guess from my subquery (?). "A view definition was processed, either from a stored view...or as defined by steps...".
    I suppose that's the reason why my query rewrite doesn't work. All my other mat views are working fine, so the usual parameters (query_rewrite_enabled, integrity, etc.) are set correctly.
    Do you have any ideas how to get my query rewrite enabled work?
    Thanks!

    Modifying the query (potentially with hints) so that Oracle doesn't do the view transformation would be one option.

  • Very different execution plan in Oracle 10g vs. 9i

    Good afternoon,
    A few days ago I migrated an Oracle database 9i to 10g.
    Right now I have an exact copy of the 9i instance running on another machine.
    I noticed that the time for some queries take much more. For example, when comparing the execution plan for this query on the instance with Oracle 9i and Oracle 10g instance, I see that the cost in 10g is 94981765382, while in 9i is 120106.
    Any idea what might be happening?
    Execution Plan Oracle 9: http://blog.davidlozanolucas.com/uploads/execution_plan_Oracle_9i.jpg
    Execution Plan Oracle 10g: http://blog.davidlozanolucas.com/uploads/execution_plan_Oracle_10g.jpg
    Edited by: david_lozano_lucas on Dec 14, 2011 4:54 PM

    Sorry,
    Here are the details.
    For Oracle 9i:
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 16M| 3675M| | 120K (0)| | | | | |
    |* 1 | FILTER | | | | | | | | | | |
    |* 2 | HASH JOIN | | 16M| 3675M| | 120K (0)| | | 03,09 | P->S | QC (RAND) |
    | 3 | TABLE ACCESS FULL | ORG_LOC_DM | 2261 | 13566 | | 8 (0)| | | 03,01 | S->P | HASH |
    |* 4 | HASH JOIN OUTER | | 16M| 3582M| 1023M| 120K (0)| | | 03,08 | P->P | HASH |
    |* 5 | HASH JOIN OUTER | | 16M| 2783M| 1041M| 102K (0)| | | 03,08 | PCWP | |
    |* 6 | HASH JOIN OUTER | | 16M| 2521M| 715M| 69515 (0)| | | 03,08 | PCWP | |
    | 7 | PARTITION RANGE ALL | | | | | | 1 | 14 | 03,08 | PCWP | |
    | 8 | TABLE ACCESS FULL | SURT_SKU_LD_DM | 16M| 1922M| | 60988 (0)| 1 | 14 | 03,04 | P->P | HASH |
    | 9 | VIEW | | 909K| 33M| | | | | 03,05 | P->P | HASH |
    | 10 | SORT GROUP BY | | 909K| 19M| 62M| 1553 (0)| | | 03,05 | PCWP | |
    |* 11 | HASH JOIN | | 909K| 19M| | 164 (0)| | | 03,05 | PCWP | |
    |* 12 | TABLE ACCESS FULL| ORG_LOC_DM | 1131 | 6786 | | 8 (0)| | | 03,00 | S->P | HASH |
    |* 13 | TABLE ACCESS FULL| INV_MOVE_SKU_LCM_DM | 909K| 13M| | 154 (0)| 60 | 60 | 03,02 | P->P | HASH |
    |* 14 | TABLE ACCESS FULL | SURT_SKU_LCM_DM | 16M| 260M| | 6457 (0)| 59 | 59 | 03,06 | P->P | HASH |
    | 15 | VIEW | | 1795K| 89M| | | | | 03,07 | P->P | HASH |
    | 16 | SORT GROUP BY | | 1795K| 63M| 233M| 4565 (0)| | | 03,07 | PCWP | |
    |* 17 | TABLE ACCESS FULL | SLS_SKU_LCM_DM | 1795K| 63M| | 599 (0)| 60 | 60 | 03,03 | P->P | HASH |
    | 18 | NESTED LOOPS | | 1 | 16 | | 7 (15)| | | | | |
    | 19 | TABLE ACCESS FULL | MAINT_LOAD_DT | 1 | 8 | | 1 (0)| | | | | |
    |* 20 | INDEX RANGE SCAN | DAY_IDNT_I1 | 1 | 8 | | 1 (0)| | | | | |
    Predicate Information (identified by operation id):
    1 - filter("SYS_ALIAS_1"."DAY_IDNT"= (SELECT /*+ */ :B1 FROM "RDW91_DM"."MAINT_LOAD_DT" "Y","RDW91_DM"."TIME_DAY_DM" "X" WHERE
    "X"."DAY_DT"="Y"."CURR_LOAD_DT"))
    2 - access("SYS_ALIAS_1"."LOC_KEY"="G"."LOC_KEY")
    4 - access("SYS_ALIAS_1"."LOC_KEY"="I"."LOC_KEY"(+) AND "SYS_ALIAS_1"."SKU_KEY"="I"."SKU_KEY"(+))
    5 - access("SYS_ALIAS_1"."LOC_KEY"="B"."LOC_KEY"(+) AND "SYS_ALIAS_1"."SKU_KEY"="B"."SKU_KEY"(+))
    6 - access("SYS_ALIAS_1"."LOC_KEY"="J"."LOC_KEY"(+) AND "SYS_ALIAS_1"."SKU_KEY"="J"."SKU_KEY"(+))
    11 - access("A"."LOC_KEY"="B"."LOC_KEY")
    12 - filter("B"."LOC_TYPE_CDE"='W')
    13 - filter("A"."CMTH_IDNT"=201112)
    14 - filter("B"."CMTH_IDNT"(+)=201111)
    17 - filter("SLS_SKU_LCM_DM"."CMTH_IDNT"=201112)
    20 - access("X"."DAY_DT"="Y"."CURR_LOAD_DT")
    For 10g:
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 16M| 3685M| | 94G| | | | | |
    | 1 | FILTER | | | | | | | | | | |
    | 2 | PX COORDINATOR | | | | | | | | | | |
    | 3 | PX SEND QC (RANDOM) | :TQ10008 | 16M| 3685M| | 94G| | | Q1,08 | P->S | QC (RAND) |
    | 4 | BUFFER SORT | | 16M| 3685M| | | | | Q1,08 | PCWP | |
    | 5 | NESTED LOOPS OUTER | | 16M| 3685M| | 94G| | | Q1,08 | PCWP | |
    | 6 | HASH JOIN | | 16M| 3424M| | 201K| | | Q1,08 | PCWP | |
    | 7 | BUFFER SORT | | | | | | | | Q1,08 | PCWC | |
    | 8 | PX RECEIVE | | 2261 | 13566 | | 8 | | | Q1,08 | PCWP | |
    | 9 | PX SEND HASH | :TQ10001 | 2261 | 13566 | | 8 | | | | S->P | HASH |
    | 10 | TABLE ACCESS FULL | ORG_LOC_DM | 2261 | 13566 | | 8 | | | | | |
    | 11 | PX RECEIVE | | 16M| 3332M| | 201K| | | Q1,08 | PCWP | |
    | 12 | PX SEND HASH | :TQ10007 | 16M| 3332M| | 201K| | | Q1,07 | P->P | HASH |
    | 13 | HASH JOIN OUTER BUFFERED | | 16M| 3332M| 982M| 201K| | | Q1,07 | PCWP | |
    | 14 | HASH JOIN OUTER | | 16M| 2733M| 735M| 127K| | | Q1,07 | PCWP | |
    | 15 | PX RECEIVE | | 16M| 1934M| | 75785 | | | Q1,07 | PCWP | |
    | 16 | PX SEND HASH | :TQ10004 | 16M| 1934M| | 75785 | | | Q1,04 | P->P | HASH |
    | 17 | PX BLOCK ITERATOR | | 16M| 1934M| | 75785 | 1 | 14 | Q1,04 | PCWC | |
    | 18 | TABLE ACCESS FULL | SURT_SKU_LD_DM | 16M| 1934M| | 75785 | 1 | 14 | Q1,04 | PCWP | |
    | 19 | PX RECEIVE | | 1450K| 71M| | 3892 | | | Q1,07 | PCWP | |
    | 20 | PX SEND HASH | :TQ10005 | 1450K| 71M| | 3892 | | | Q1,05 | P->P | HASH |
    | 21 | VIEW | | 1450K| 71M| | 3892 | | | Q1,05 | PCWP | |
    | 22 | SORT GROUP BY | | 1450K| 53M| 188M| 3892 | | | Q1,05 | PCWP | |
    | 23 | PX RECEIVE | | 1450K| 53M| | 562 | | | Q1,05 | PCWP | |
    | 24 | PX SEND HASH | :TQ10002 | 1450K| 53M| | 562 | | | Q1,02 | P->P | HASH |
    | 25 | PX BLOCK ITERATOR | | 1450K| 53M| | 562 | 60 | 60 | Q1,02 | PCWC | |
    | 26 | MAT_VIEW ACCESS FULL| SLS_SKU_LCM_DM | 1450K| 53M| | 562 | 60 | 60 | Q1,02 | PCWP | |
    | 27 | PX RECEIVE | | 652K| 24M| | 1150 | | | Q1,07 | PCWP | |
    | 28 | PX SEND HASH | :TQ10006 | 652K| 24M| | 1150 | | | Q1,06 | P->P | HASH |
    | 29 | VIEW | | 652K| 24M| | 1150 | | | Q1,06 | PCWP | |
    | 30 | SORT GROUP BY | | 652K| 14M| | 1150 | | | Q1,06 | PCWP | |
    | 31 | HASH JOIN | | 652K| 14M| | 128 | | | Q1,06 | PCWP | |
    | 32 | BUFFER SORT | | | | | | | | Q1,06 | PCWC | |
    | 33 | PX RECEIVE | | 1131 | 6786 | | 8 | | | Q1,06 | PCWP | |
    | 34 | PX SEND HASH | :TQ10000 | 1131 | 6786 | | 8 | | | | S->P | HASH |
    | 35 | TABLE ACCESS FULL | ORG_LOC_DM | 1131 | 6786 | | 8 | | | | | |
    | 36 | PX RECEIVE | | 652K| 10M| | 118 | | | Q1,06 | PCWP | |
    | 37 | PX SEND HASH | :TQ10003 | 652K| 10M| | 118 | | | Q1,03 | P->P | HASH |
    | 38 | PX BLOCK ITERATOR | | 652K| 10M| | 118 | 60 | 60 | Q1,03 | PCWC | |
    | 39 | MAT_VIEW ACCESS FULL| INV_MOVE_SKU_LCM_DM | 652K| 10M| | 118 | 60 | 60 | Q1,03 | PCWP | |
    | 40 | PARTITION RANGE SINGLE | | 1 | 17 | | 8609 | 59 | 59 | Q1,08 | PCWP | |
    | 41 | TABLE ACCESS FULL | SURT_SKU_LCM_DM | 1 | 17 | | 8609 | 59 | 59 | Q1,08 | PCWP | |
    | 42 | NESTED LOOPS | | 1 | 16 | | 6 | | | | | |
    | 43 | TABLE ACCESS FULL | MAINT_LOAD_DT | 1 | 8 | | 1 | | | | | |
    | 44 | INDEX RANGE SCAN | DAY_IDNT_I1 | 1 | 8 | | 5 | | | | | |
    Note
    - 'PLAN_TABLE' is old version
    - cpu costing is off (consider enabling it)

  • Same Query returning different result (Different execution plan)

    Hi all,
    To day i have discovered a strange thing: a query that return a different result when using a different execution plan.
    The query :
    SELECT  *
      FROM schema.table@database a
    WHERE     column1 IN ('3')
           AND column2 = '101'
           AND EXISTS
                  (SELECT null
                     FROM schema.table2 c
                    WHERE a.column3 = SUBSTR (c.column1, 2, 12));where schema.table@database is a remote table.
    when executed with the hint /*+ ordered use_nl(a c) */ these query return no result and its execution plan is :
    Rows     Row Source Operation
          0  NESTED LOOPS  (cr=31 r=0 w=0 time=4894659 us)
       4323   SORT UNIQUE (cr=31 r=0 w=0 time=50835 us)
       4336    TABLE ACCESS FULL TABLE2 (cr=31 r=0 w=0 time=7607 us)
          0   REMOTE  (cr=0 r=0 w=0 time=130536 us)When i changed the execution plan with the hint /*+ use_hash(c a) */
    Rows     Row Source Operation
       3702  HASH JOIN SEMI (cr=35 r=0 w=0 time=497839 us)
      22556   REMOTE  (cr=0 r=0 w=0 time=401176 us)
       4336   TABLE ACCESS FULL TABLE2 (cr=35 r=0 w=0 time=7709 us)It seem that when the execution plan have changed the remote query return no result.
    It'is a bug or i have missed somthing ?
    PS: The two table are no subject to insert or update statement.
    Oracle version : 9.2.0.2.0
    System version : HP-UX v1
    Thanks.

    H.Mahmoud wrote:
    Oracle version : 9.2.0.2.0
    System version : HP-UX v1Hard to say. You're using a very old and deprecated version of the database, and one that was known to contain bugs.
    9.2.0.7 was really the lowest version of 9i that was considered to be 'stable', but even so, it's old and lacking in many ways.
    Consider upgrading to the latest database version at your earliest opportunity. (or at least apply patches up to the latest 9i version before querying if there is bugs in your really low buggy version)

  • Explain SQL Query execution plan: Oracle

    Dear Masters,
    Kindly help me to understand execution plan for an SQL statement. I have following SQL execution plan for a query in system. How should I interpret it. I thank You in advace for your guidance.
    SELECT STATEMENT ( Estimated Costs = 1.372.413 , Estimated #Rows = 0 )
           5 NESTED LOOPS
             ( Estim. Costs = 1.372.413 , Estim. #Rows = 3.125 )
             Estim. CPU-Costs = 55.798.978.498 Estim. IO-Costs = 1.366.482
               2 TABLE ACCESS BY INDEX ROWID MSEG
                 ( Estim. Costs = 1.326.343 , Estim. #Rows = 76.717 )
                 Estim. CPU-Costs = 55.429.596.575 Estim. IO-Costs = 1.320.451
                 Filter Predicates
                   1 INDEX RANGE SCAN MSEG~R
                     ( Estim. Costs = 89.322 , Estim. #Rows = 60.069.500 )
                     Search Columns: 1
                     Estim. CPU-Costs = 2.946.739.229 Estim. IO-Costs = 89.009
                     Access Predicates
               4 TABLE ACCESS BY INDEX ROWID MKPF
                 ( Estim. Costs = 1 , Estim. #Rows = 1 )
                 Estim. CPU-Costs = 4.815 Estim. IO-Costs = 1
                 Filter Predicates
                   3 INDEX UNIQUE SCAN MKPF~0
                     Search Columns: 3
                     Estim. CPU-Costs = 3.229 Estim. IO-Costs = 0
                     Access Predicates

    Hi Panjak,
    Yeahh, there's a huge unperformatic SQL statment, what I can see from this acces plan is:
    1 DBO decided to start the query on index R on MSEG, using only part of the index (only one column) with no good uniqueness, accessing disk IO-Costs for this (60mi records), and expecting many interactions (loops) in memory to filter, see CPU-Costs.
    So with the parameters you gave to SQL, they start in a very bad way.
    2 After that program will access the MSEG commanded by what was found on First step, also with a huge loading from DB and filtering (another where criteria on MSEG fields, not found on index R), reducing the result set to 76.717 rows.
    3/4 With this, program goes direct to primary key index on MKPF with direct access (optimized access) and follow to access database table MKPF.
    5 At last will "loop" the result sets from MSEG and MKPF, mixing the tuplas generating the final result set.
    Do you want to share your SQL, the parameters you are sending and code which generate it with us?
    Regards, Fernando Da Ró

  • About Execution Plan in OBIEE

    Friends,
    As we know when creating the BMM layer we can, for ex., create one logical table
    which includes columns from two or more different physical tables and OBIEE generates
    smth like a view internally.
    But what about the execution plan of the query?
    What happens if the size of the table chnages and the old plan is not that good anymore?
    Is it somehow possible to control the Execution Plan, maybe in BMM layer, in OBIEE?
    Thanks in advance.

    "The performance problem is not in the writting of the query but on its path (execution plan). In the way where the database will retrieve the data."
    I wouldnt say that its always the way WHERE the database will retrieve data but HOW as well, sometimes.
    Indeed a lot of options availbale to speed up the preformance of a query but during my own year old
    experience with Oracle Ive come across not few scripts that didnt require creation of any temporary table,
    materilaized views or smth. All I needed to do is just rewrite the query and thats it.
    "....execute the best explain plan...." Personally I came across a lot of queries with the tables having the freshest statistics and so on that Oracle would choose not the best plan and the one it chose didnt execute that fast as if I would set up my own plan for it.
    Yes the internal algorithm may decide that this plan is the best but as experience show its not always true.
    All I was asking is if there is a way to control the plan in OBIEE or not........

Maybe you are looking for

  • How do you sync your ipod to your itunes without loseing all your music?

    Some how my itunes deleted all music (everything except my purchased music and I dont have my other music anywhere else only on my ipod.). Today I tryed to add a new Cd but i cant do that untill i get all my music from my ipod back into itunes by syn

  • Trying to view playback on an external monitor

    I need help understanding why I can't view my playback correctly. I've tried what I think is all troubleshooting possibilities. I am running FW out into an XL2 to a NTSC monitor. View/External Monitor/All Frames is selected and I have tried an array

  • Downloading Previous Purchases?

    My bosses' computer got wiped yesterday and unfortunately he has no backups of his music. I'm trying to help him out by restoring his previous purchases on iTunes but it seems I've run into a little problem... He started the download (of all the prev

  • F4 help for PO number field with SELECT OPTIONS

    Hi all, I have a field (PO no) using SELECT OPTIONS on my selection screen.I need F4 help for this field.How shud i declare it? I have declared it as follows: SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. select-options sel_po for ZPO

  • Using different content with template tag (struts)

    I developed a page according to the examples on the following link. http://jakarta.apache.org/struts/api/org/apache/struts/taglib/template/package-summary.html my problem is, that i want to use different pages as content. How can i do this?? do i nee