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

Similar Messages

  • Query plan changes when query is used in CREATE TABLE AS

    We've puzzled by the fact that EXPLAIN PLAN gives a much different output for a SELECT statement than it does when the same statement is used for CREATE TABLE . . . AS SELECT.
    The bad part is that the CREATE TABLE version performs very badly, and that's what we want the query for.
    Why does this happen? Is there a difference (from the database's point of view) between retrieving a set of rows to display to the user and putting that same set into a new table? Doesn't this make it harder to diagnose and fix query performance problems?
    Here's our query:
    create table query_test AS
    select term, parentTerm, apidb.tab_to_string(cast(collect(trim(to_char(internal)))
                       as apidb.varchartab), ', ') as internal
                 from (
                     select distinct ga.organism as term,
                                     ga.species as parentTerm,
                                     tn.taxon_id as internal
                     from apidb.GeneAttributes ga, SRES.TaxonName tn, sres.Taxon t,
                          dots.AaSequence aas, dots.SecondaryStructure ss
                     where ga.organism = tn.name
               and tn.taxon_id = t.taxon_id
                       and t.taxon_id = aas.taxon_id
       and aas.aa_sequence_id = ss.aa_sequence_id
               and t.rank != 'species'
               union
                     select distinct ga.species as term,
                       '' as parentTerm,
                                     ts.taxon_id as internal
                     from apidb.GeneAttributes ga, SRES.TaxonName tn, apidb.taxonSpecies ts,
                          dots.aasequence aas, dots.SecondaryStructure ss
                     where ga.organism = tn.name
                      and tn.taxon_id = ts.taxon_id
                      and ts.taxon_id = aas.taxon_id
                     and aas.aa_sequence_id = ss.aa_sequence_id
       group by term,parentTerm;Without the CREATE TABLE, the plan looks like this:
    | Id  | Operation                             | Name                      | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | CREATE TABLE STATEMENT                |                           |  2911 |  5986K|       | 18840   (1)| 00:03:47 |
    |   1 |  LOAD AS SELECT                       | QUERY_TEST                |       |       |       |            |          |
    |   2 |   VIEW                                |                           |  2911 |  5986K|       | 18669   (1)| 00:03:45 |
    |   3 |    SORT GROUP BY                      |                           |  2911 |   332K|       | 18660   (1)| 00:03:44 |
    |   4 |     VIEW                              |                           |  2911 |   332K|       | 18659   (1)| 00:03:44 |
    |   5 |      SORT UNIQUE                      |                           |  2911 |   292K|       | 18659   (6)| 00:03:44 |
    |   6 |       UNION-ALL                       |                           |       |       |       |            |          |
    |*  7 |        HASH JOIN                      |                           |  2907 |   292K|  2160K| 17762   (1)| 00:03:34 |
    |   8 |         TABLE ACCESS FULL             | GENEATTRIBUTES10650       | 40957 |  1679K|       |   795   (1)| 00:00:10 |
    |*  9 |         HASH JOIN                     |                           | 53794 |  3204K|  1552K| 16675   (1)| 00:03:21 |
    |* 10 |          HASH JOIN                    |                           | 37802 |  1107K|       | 12326   (1)| 00:02:28 |
    |* 11 |           HASH JOIN                   |                           | 37945 |   629K|       | 10874   (1)| 00:02:11 |
    |  12 |            INDEX FAST FULL SCAN       | SECONDARYSTRUCTURE_REVIX9 | 37945 |   222K|       |    33   (0)| 00:00:01 |
    |  13 |            INDEX FAST FULL SCAN       | AASEQUENCEIMP_REVIX6      |  7886K|    82M|       | 10816   (1)| 00:02:10 |
    |* 14 |           TABLE ACCESS FULL           | TAXON                     |   514K|  6530K|       |  1450   (1)| 00:00:18 |
    |  15 |          TABLE ACCESS FULL            | TAXONNAME                 |   760K|    22M|       |  2721   (1)| 00:00:33 |
    |* 16 |        HASH JOIN                      |                           |     4 |   380 |       |   886   (1)| 00:00:11 |
    |  17 |         NESTED LOOPS                  |                           |   730 | 64970 |       |   852   (1)| 00:00:11 |
    |* 18 |          HASH JOIN                    |                           |     1 |    78 |       |   847   (1)| 00:00:11 |
    |  19 |           NESTED LOOPS                |                           |       |       |       |            |          |
    |  20 |            NESTED LOOPS               |                           |    17 |   612 |       |    51   (0)| 00:00:01 |
    |  21 |             TABLE ACCESS FULL         | TAXONSPECIES10646         |    12 |    60 |       |     3   (0)| 00:00:01 |
    |* 22 |             INDEX RANGE SCAN          | TAXONNAME_IND01           |     1 |       |       |     2   (0)| 00:00:01 |
    |  23 |            TABLE ACCESS BY INDEX ROWID| TAXONNAME                 |     1 |    31 |       |     4   (0)| 00:00:01 |
    |  24 |           TABLE ACCESS FULL           | GENEATTRIBUTES10650       | 40957 |  1679K|       |   795   (1)| 00:00:10 |
    |* 25 |          INDEX RANGE SCAN             | AASEQUENCEIMP_REVIX6      |   768 |  8448 |       |     5   (0)| 00:00:01 |
    |  26 |         INDEX FAST FULL SCAN          | SECONDARYSTRUCTURE_REVIX9 | 37945 |   222K|       |    33   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       7 - access("GA"."ORGANISM"="TN"."NAME")
       9 - access("TN"."TAXON_ID"="T"."TAXON_ID")
      10 - access("T"."TAXON_ID"="TAXON_ID")
      11 - access("AA_SEQUENCE_ID"="SS"."AA_SEQUENCE_ID")
      14 - filter("T"."RANK"<>'species')
      16 - access("AA_SEQUENCE_ID"="SS"."AA_SEQUENCE_ID")
      18 - access("GA"."ORGANISM"="TN"."NAME")
      22 - access("TN"."TAXON_ID"="TS"."TAXON_ID")
      25 - access("TS"."TAXON_ID"="TAXON_ID")
    46 rows selected.With the CREATE TABLE, the plan for the SELECT alone looks like this:
    | Id  | Operation                           | Name                      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                    |                           |     2 |   234 |  1786   (1)| 00:00:22 |
    |   1 |  SORT GROUP BY                      |                           |     2 |   234 |  1786   (1)| 00:00:22 |
    |   2 |   VIEW                              |                           |     2 |   234 |  1785   (1)| 00:00:22 |
    |   3 |    SORT UNIQUE                      |                           |     2 |   198 |  1785  (48)| 00:00:22 |
    |   4 |     UNION-ALL                       |                           |       |       |            |          |
    |*  5 |      HASH JOIN                      |                           |     1 |   103 |   949   (1)| 00:00:12 |
    |   6 |       NESTED LOOPS                  |                           |   199 | 19303 |   915   (1)| 00:00:11 |
    |   7 |        NESTED LOOPS                 |                           |    13 |  1118 |   850   (1)| 00:00:11 |
    |   8 |         NESTED LOOPS                |                           |    13 |   949 |   824   (1)| 00:00:10 |
    |   9 |          VIEW                       | VW_DTP_E387155E           |    13 |   546 |   797   (1)| 00:00:10 |
    |  10 |           HASH UNIQUE               |                           |    13 |   546 |   797   (1)| 00:00:10 |
    |  11 |            TABLE ACCESS FULL        | GENEATTRIBUTES10650       | 40957 |  1679K|   795   (1)| 00:00:10 |
    |  12 |          TABLE ACCESS BY INDEX ROWID| TAXONNAME                 |     1 |    31 |     3   (0)| 00:00:01 |
    |* 13 |           INDEX RANGE SCAN          | TAXONNAME_IND02           |     1 |       |     2   (0)| 00:00:01 |
    |* 14 |         TABLE ACCESS BY INDEX ROWID | TAXON                     |     1 |    13 |     2   (0)| 00:00:01 |
    |* 15 |          INDEX UNIQUE SCAN          | PK_TAXON                  |     1 |       |     1   (0)| 00:00:01 |
    |* 16 |        INDEX RANGE SCAN             | AASEQUENCEIMP_REVIX6      |    15 |   165 |     5   (0)| 00:00:01 |
    |  17 |       INDEX FAST FULL SCAN          | SECONDARYSTRUCTURE_REVIX9 | 37945 |   222K|    33   (0)| 00:00:01 |
    |  18 |      NESTED LOOPS                   |                           |     1 |    95 |   834   (1)| 00:00:11 |
    |  19 |       NESTED LOOPS                  |                           |     1 |    89 |   833   (1)| 00:00:10 |
    |* 20 |        HASH JOIN                    |                           |     1 |    78 |   828   (1)| 00:00:10 |
    |  21 |         NESTED LOOPS                |                           |       |       |            |          |
    |  22 |          NESTED LOOPS               |                           |    13 |   949 |   824   (1)| 00:00:10 |
    |  23 |           VIEW                      | VW_DTP_2AAE9FCE           |    13 |   546 |   797   (1)| 00:00:10 |
    |  24 |            HASH UNIQUE              |                           |    13 |   546 |   797   (1)| 00:00:10 |
    |  25 |             TABLE ACCESS FULL       | GENEATTRIBUTES10650       | 40957 |  1679K|   795   (1)| 00:00:10 |
    |* 26 |           INDEX RANGE SCAN          | TAXONNAME_IND02           |     1 |       |     2   (0)| 00:00:01 |
    |  27 |          TABLE ACCESS BY INDEX ROWID| TAXONNAME                 |     1 |    31 |     3   (0)| 00:00:01 |
    |  28 |         TABLE ACCESS FULL           | TAXONSPECIES10646         |    12 |    60 |     3   (0)| 00:00:01 |
    |* 29 |        INDEX RANGE SCAN             | AASEQUENCEIMP_REVIX6      |   768 |  8448 |     5   (0)| 00:00:01 |
    |* 30 |       INDEX RANGE SCAN              | SECONDARYSTRUCTURE_REVIX9 |     1 |     6 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - access("AA_SEQUENCE_ID"="SS"."AA_SEQUENCE_ID")
      13 - access("ITEM_1"="TN"."NAME")
      14 - filter("T"."RANK"<>'species')
      15 - access("TN"."TAXON_ID"="T"."TAXON_ID")
      16 - access("T"."TAXON_ID"="TAXON_ID")
      20 - access("TN"."TAXON_ID"="TS"."TAXON_ID")
      26 - access("ITEM_1"="TN"."NAME")
      29 - access("TS"."TAXON_ID"="TAXON_ID")
      30 - access("AA_SEQUENCE_ID"="SS"."AA_SEQUENCE_ID")
    50 rows selected.Edited by: JohnI on Jul 18, 2011 2:19 PM
    Edited by: JohnI on Jul 18, 2011 2:28 PM

    Charles Hooper wrote a series of blog entries on a similar topic some time ago: http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/ (including a lot of useful comments) and two following articles. I have to confess that I did not read the posts again - but I think you will find some good ideas how to analyze the problem.
    Regards
    Martin Preiss

  • 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • 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/

  • 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.

  • Query Execution Plans Change between 2 servers even when we have same data.

    Hi Friends,
    Currently One of the Query which normally takes 15 seconds but it started taking 160 seconds.So same query was executed on the secondary site and the query returned in 15 seconds which is expected.Raised a call with ORacle and they are still investigating since 27th Sept.
    Oracle version=11.2.0.2
    OS=Solaris 10.
    Issue DB execution plan
    select * From  tibex_openinghomemktok as of scn 17032999332 where meid='ME1'
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.12       0.12          0          0          0           0
    Execute      1    161.20     161.21         55    1539719        206           0
    Fetch        6      0.05       0.05        190        386          1         464
    total        8    161.37     161.38        245    1540105        207         464
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 191
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
           464        464        464  VIEW  TIBEX_OPENINGHOMEMKTOK (cr=1540105 pr=245 pw=191 time=161246176 us cost=149 size=291 card=1)
           464        464        464   TEMP TABLE TRANSFORMATION  (cr=1540105 pr=245 pw=191 time=161245860 us)
             0          0          0    LOAD AS SELECT  (cr=27 pr=0 pw=1 time=24101 us)
            13         13         13     HASH JOIN  (cr=27 pr=0 pw=0 time=13149 us cost=35 size=1408 card=8)
             1          1          1      TABLE ACCESS FULL TIBEX_TRADINGMETHODENUM (cr=2 pr=0 pw=0 time=83 us cost=5 size=14 card=1)
           235        235        235      HASH JOIN  (cr=25 pr=0 pw=0 time=12612 us cost=30 size=22356 card=138)
           235        235        235       NESTED LOOPS OUTER (cr=21 pr=0 pw=0 time=11568 us cost=22 size=16560 card=138)
           235        235        235        HASH JOIN  (cr=20 pr=0 pw=0 time=10831 us cost=22 size=10074 card=138)
            40         40         40         HASH JOIN  (cr=18 pr=0 pw=0 time=8119 us cost=17 size=2200 card=40)
            40         40         40          HASH JOIN OUTER (cr=12 pr=0 pw=0 time=5920 us cost=13 size=1320 card=40)
            40         40         40           NESTED LOOPS  (cr=10 pr=0 pw=0 time=4155 us cost=3 size=800 card=40)
            80         80         80            VIEW  index$_join$_018 (cr=6 pr=0 pw=0 time=4245 us cost=3 size=1040 card=80)
            80         80         80             HASH JOIN  (cr=6 pr=0 pw=0 time=3057 us)
            80         80         80              INDEX FAST FULL SCAN XAK1TIBEX_TRADINGCYCLE (cr=3 pr=0 pw=0 time=169 us cost=1 size=1040 card=80)(object id 1354894)
            80         80         80              INDEX FAST FULL SCAN XPKTIBEX_TRADINGCYCLE (cr=3 pr=0 pw=0 time=70 us cost=1 size=1040 card=80)(object id 1354895)
            40         40         40            INDEX UNIQUE SCAN XPKTIBEX_DAYSTRADINGCYCLEMAP (cr=4 pr=0 pw=0 time=152 us cost=0 size=7 card=1)(object id 1354685)
             0          0          0           VIEW  (cr=2 pr=0 pw=0 time=316 us cost=10 size=143 card=11)
             0          0          0            HASH JOIN  (cr=2 pr=0 pw=0 time=315 us cost=8 size=352 card=11)
             0          0          0             MERGE JOIN  (cr=2 pr=0 pw=0 time=118 us cost=4 size=209 card=11)
             0          0          0              TABLE ACCESS BY INDEX ROWID TIBEX_HOLIDAYS (cr=2 pr=0 pw=0 time=113 us cost=2 size=26 card=2)
            83         83         83               INDEX FULL SCAN XPKTIBEX_HOLIDAYS (cr=1 pr=0 pw=0 time=113 us cost=1 size=0 card=83)(object id 1354737)
             0          0          0              SORT JOIN (cr=0 pr=0 pw=0 time=0 us cost=2 size=2412 card=402)
             0          0          0               INDEX FULL SCAN XPKTIBEX_HOLIDAYTRADINGCYCLEMA (cr=0 pr=0 pw=0 time=0 us cost=1 size=2412 card=402)(object id 1354739)
             0          0          0             VIEW  index$_join$_023 (cr=0 pr=0 pw=0 time=0 us cost=3 size=1040 card=80)
             0          0          0              HASH JOIN  (cr=0 pr=0 pw=0 time=0 us)
             0          0          0               INDEX FAST FULL SCAN XAK1TIBEX_TRADINGCYCLE (cr=0 pr=0 pw=0 time=0 us cost=1 size=1040 card=80)(object id 1354894)
             0          0          0               INDEX FAST FULL SCAN XPKTIBEX_TRADINGCYCLE (cr=0 pr=0 pw=0 time=0 us cost=1 size=1040 card=80)(object id 1354895)
            80         80         80          VIEW  index$_join$_024 (cr=6 pr=0 pw=0 time=1121 us cost=3 size=1760 card=80)
            80         80         80           HASH JOIN  (cr=6 pr=0 pw=0 time=1040 us)
            80         80         80            INDEX FAST FULL SCAN XAK1TIBEX_TRADINGCYCLE (cr=3 pr=0 pw=0 time=66 us cost=1 size=1760 card=80)(object id 1354894)
            80         80         80            INDEX FAST FULL SCAN XPKTIBEX_TRADINGCYCLE (cr=3 pr=0 pw=0 time=57 us cost=1 size=1760 card=80)(object id 1354895)
           275        275        275         TABLE ACCESS FULL TIBEX_CYCLEPERIODMAP (cr=2 pr=0 pw=0 time=229 us cost=5 size=4950 card=275)
             0          0          0        TABLE ACCESS BY INDEX ROWID TIBEX_CYCLEPERIODMAPOVER (cr=1 pr=0 pw=0 time=384 us cost=0 size=47 card=1)
             0          0          0         INDEX UNIQUE SCAN XPKTIBEX_CYCLEPERIODMAPOVER (cr=1 pr=0 pw=0 time=135 us cost=0 size=0 card=1)(object id 1354925)
           330        330        330       TABLE ACCESS FULL TIBEX_TRADINGPERIOD (cr=4 pr=0 pw=0 time=61 us cost=7 size=13860 card=330)
             0          0          0    LOAD AS SELECT  (cr=1539692 pr=55 pw=190 time=161190726 us)
         12435      12435      12435     NESTED LOOPS  (cr=1539692 pr=55 pw=0 time=158262964 us cost=109 size=284 card=1)
         12435      12435      12435      FILTER  (cr=1539688 pr=55 pw=0 time=158208902 us)
        497400     497400     497400       NESTED LOOPS OUTER (cr=1539688 pr=55 pw=0 time=212847780 us cost=109 size=280 card=1)
        497400     497400     497400        NESTED LOOPS  (cr=544888 pr=55 pw=0 time=60349504 us cost=108 size=267 card=1)
        497400     497400     497400         MERGE JOIN CARTESIAN (cr=47484 pr=55 pw=0 time=57182690 us cost=107 size=254 card=1)
         12435      12435      12435          NESTED LOOPS  (cr=47483 pr=55 pw=0 time=2368168 us cost=106 size=247 card=1)
         13877      13877      13877           NESTED LOOPS  (cr=33602 pr=55 pw=0 time=5930848 us cost=105 size=233 card=1)
          1473       1473       1473            NESTED LOOPS  (cr=212 pr=2 pw=0 time=9371 us cost=35 size=390 card=3)
            13         13         13             HASH JOIN  (cr=193 pr=1 pw=0 time=8029 us cost=34 size=116 card=1)
            13         13         13              NESTED LOOPS  (cr=191 pr=1 pw=0 time=7255 us cost=31 size=95 card=1)
           338        338        338               HASH JOIN  (cr=187 pr=1 pw=0 time=6329 us cost=31 size=2821 card=31)
            13         13         13                VIEW  VW_NSO_1 (cr=184 pr=1 pw=0 time=5958 us cost=26 size=26 card=1)
            13         13         13                 SORT GROUP BY (cr=184 pr=1 pw=0 time=5954 us cost=26 size=115 card=1)
            65         65         65                  NESTED LOOPS ANTI (cr=184 pr=1 pw=0 time=5898 us cost=25 size=115 card=1)
            78         78         78                   NESTED LOOPS  (cr=102 pr=1 pw=0 time=6140 us cost=24 size=101 card=1)
            78         78         78                    NESTED LOOPS OUTER (cr=20 pr=1 pw=0 time=5341 us cost=23 size=94 card=1)
            78         78         78                     HASH JOIN  (cr=19 pr=1 pw=0 time=5077 us cost=23 size=55 card=1)
            13         13         13                      HASH JOIN  (cr=17 pr=1 pw=0 time=4056 us cost=17 size=352 card=8)
            40         40         40                       NESTED LOOPS  (cr=13 pr=0 pw=0 time=3300 us cost=15 size=1480 card=40)
            40         40         40                        HASH JOIN OUTER (cr=9 pr=0 pw=0 time=2928 us cost=15 size=1320 card=40)
            40         40         40                         HASH JOIN  (cr=7 pr=0 pw=0 time=1976 us cost=5 size=800 card=40)
            40         40         40                          INDEX RANGE SCAN XPKTIBEX_DAYSTRADINGCYCLEMAP (cr=1 pr=0 pw=0 time=120 us cost=1 size=280 card=40)(object id 1354685)
            80         80         80                          VIEW  index$_join$_044 (cr=6 pr=0 pw=0 time=1251 us cost=3 size=1040 card=80)
            80         80         80                           HASH JOIN  (cr=6 pr=0 pw=0 time=1249 us)
            80         80         80                            INDEX FAST FULL SCAN XAK1TIBEX_TRADINGCYCLE (cr=3 pr=0 pw=0 time=70 us cost=1 size=1040 card=80)(object id 1354894)
            80         80         80                            INDEX FAST FULL SCAN XPKTIBEX_TRADINGCYCLE (cr=3 pr=0 pw=0 time=135 us cost=1 size=1040 card=80)(object id 1354895)
             0          0          0                         VIEW  (cr=2 pr=0 pw=0 time=295 us cost=10 size=143 card=11)
             0          0          0                          HASH JOIN  (cr=2 pr=0 pw=0 time=293 us cost=8 size=352 card=11)
             0          0          0                           MERGE JOIN  (cr=2 pr=0 pw=0 time=118 us cost=4 size=209 card=11)
             0          0          0                            TABLE ACCESS BY INDEX ROWID TIBEX_HOLIDAYS (cr=2 pr=0 pw=0 time=113 us cost=2 size=26 card=2)
            83         83         83                             INDEX FULL SCAN XPKTIBEX_HOLIDAYS (cr=1 pr=0 pw=0 time=116 us cost=1 size=0 card=83)(object id 1354737)
             0          0          0                            SORT JOIN (cr=0 pr=0 pw=0 time=0 us cost=2 size=2412 card=402)
             0          0          0                             INDEX FULL SCAN XPKTIBEX_HOLIDAYTRADINGCYCLEMA (cr=0 pr=0 pw=0 time=0 us cost=1 size=2412 card=402)(object id 135473
    9)
             0          0          0                           VIEW  index$_join$_049 (cr=0 pr=0 pw=0 time=0 us cost=3 size=1040 card=80)
             0          0          0                            HASH JOIN  (cr=0 pr=0 pw=0 time=0 us)
             0          0          0                             INDEX FAST FULL SCAN XAK1TIBEX_TRADINGCYCLE (cr=0 pr=0 pw=0 time=0 us cost=1 size=1040 card=80)(object id 1354894)
             0          0          0                             INDEX FAST FULL SCAN XPKTIBEX_TRADINGCYCLE (cr=0 pr=0 pw=0 time=0 us cost=1 size=1040 card=80)(object id 1354895)
            40         40         40                        INDEX UNIQUE SCAN XPKTIBEX_TRADINGCYCLE (cr=4 pr=0 pw=0 time=79 us cost=0 size=4 card=1)(object id 1354895)
            13         13         13                       VIEW  (cr=4 pr=1 pw=0 time=362 us cost=2 size=112 card=16)
            13         13         13                        TABLE ACCESS FULL SYS_TEMP_0FD9D660D_F7392ACA (cr=4 pr=1 pw=0 time=349 us cost=2 size=1216 card=16)
           275        275        275                      TABLE ACCESS FULL TIBEX_CYCLEPERIODMAP (cr=2 pr=0 pw=0 time=164 us cost=5 size=3025 card=275)
             0          0          0                     TABLE ACCESS BY INDEX ROWID TIBEX_CYCLEPERIODMAPOVER (cr=1 pr=0 pw=0 time=136 us cost=0 size=39 card=1)
             0          0          0                      INDEX UNIQUE SCAN XPKTIBEX_CYCLEPERIODMAPOVER (cr=1 pr=0 pw=0 time=52 us cost=0 size=0 card=1)(object id 1354925)
            78         78         78                    TABLE ACCESS BY INDEX ROWID TIBEX_TRADINGPERIOD (cr=82 pr=0 pw=0 time=343 us cost=1 size=7 card=1)
            78         78         78                     INDEX UNIQUE SCAN XPKTIBEX_TRADINGPERIOD (cr=4 pr=0 pw=0 time=144 us cost=0 size=0 card=1)(object id 1354899)
            13         13         13                   TABLE ACCESS BY INDEX ROWID TIBEX_TRADINGMETHODENUM (cr=82 pr=0 pw=0 time=252 us cost=1 size=14 card=1)
            78         78         78                    INDEX UNIQUE SCAN XPKTIBEX_TRADINGMETHODENUM (cr=4 pr=0 pw=0 time=98 us cost=0 size=0 card=1)(object id 1354897)
             0          0          0                             INDEX FAST FULL SCAN XPKTIBEX_TRADINGCYCLE (cr=0 pr=0 pw=0 time=0 us cost=1 size=1040 card=80)(object id 1354895)
            40         40         40                        INDEX UNIQUE SCAN XPKTIBEX_TRADINGCYCLE (cr=4 pr=0 pw=0 time=79 us cost=0 size=4 card=1)(object id 1354895)
            13         13         13                       VIEW  (cr=4 pr=1 pw=0 time=362 us cost=2 size=112 card=16)
            13         13         13                        TABLE ACCESS FULL SYS_TEMP_0FD9D660D_F7392ACA (cr=4 pr=1 pw=0 time=349 us cost=2 size=1216 card=16)
           275        275        275                      TABLE ACCESS FULL TIBEX_CYCLEPERIODMAP (cr=2 pr=0 pw=0 time=164 us cost=5 size=3025 card=275)
             0          0          0                     TABLE ACCESS BY INDEX ROWID TIBEX_CYCLEPERIODMAPOVER (cr=1 pr=0 pw=0 time=136 us cost=0 size=39 card=1)
             0          0          0                      INDEX UNIQUE SCAN XPKTIBEX_CYCLEPERIODMAPOVER (cr=1 pr=0 pw=0 time=52 us cost=0 size=0 card=1)(object id 1354925)
            78         78         78                    TABLE ACCESS BY INDEX ROWID TIBEX_TRADINGPERIOD (cr=82 pr=0 pw=0 time=343 us cost=1 size=7 card=1)
            78         78         78                     INDEX UNIQUE SCAN XPKTIBEX_TRADINGPERIOD (cr=4 pr=0 pw=0 time=144 us cost=0 size=0 card=1)(object id 1354899)
            13         13         13                   TABLE ACCESS BY INDEX ROWID TIBEX_TRADINGMETHODENUM (cr=82 pr=0 pw=0 time=252 us cost=1 size=14 card=1)
            78         78         78                    INDEX UNIQUE SCAN XPKTIBEX_TRADINGMETHODENUM (cr=4 pr=0 pw=0 time=98 us cost=0 size=0 card=1)(object id 1354897)
           275        275        275                MERGE JOIN OUTER (cr=3 pr=0 pw=0 time=892 us cost=5 size=17875 card=275)
           275        275        275                 TABLE ACCESS BY INDEX ROWID TIBEX_CYCLEPERIODMAP (cr=2 pr=0 pw=0 time=401 us cost=2 size=4950 card=275)
           275        275        275                  INDEX FULL SCAN XPKTIBEX_CYCLEPERIODMAP (cr=1 pr=0 pw=0 time=115 us cost=1 size=0 card=275)(object id 1354681)
             0          0          0                 SORT JOIN (cr=1 pr=0 pw=0 time=207 us cost=3 size=47 card=1)
             0          0          0                  TABLE ACCESS FULL TIBEX_CYCLEPERIODMAPOVER (cr=1 pr=0 pw=0 time=17 us cost=2 size=47 card=1)
            13         13         13               INDEX UNIQUE SCAN XPKTIBEX_TRADINGCYCLE (cr=4 pr=0 pw=0 time=349 us cost=0 size=4 card=1)(object id 1354895)
            13         13         13              VIEW  (cr=2 pr=0 pw=0 time=52 us cost=2 size=336 card=16)
            13         13         13               TABLE ACCESS FULL SYS_TEMP_0FD9D660D_F7392ACA (cr=2 pr=0 pw=0 time=49 us cost=2 size=1216 card=16)
          1473       1473       1473             INDEX RANGE SCAN XPKTIBEX_INSTRUMENTBOARDMAP (cr=19 pr=1 pw=0 time=1378 us cost=1 size=504 card=36)(object id 1354759)
         13877      13877      13877            TABLE ACCESS BY INDEX ROWID TIBEX_INSTRUMENTADMIN (cr=33390 pr=53 pw=0 time=2023879 us cost=27 size=103 card=1)
         44576      44576      44576             INDEX RANGE SCAN SYS_C001331991 (cr=1277 pr=53 pw=0 time=43026 us cost=1 size=0 card=35)(object id 1354964)
         12435      12435      12435           TABLE ACCESS BY INDEX ROWID TIBEX_INSTRACTIONENUM (cr=13881 pr=0 pw=0 time=81117 us cost=1 size=14 card=1)
         13877      13877      13877            INDEX UNIQUE SCAN XPKTIBEX_INSTRACTIONENUM (cr=4 pr=0 pw=0 time=32628 us cost=0 size=0 card=1)(object id 1354753)
        497400     497400     497400          BUFFER SORT (cr=1 pr=0 pw=0 time=323076 us cost=106 size=280 card=40)
            40         40         40           INDEX RANGE SCAN XPKTIBEX_DAYSTRADINGCYCLEMAP (cr=1 pr=0 pw=0 time=61 us cost=1 size=280 card=40)(object id 1354685)
        497400     497400     497400         TABLE ACCESS BY INDEX ROWID TIBEX_TRADINGCYCLE (cr=497404 pr=0 pw=0 time=2609562 us cost=1 size=13 card=1)
        497400     497400     497400          INDEX UNIQUE SCAN XPKTIBEX_TRADINGCYCLE (cr=4 pr=0 pw=0 time=1019970 us cost=0 size=0 card=1)(object id 1354895)
             0          0          0        VIEW PUSHED PREDICATE  (cr=994800 pr=0 pw=0 time=151415026 us cost=1 size=13 card=1)
             0          0          0         HASH JOIN  (cr=994800 pr=0 pw=0 time=150806856 us cost=7 size=32 card=1)
             0          0          0          MERGE JOIN  (cr=994800 pr=0 pw=0 time=19714460 us cost=4 size=209 card=11)
             0          0          0           TABLE ACCESS BY INDEX ROWID TIBEX_HOLIDAYS (cr=994800 pr=0 pw=0 time=18729534 us cost=2 size=26 card=2)
      41284200   41284200   41284200            INDEX FULL SCAN XPKTIBEX_HOLIDAYS (cr=497400 pr=0 pw=0 time=16264606 us cost=1 size=0 card=83)(object id 1354737)
             0          0          0           SORT JOIN (cr=0 pr=0 pw=0 time=0 us cost=2 size=2412 card=402)
             0          0          0            INDEX FULL SCAN XPKTIBEX_HOLIDAYTRADINGCYCLEMA (cr=0 pr=0 pw=0 time=0 us cost=1 size=2412 card=402)(object id 1354739)
             0          0          0          TABLE ACCESS BY INDEX ROWID TIBEX_TRADINGCYCLE (cr=0 pr=0 pw=0 time=0 us cost=2 size=26 card=2)
             0          0          0           INDEX RANGE SCAN XAK1TIBEX_TRADINGCYCLE (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=2)(object id 1354894)
         12435      12435      12435      INDEX UNIQUE SCAN XPKTIBEX_TRADINGPERIOD (cr=4 pr=0 pw=0 time=33106 us cost=0 size=4 card=1)(object id 1354899)
           464        464        464    HASH JOIN SEMI (cr=386 pr=190 pw=0 time=30227 us cost=6 size=331 card=1)
          5684       5684       5684     VIEW  (cr=194 pr=190 pw=0 time=8864 us cost=2 size=582 card=2)
         12435      12435      12435      TABLE ACCESS FULL SYS_TEMP_0FD9D660E_F7392ACA (cr=194 pr=190 pw=0 time=9137 us cost=2 size=272 card=2)
          1267       1267       1267     VIEW  VW_NSO_2 (cr=192 pr=0 pw=0 time=13710 us cost=3 size=80 card=2)
          1267       1267       1267      HASH GROUP BY (cr=192 pr=0 pw=0 time=13074 us cost=3 size=38 card=2)
         12435      12435      12435       VIEW  (cr=192 pr=0 pw=0 time=11843 us cost=2 size=38 card=2)
         12435      12435      12435        TABLE ACCESS FULL SYS_TEMP_0FD9D660E_F7392ACA (cr=192 pr=0 pw=0 time=5751 us cost=2 size=272 card=2)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      Disk file operations I/O                        1        0.00          0.00
      direct path write temp                          2        0.00          0.00
      direct path sync                                1        0.00          0.00
      db file sequential read                        55        0.00          0.00
      SQL*Net message to client                       6        0.00          0.00
      db file scattered read                          2        0.00          0.00
      SQL*Net message from client                     6        0.00          0.00Regards
    NM

    Hi,
    Execution Plan after generating stats on TIBEX_TRADINGCYCLE.
    Execution Plan
    Plan hash value: 1209012613
    | Id  | Operation                                               | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                                        |                                |     1 |   291 |   130   (7)| 00:00:02 |
    |   1 |  VIEW                                                   | TIBEX_OPENINGHOMEMKTOK         |     1 |   291 |   130   (7)| 00:00:02 |
    |   2 |   TEMP TABLE TRANSFORMATION                             |                                |       |       |            |          |
    |   3 |    LOAD AS SELECT                                       | SYS_TEMP_0FD9D662B_FB42A6E1    |       |       |            |          |
    |*  4 |     HASH JOIN                                           |                                |     8 |  1392 |    27  (12)| 00:00:01 |
    |*  5 |      TABLE ACCESS FULL                                  | TIBEX_TRADINGMETHODENUM        |     1 |    14 |     5   (0)| 00:00:01 |
    |*  6 |      HASH JOIN                                          |                                |   138 | 22080 |    21  (10)| 00:00:01 |
    |   7 |       NESTED LOOPS OUTER                                |                                |   138 | 16284 |    14  (15)| 00:00:01 |
    |*  8 |        HASH JOIN                                        |                                |   138 |  9798 |    14  (15)| 00:00:01 |
    |*  9 |         HASH JOIN                                       |                                |    40 |  2120 |     8  (13)| 00:00:01 |
    |  10 |          NESTED LOOPS OUTER                             |                                |    40 |  1240 |     5   (0)| 00:00:01 |
    |  11 |           NESTED LOOPS                                  |                                |    40 |   800 |     3  (34)| 00:00:01 |
    |  12 |            VIEW                                         | index$_join$_018               |    80 |  1040 |     3  (34)| 00:00:01 |
    |* 13 |             HASH JOIN                                   |                                |       |       |            |          |
    |  14 |              INDEX FAST FULL SCAN                       | XAK1TIBEX_TRADINGCYCLE         |    80 |  1040 |     1   (0)| 00:00:01 |
    |  15 |              INDEX FAST FULL SCAN                       | XPKTIBEX_TRADINGCYCLE          |    80 |  1040 |     1   (0)| 00:00:01 |
    |* 16 |            INDEX UNIQUE SCAN                            | XPKTIBEX_DAYSTRADINGCYCLEMAP   |     1 |     7 |     0   (0)| 00:00:01 |
    |  17 |           VIEW PUSHED PREDICATE                         |                                |     1 |    11 |     1   (0)| 00:00:01 |
    |* 18 |            HASH JOIN                                    |                                |     1 |    32 |     7  (29)| 00:00:01 |
    |  19 |             MERGE JOIN                                  |                                |     3 |    57 |     4  (25)| 00:00:01 |
    |* 20 |              TABLE ACCESS BY INDEX ROWID                | TIBEX_HOLIDAYS                 |     1 |    13 |     2   (0)| 00:00:01 |
    |  21 |               INDEX FULL SCAN                           | XPKTIBEX_HOLIDAYS              |    83 |       |     1   (0)| 00:00:01 |
    |* 22 |              SORT JOIN                                  |                                |   402 |  2412 |     2  (50)| 00:00:01 |
    |  23 |               INDEX FULL SCAN                           | XPKTIBEX_HOLIDAYTRADINGCYCLEMA |   402 |  2412 |     1   (0)| 00:00:01 |
    |  24 |             TABLE ACCESS BY INDEX ROWID                 | TIBEX_TRADINGCYCLE             |     2 |    26 |     2   (0)| 00:00:01 |
    |* 25 |              INDEX RANGE SCAN                           | XAK1TIBEX_TRADINGCYCLE         |     2 |       |     1   (0)| 00:00:01 |
    |  26 |          VIEW                                           | index$_join$_024               |    80 |  1760 |     3  (34)| 00:00:01 |
    |* 27 |           HASH JOIN                                     |                                |       |       |            |          |
    |  28 |            INDEX FAST FULL SCAN                         | XAK1TIBEX_TRADINGCYCLE         |    80 |  1760 |     1   (0)| 00:00:01 |
    |  29 |            INDEX FAST FULL SCAN                         | XPKTIBEX_TRADINGCYCLE          |    80 |  1760 |     1   (0)| 00:00:01 |
    |  30 |         TABLE ACCESS FULL                               | TIBEX_CYCLEPERIODMAP           |   275 |  4950 |     5   (0)| 00:00:01 |
    |  31 |        TABLE ACCESS BY INDEX ROWID                      | TIBEX_CYCLEPERIODMAPOVER       |     1 |    47 |     0   (0)| 00:00:01 |
    |* 32 |         INDEX UNIQUE SCAN                               | XPKTIBEX_CYCLEPERIODMAPOVER    |     1 |       |     0   (0)| 00:00:01 |
    |  33 |       TABLE ACCESS FULL                                 | TIBEX_TRADINGPERIOD            |   330 | 13860 |     7   (0)| 00:00:01 |
    |  34 |    LOAD AS SELECT                                       | SYS_TEMP_0FD9D662C_FB42A6E1    |       |       |            |          |
    |  35 |     NESTED LOOPS                                        |                                |     1 |   282 |    98   (5)| 00:00:02 |
    |* 36 |      FILTER                                             |                                |       |       |            |          |
    |  37 |       NESTED LOOPS OUTER                                |                                |     1 |   278 |    98   (5)| 00:00:02 |
    |  38 |        NESTED LOOPS                                     |                                |     1 |   267 |    97   (5)| 00:00:02 |
    |  39 |         MERGE JOIN CARTESIAN                            |                                |     1 |   254 |    96   (5)| 00:00:02 |
    |  40 |          NESTED LOOPS                                   |                                |       |       |            |          |
    |  41 |           NESTED LOOPS                                  |                                |     1 |   247 |    95   (5)| 00:00:02 |
    |  42 |            NESTED LOOPS                                 |                                |     1 |   233 |    94   (5)| 00:00:02 |
    |  43 |             NESTED LOOPS                                |                                |     3 |   390 |    24  (17)| 00:00:01 |
    |* 44 |              HASH JOIN                                  |                                |     1 |   116 |    23  (18)| 00:00:01 |
    |  45 |               NESTED LOOPS                              |                                |     1 |    95 |    21  (20)| 00:00:01 |
    |  46 |                NESTED LOOPS OUTER                       |                                |    31 |  2821 |    21  (20)| 00:00:01 |
    |  47 |                 NESTED LOOPS                            |                                |    31 |  1364 |    21  (20)| 00:00:01 |
    |  48 |                  VIEW                                   | VW_NSO_1                       |     1 |    26 |    18  (17)| 00:00:01 |
    |  49 |                   SORT GROUP BY                         |                                |     1 |   113 |    18  (17)| 00:00:01 |
    |  50 |                    NESTED LOOPS ANTI                    |                                |     1 |   113 |    17  (12)| 00:00:01 |
    |  51 |                     NESTED LOOPS                        |                                |     1 |    99 |    16  (13)| 00:00:01 |
    |  52 |                      NESTED LOOPS OUTER                 |                                |     1 |    92 |    15  (14)| 00:00:01 |
    |* 53 |                       HASH JOIN                         |                                |     1 |    53 |    15  (14)| 00:00:01 |
    |* 54 |                        HASH JOIN                        |                                |     8 |   336 |     9  (12)| 00:00:01 |
    |  55 |                         NESTED LOOPS                    |                                |    40 |  1400 |     7  (15)| 00:00:01 |
    |  56 |                          NESTED LOOPS OUTER             |                                |    40 |  1240 |     7  (15)| 00:00:01 |
    |* 57 |                           HASH JOIN                     |                                |    40 |   800 |     4  (25)| 00:00:01 |
    |* 58 |                            INDEX RANGE SCAN             | XPKTIBEX_DAYSTRADINGCYCLEMAP   |    40 |   280 |     1   (0)| 00:00:01 |
    |  59 |                            VIEW                         | index$_join$_044               |    80 |  1040 |     3  (34)| 00:00:01 |
    |* 60 |                             HASH JOIN                   |                                |       |       |            |          |
    |  61 |                              INDEX FAST FULL SCAN       | XAK1TIBEX_TRADINGCYCLE         |    80 |  1040 |     1   (0)| 00:00:01 |
    |  62 |                              INDEX FAST FULL SCAN       | XPKTIBEX_TRADINGCYCLE          |    80 |  1040 |     1   (0)| 00:00:01 |
    |  63 |                           VIEW PUSHED PREDICATE         |                                |     1 |    11 |     1   (0)| 00:00:01 |
    |* 64 |                            HASH JOIN                    |                                |     1 |    32 |     7  (29)| 00:00:01 |
    |  65 |                             MERGE JOIN                  |                                |     3 |    57 |     4  (25)| 00:00:01 |
    |* 66 |                              TABLE ACCESS BY INDEX ROWID| TIBEX_HOLIDAYS                 |     1 |    13 |     2   (0)| 00:00:01 |
    |  67 |                               INDEX FULL SCAN           | XPKTIBEX_HOLIDAYS              |    83 |       |     1   (0)| 00:00:01 |
    |* 68 |                              SORT JOIN                  |                                |   402 |  2412 |     2  (50)| 00:00:01 |
    |  69 |                               INDEX FULL SCAN           | XPKTIBEX_HOLIDAYTRADINGCYCLEMA |   402 |  2412 |     1   (0)| 00:00:01 |
    |  70 |                             TABLE ACCESS BY INDEX ROWID | TIBEX_TRADINGCYCLE             |     2 |    26 |     2   (0)| 00:00:01 |
    |* 71 |                              INDEX RANGE SCAN           | XAK1TIBEX_TRADINGCYCLE         |     2 |       |     1   (0)| 00:00:01 |
    |* 72 |                          INDEX UNIQUE SCAN              | XPKTIBEX_TRADINGCYCLE          |     1 |     4 |     0   (0)| 00:00:01 |
    |  73 |                         VIEW                            |                                |    16 |   112 |     2   (0)| 00:00:01 |
    |  74 |                          TABLE ACCESS FULL              | SYS_TEMP_0FD9D662B_FB42A6E1    |    16 |  1216 |     2   (0)| 00:00:01 |
    |  75 |                        TABLE ACCESS FULL                | TIBEX_CYCLEPERIODMAP           |   275 |  3025 |     5   (0)| 00:00:01 |
    |  76 |                       TABLE ACCESS BY INDEX ROWID       | TIBEX_CYCLEPERIODMAPOVER       |     1 |    39 |     0   (0)| 00:00:01 |
    |* 77 |                        INDEX UNIQUE SCAN                | XPKTIBEX_CYCLEPERIODMAPOVER    |     1 |       |     0   (0)| 00:00:01 |
    |  78 |                      TABLE ACCESS BY INDEX ROWID        | TIBEX_TRADINGPERIOD            |     1 |     7 |     1   (0)| 00:00:01 |
    |* 79 |                       INDEX UNIQUE SCAN                 | XPKTIBEX_TRADINGPERIOD         |     1 |       |     0   (0)| 00:00:01 |
    |* 80 |                     TABLE ACCESS BY INDEX ROWID         | TIBEX_TRADINGMETHODENUM        |     1 |    14 |     1   (0)| 00:00:01 |
    |* 81 |                      INDEX UNIQUE SCAN                  | XPKTIBEX_TRADINGMETHODENUM     |     1 |       |     0   (0)| 00:00:01 |
    |  82 |                  TABLE ACCESS BY INDEX ROWID            | TIBEX_CYCLEPERIODMAP           |    31 |   558 |     2   (0)| 00:00:01 |
    |* 83 |                   INDEX SKIP SCAN                       | XPKTIBEX_CYCLEPERIODMAP        |    31 |       |     1   (0)| 00:00:01 |
    |  84 |                 TABLE ACCESS BY INDEX ROWID             | TIBEX_CYCLEPERIODMAPOVER       |     1 |    47 |     0   (0)| 00:00:01 |
    |* 85 |                  INDEX UNIQUE SCAN                      | XPKTIBEX_CYCLEPERIODMAPOVER    |     1 |       |     0   (0)| 00:00:01 |
    |* 86 |                INDEX UNIQUE SCAN                        | XPKTIBEX_TRADINGCYCLE          |     1 |     4 |     0   (0)| 00:00:01 |
    |  87 |               VIEW                                      |                                |    16 |   336 |     2   (0)| 00:00:01 |
    |  88 |                TABLE ACCESS FULL                        | SYS_TEMP_0FD9D662B_FB42A6E1    |    16 |  1216 |     2   (0)| 00:00:01 |
    |* 89 |              INDEX RANGE SCAN                           | XPKTIBEX_INSTRUMENTBOARDMAP    |    36 |   504 |     1   (0)| 00:00:01 |
    |* 90 |             TABLE ACCESS BY INDEX ROWID                 | TIBEX_INSTRUMENTADMIN          |     1 |   103 |    27   (0)| 00:00:01 |
    |* 91 |              INDEX RANGE SCAN                           | SYS_C001331991                 |    35 |       |     1   (0)| 00:00:01 |
    |* 92 |            INDEX UNIQUE SCAN                            | XPKTIBEX_INSTRACTIONENUM       |     1 |       |     0   (0)| 00:00:01 |
    |* 93 |           TABLE ACCESS BY INDEX ROWID                   | TIBEX_INSTRACTIONENUM          |     1 |    14 |     1   (0)| 00:00:01 |
    |  94 |          BUFFER SORT                                    |                                |    40 |   280 |    95   (5)| 00:00:02 |
    |* 95 |           INDEX RANGE SCAN                              | XPKTIBEX_DAYSTRADINGCYCLEMAP   |    40 |   280 |     1   (0)| 00:00:01 |
    |  96 |         TABLE ACCESS BY INDEX ROWID                     | TIBEX_TRADINGCYCLE             |     1 |    13 |     1   (0)| 00:00:01 |
    |* 97 |          INDEX UNIQUE SCAN                              | XPKTIBEX_TRADINGCYCLE          |     1 |       |     0   (0)| 00:00:01 |
    |  98 |        VIEW PUSHED PREDICATE                            |                                |     1 |    11 |     1   (0)| 00:00:01 |
    |* 99 |         HASH JOIN                                       |                                |     1 |    32 |     7  (29)| 00:00:01 |
    | 100 |          MERGE JOIN                                     |                                |     3 |    57 |     4  (25)| 00:00:01 |
    |*101 |           TABLE ACCESS BY INDEX ROWID                   | TIBEX_HOLIDAYS                 |     1 |    13 |     2   (0)| 00:00:01 |
    | 102 |            INDEX FULL SCAN                              | XPKTIBEX_HOLIDAYS              |    83 |       |     1   (0)| 00:00:01 |
    |*103 |           SORT JOIN                                     |                                |   402 |  2412 |     2  (50)| 00:00:01 |
    | 104 |            INDEX FULL SCAN                              | XPKTIBEX_HOLIDAYTRADINGCYCLEMA |   402 |  2412 |     1   (0)| 00:00:01 |
    | 105 |          TABLE ACCESS BY INDEX ROWID                    | TIBEX_TRADINGCYCLE             |     2 |    26 |     2   (0)| 00:00:01 |
    |*106 |           INDEX RANGE SCAN                              | XAK1TIBEX_TRADINGCYCLE         |     2 |       |     1   (0)| 00:00:01 |
    |*107 |      INDEX UNIQUE SCAN                                  | XPKTIBEX_TRADINGPERIOD         |     1 |     4 |     0   (0)| 00:00:01 |
    |*108 |    HASH JOIN SEMI                                       |                                |     1 |   331 |     6  (34)| 00:00:01 |
    |*109 |     VIEW                                                |                                |     2 |   582 |     2   (0)| 00:00:01 |
    | 110 |      TABLE ACCESS FULL                                  | SYS_TEMP_0FD9D662C_FB42A6E1    |     2 |   272 |     2   (0)| 00:00:01 |
    | 111 |     VIEW                                                | VW_NSO_2                       |     2 |    80 |     3  (34)| 00:00:01 |
    | 112 |      HASH GROUP BY                                      |                                |     2 |    38 |     3  (34)| 00:00:01 |
    | 113 |       VIEW                                              |                                |     2 |    38 |     2   (0)| 00:00:01 |
    | 114 |        TABLE ACCESS FULL                                | SYS_TEMP_0FD9D662C_FB42A6E1    |     2 |   272 |     2   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------------------------------------------------------------

  • 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

  • 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 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.

  • Plan changing when using variables instead of constant

    Hi,
    I have a query, when run with the constant values uses a better plan. But when these constants are replaced with variables, plan is changing and taking much longer time to complete. I don't want the query to use a different plan when using the variables in place of constants.
    Please help.
    Thanks

    Probably you got caught by bind variable peeking (if the plans are same for both variables)
    If you have default 10g Statistics gathering job it means you are collecting histograms
    If my bind peeking + histogram assumption is true Check this link to fight with peeking
    http://www.pythian.com/news/867/stabilize-oracle-10gs-bind-peeking-behaviour-by-cutting-histograms
    if deleting histograms doesnt help
    check this link
    http://www.oracloid.com/2006/07/bind-variable-peeking-with-no-histograms/
    A. Coskan GUNDOGAR
    Oracle DBA
    http://coskan.wordpress.com
    ““Knowledge is of no value unless you put it into practice.”.”
    Anton Chekhov

  • Will plan change when ordering iPhone 6 through Apple's Site?

    I am trying to upgrade to the iPhone 6 through Apple's site.  I am currently on the Loyalty plan with Verizon ($60/month for 2g data and unlimited voice and texts).  When I go through Apple's site, it is requiring me to select a data plan and then it is tacking that on top of my "current voice plan" - increasing my expected monthly bill by $30.  When I try to order through Verizon, it allows me to keep my same plan. Here's a screenshot:
    I'd like to order through Apple so that I can get the phone faster.  My question is, if I do order through Apple, will it mess up my plan?  Should I just order it and then call Verizon to make sure the Apple changes to my plan don't carry over?  It appears as though when ordering through Apple, the changes in my bill will take effect immediately.
    Thanks in advance for your help!

        Thanks for checking in with us elmoemily. I know how important it is to keep your current plan. Since Apple doesn't have the option to see promotional plans and such, they will ask you to change your plan, as you are seeing. However, when you go to activate your phone, you can simply call us, and we can ensure that you can keep your current plan. You won't be at risk of losing it. No need to worry! I am excited for you to get your new phone!
    ErinW_VZW
    Follow us on Twitter @VZWSupport.

  • 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

  • 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)

  • 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.

Maybe you are looking for

  • Can't open adobe premiere element 11 on my MacBook Pro? which I buy it from App Store? plz help

    can't open adobe premiere element 11 on my MacBook Pro? which I buy it from App Store? plz help its says that its currently not availabe I have so many work counting on this programme plz help

  • How to publish outside .mac

    I've already created one personal webpage using iWeb, and I'm pretty pleased with the results. Now I'd like to spruce up a webpage that is not a .mac page, its actually under a public university domain (.edu) - I know there are some code/passwords I

  • Oradim hangs in Oracle XE when creating new service

    Using Oracle XE 10g on W2003 Server (64-bit), R2. I'm attempting to install/create a new database instance... The initial installation of XE itself and the subsequent XE instance was successful. Now, i'm attempting to create another instance/database

  • XML convert to a regular table data

    I'm using Oracle 10g, from SQL plus I used some built in functions to spool to an xml file, my question is what functions I can use to read from an XML file and insert into an Oracle database table as varchar2 or number or date not as an XML type in

  • Hmmm oddly, my bounces dont show up directly on desktop...

    I bounce files directly to my desktop , however they only are seen when open up little finder windows, or when i reboot, not right after I bounce... What do I blame here? logic, leopard, or something else?