Oracle not using its own explain plan

When I run a simple select query on an indexed column on a large (30 million records) table oracle creates a plan using the indexed column and at a cost of 4. However, what it actually does is do a table scan (I can see this in the 'Long Operations' tab in OEM).
The funny thing is that I have the same query in a ADO application and when the query is run from there, the same plan is created but no table scan is done - and the query returns in less than a second. However, with the table scan it is over a minute.
When run through SQL plus Oracle creates a plan including the table scan at a cost of 19030.
In another (dot net) application I used the: "Alter session set optimizer_index_caching=100" and "Alter session set optimizer_index_cost_adj=10" to try to force the optimizer to use the index. It creates the expected plan, but still does the table scan.
The query is in the form of:
"Select * from tab where indexedcol = something"
Im using Oracle 9i 9.2.0.1.0
Any ideas as I'm completely at a loss?

Hello
It sounds to me like this has something to do with bind variable peeking which was introduced in 9i. If the predicate is
indexedcolumn = :bind_variablethe first time the query is parsed by oracle, it will "peek" at the value in the bind variable and see what it is and will generate an execution plan based on this. That same plan will be used for matching SQL.
If you use a litteral, it will generate the plan based on that, and will generate a separate plan for each litteral you use (depending on the value of the cursor_sharing initialisation parameter).
This can cause there to be a difference between the execution plan seen when issuing EXPLAIN PLAN FOR, and the actual exectuion plan used when the query is run.
Have a look at the following example:
tylerd@DEV2> CREATE TABLE dt_test_bvpeek(id number, col1 number)
  2  /
Table created.
Elapsed: 00:00:00.14
tylerd@DEV2> INSERT
  2  INTO
  3      dt_test_bvpeek
  4  SELECT
  5      rownum,
  6      CASE
  7          WHEN MOD(rownum, 5) IN (0,1,2,3) THEN
  8              1
  9          ELSE
10              MOD(rownum, 5)
11          END
12      END
13  FROM
14      dual
15  CONNECT BY
16      LEVEL <= 100000
17  /
100000 rows created.
Elapsed: 00:00:00.81
tylerd@DEV2> select count(*), col1 from dt_test_bvpeek group by col1
  2  /
  COUNT(*)       COL1
     80000          1
     20000          4
2 rows selected.
Elapsed: 00:00:00.09
tylerd@DEV2> CREATE INDEX dt_test_bvpeek_i1 ON dt_test_bvpeek(col1)
  2  /
Index created.
Elapsed: 00:00:00.40
tylerd@DEV2> EXEC dbms_stats.gather_table_stats( ownname=>USER,-
tabname=>'DT_TEST_BVPEEK',-
method_opt=>'FOR ALL INDEXED COLUMNS SIZE 254',-
cascade=>TRUE -
);PL/SQL procedure successfully completed.
Elapsed: 00:00:00.73
tylerd@DEV2> EXPLAIN PLAN FOR
  2  SELECT
  3      *
  4  FROM
  5      dt_test_bvpeek
  6  WHERE
  7      col1 = 1
  8  /
Explained.
Elapsed: 00:00:00.01
tylerd@DEV2> SELECT * FROM TABLE(DBMS_XPLAN.display)
  2  /
PLAN_TABLE_OUTPUT
Plan hash value: 2611346395
| Id  | Operation         | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |                | 78728 |   538K|    82  (52)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| DT_TEST_BVPEEK | 78728 |   538K|    82  (52)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter("COL1"=1)
13 rows selected.
Elapsed: 00:00:00.06The execution plan for col1=1 was chosen because oracle was able to see that based on the statistics, col1=1 would result in most of the rows from the table being returned.
tylerd@DEV2> EXPLAIN PLAN FOR
  2  SELECT
  3      *
  4  FROM
  5      dt_test_bvpeek
  6  WHERE
  7      col1 = 4
  8  /
Explained.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT * FROM TABLE(DBMS_XPLAN.display)
  2  /
PLAN_TABLE_OUTPUT
Plan hash value: 3223879139
| Id  | Operation                   | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT            |                   | 21027 |   143K|    74  (21)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| DT_TEST_BVPEEK    | 21027 |   143K|    74  (21)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | DT_TEST_BVPEEK_I1 | 21077 |       |    29  (28)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - access("COL1"=4)
14 rows selected.
Elapsed: 00:00:00.04This time, the optimiser was able to see that col1=4 would result in far fewer rows so it chose to use an index. Look what happens however when we use a bind variable with EXPLAIN PLAN FOR - especially the number of rows the optimiser estimates to be returned from the table
tylerd@DEV2> var an_col1 NUMBER
tylerd@DEV2> exec :an_col1:=1;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
tylerd@DEV2>
tylerd@DEV2> EXPLAIN PLAN FOR
  2  SELECT
  3      *
  4  FROM
  5      dt_test_bvpeek
  6  WHERE
  7      col1 = :an_col1
  8  /
Explained.
Elapsed: 00:00:00.01
tylerd@DEV2> SELECT * FROM TABLE(DBMS_XPLAN.display)
  2  /
PLAN_TABLE_OUTPUT
Plan hash value: 2611346395
| Id  | Operation         | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |                | 49882 |   340K|   100  (60)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| DT_TEST_BVPEEK | 49882 |   340K|   100  (60)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter("COL1"=TO_NUMBER(:AN_COL1))
13 rows selected.
Elapsed: 00:00:00.04
tylerd@DEV2>
tylerd@DEV2> exec :an_col1:=4;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
tylerd@DEV2>
tylerd@DEV2> EXPLAIN PLAN FOR
  2  SELECT
  3      *
  4  FROM
  5      dt_test_bvpeek
  6  WHERE
  7      col1 = :an_col1
  8  /
Explained.
Elapsed: 00:00:00.01
tylerd@DEV2> SELECT * FROM TABLE(DBMS_XPLAN.display)
  2  /
PLAN_TABLE_OUTPUT
Plan hash value: 2611346395
| Id  | Operation         | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |                | 49882 |   340K|   100  (60)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| DT_TEST_BVPEEK | 49882 |   340K|   100  (60)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter("COL1"=TO_NUMBER(:AN_COL1))
13 rows selected.
Elapsed: 00:00:00.07For both values of the bind variable, the optimiser has no idea what the value will be so it has to make a calculation based on a formula which results in it estimating that the query will return roughly half of the rows in the table, and so it chooses a full scan.
Now when we actually run the query, the optimiser can take advantage of bind variable peeking and have a look at the value the first time round and base the execution plan on that:
tylerd@DEV2> exec :an_col1:=1;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
  2      *
  3  FROM
  4      dt_test_bvpeek
  5  WHERE
  6      col1 = :an_col1
  7  /
80000 rows selected.
Elapsed: 00:00:10.98
tylerd@DEV2> SELECT prev_sql_id FROM v$session WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID')
  2  /
PREV_SQL_ID
9t52uyyq67211
1 row selected.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
  2      operation,
  3      options,
  4      object_name
  5  FROM
  6      v$sql_plan
  7  WHERE
  8      sql_id = '9t52uyyq67211'
  9  /
OPERATION                      OPTIONS                        OBJECT_NAME
SELECT STATEMENT
TABLE ACCESS                   FULL                           DT_TEST_BVPEEK
2 rows selected.
Elapsed: 00:00:00.03It saw that the bind variable value was 1 and that this would return most of the rows in the table so it chose a full scan.
tylerd@DEV2> exec :an_col1:=4
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
  2      *
  3  FROM
  4      dt_test_bvpeek
  5  WHERE
  6      col1 = :an_col1
  7  /
20000 rows selected.
Elapsed: 00:00:03.50
tylerd@DEV2> SELECT prev_sql_id FROM v$session WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID')
  2  /
PREV_SQL_ID
9t52uyyq67211
1 row selected.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
  2      operation,
  3      options,
  4      object_name
  5  FROM
  6      v$sql_plan
  7  WHERE
  8      sql_id = '9t52uyyq67211'
  9  /
OPERATION                      OPTIONS                        OBJECT_NAME
SELECT STATEMENT
TABLE ACCESS                   FULL                           DT_TEST_BVPEEK
2 rows selected.
Elapsed: 00:00:00.01Even though the value of the bind variable changed, the optimiser saw that it already had a cached version of the sql statement along with an execution plan, so it used that rather than regenerating the plan. We can check the reverse of this by causing the statement to be invalidated and re-parsed - there's lots of ways, but I'm just going to rename the table:
Elapsed: 00:00:00.03
tylerd@DEV2> alter table dt_test_bvpeek rename to dt_test_bvpeek1
  2  /
Table altered.
Elapsed: 00:00:00.01
tylerd@DEV2>
20000 rows selected.
Elapsed: 00:00:04.81
tylerd@DEV2> SELECT prev_sql_id FROM v$session WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID')
  2  /
PREV_SQL_ID
6ztnn4fyt6y5h
1 row selected.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
  2      operation,
  3      options,
  4      object_name
  5  FROM
  6      v$sql_plan
  7  WHERE
  8      sql_id = '6ztnn4fyt6y5h'
  9  /
OPERATION                      OPTIONS                        OBJECT_NAME
SELECT STATEMENT
TABLE ACCESS                   BY INDEX ROWID                 DT_TEST_BVPEEK1
INDEX                          RANGE SCAN                     DT_TEST_BVPEEK_I1
3 rows selected.
80000 rows selected.
Elapsed: 00:00:10.61
tylerd@DEV2> SELECT prev_sql_id FROM v$session WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID')
  2  /
PREV_SQL_ID
6ztnn4fyt6y5h
1 row selected.
Elapsed: 00:00:00.01
tylerd@DEV2> SELECT
  2      operation,
  3      options,
  4      object_name
  5  FROM
  6      v$sql_plan
  7  WHERE
  8      sql_id = '6ztnn4fyt6y5h'
  9  /
OPERATION                      OPTIONS                        OBJECT_NAME
SELECT STATEMENT
TABLE ACCESS                   BY INDEX ROWID                 DT_TEST_BVPEEK1
INDEX                          RANGE SCAN                     DT_TEST_BVPEEK_I1
3 rows selected.This time round, the optimiser peeked at the bind variable the first time the statement was exectued and found it to be 4, so it based the execution plan on that and chose an index range scan. When the statement was executed again, it used the plan it had already executed.
HTH
David

Similar Messages

  • Sap not following its own rules

    i made a vendor recon account and assigned a sort key 010 to it. then i created a vendor master record and in that also i gave sort key as 010.   now i made a po then grn then miro.
    as a result of simulation in miro i got an entry vendor recon account cr with no po no. in purchasing doc column and gr/ir debit with po no. being displayed.
    when i did fbl1n for this vendor account i didnot get anything in assignment field while it was expected that po no should be reflected in assignment field as sort key assigned to this vendor master record was 010
    why is this happening SAP is not following its own rule that what ever is given in sort key what we see in assignment field
    please explain with some solid proof

    The system uses a standard sort sequence for displaying line items. Among other things, it sorts the items according to the content of the Allocation field. This field can be filled either manually or automatically (by the system) when a document line item is entered.
    For this purpose, the system requires rules that determine which information is to be taken from the document header or from the document line item and placed in the field. The rules can be stored in the master record of an account which enables you to determine the standard sort sequence on an account-specific basis.
    You have to define the rules for the layout of the assignment number field in the Implementation Guide (IMG) under Determine Standard Sorting for Line Items.
    Hope you understand the concept.
    Reward points if useful

  • Does Ipad - 2 require its own data plan

    Does an ipad 2 require its own data plan? 

    Yes - if it is a 3G iPad. Each 3G device requires its own data plan. You do not have to activate a data plan - you can just use the WiFi and get a data plan if and when you need it.

  • PS CS6 has a different set of installed fonts than my old PS CS4.  How do I get my old fonts back?  Don't like most of the CS6 fonts.  Dell Precision, Windows 7.  Does PS use the fonts in the Windows directory or does it use its own?  A lot of my preferre

    PS CS6 has a different set of installed fonts than my old PS CS4.  How do I get my old fonts back?  Don't like most of the newer CS6 fonts.  Dell Precision, Windows 7.  Does PS use the fonts in the Windows directory or does it use its own?  If so, where are they in the directory?  A lot of my preferred fonts show in the Windows directory but not in Photoshop, which does not display them within the program.  Please help.  If I get free fonts (NOT CC fonts) from elsewhere, where do I put them for Photoshop[ CS6 to use them?  Thanks.

    All versions of Photoshop get their fonts from your OS.  Just install any missing font wherever Windows keeps fonts.
    I don't do windows myself.

  • HT204391 How come Apple can't use its own software to create this guide as a pdf or an iBook?

    Does Apple actually use its own software?
    The woefully few manuals it manages to provide now are all created in Indesign and desperately need the critical eye of an editor to correct the errors, ommisions, obsolescence and plain confusing statements.
    As Apple's efforts grow ever more obscure, awkward, contradictory and difficult to use, it tells it Users next to nothing about how they all work.

    LOL, I saw the points tally and thought at first  you were opening a thread to motivate some ideas to pass back!
    I assumed also that the points did not come  from iBA and like others... were experienced and skilled dealing with Pages etc,.
    Fact is  Apple cloned iBA from Pages - which is basically a sound concept and suits a purpose.. but the cry as always been... "give us a decent manual".  Apple in their wisdom apparently did not conceive that people would use iBA having never used pages. I actually purchased iWorks back in 2005 for  my then new PowerPC G5 10.4.11 tried it and went back to  MS Publisher!
    18 months or more on depending on iBA's release, most  users are pretty much capable now but  a few new comers from other software packages  do seen to  have trouble getting information to start up.
    From Apples point of view.. their project worked, the software  as it is as flooded the book store with product dedicated to iPads and therfore income for Apple only.  I have no doubt the next update will deal with some of the isssues sent  in as feedback.
    Meanwhile, welcome to the club.........
    from a not so sunny Central Coast!

  • InDesign CS5 (Mac OS 10.6) can not open its own file

    I need guidance to open an artwork file that in one hour I have to send to the print shop. InDesign refuses to open its own file.
    Any clue? Adobe, please help.

    Re: InDesign CS5 (Mac OS 10.6) can not open its own file
    Bob and Peter
    Thank your for helping us out. It was really necessary to ask a coworker to open the file and export it in InDesign markup language.
    Three hours later than expected, but it's done!
    We are stuck here. I'm a Master Collection user of CS5, using only Dreamweaver, Illustrator, Photoshop, InDesign, Bridge and Acrobat Pro. (I don't know why I bought the Master's). My coleague former Window user, got a Mac in May and downloaded the trial version of Design Studio Standard Collection of CS5.5. Before expiring, we purchased its license and filled it in the active trial version.
    A couple of months ago we noticed that were missed Plug Ins on his version and contacted Adobe who instructed us to download the whole files again. We never did because it is a pain to get rid of the missing parts of a pre installed trial version etc.
    I will ask Adobe to send a CD disk for his version.
    Regards,
    Junia

  • Firefox 24 uses its own stricter umask for downloaded files then 23, where do I set this ?

    Apparently, Firefox24 uses its own umask (0077) setting for downloaded files (in libxul.so ?) , whereas Firexfox23 seems to use the inherited umask from the calling process (0022 in my case).
    Securitywise this is change fine, but in my case I need to use my own umask setting.
    Anyway to specifies this ? (had checked about:config)
    thanks !
    Note:question https://support.mozilla.org/en-US/questions/971876?esab=a&as=aaq seems related, but IMHO an existing directory hasn't a umask setting.

    hello trummel7, please try to upgrade to firefox 25 which got released today and should contain a fix for this issue. thank you!

  • What settings to make cpu not use its...

    Hi when I Overclock my 4690k, obviously it will run on its full speed even when at idle mode or not playing, MSI boards has this settings to make cpu not use its full power when on idle mode,, so what settings is it??? Anyone???

    CPU Ratio Mode Dynamic
    EIST Enabled
    And As Svet said Balanced power plan

  • HT1933 My iPhone keeps deleting my notes on its own!

    My iPhone keeps deleting my notes on its own.

    Try the standard fixes:
    - Reset. Nothing will be lost.
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup
    - Restore to factory defaults/new iPod

  • Gx70 is not using its dedicated gpu

    Hello everyone,
    A week ago i bought a msi gx70, it al works perfect except for one thing. When i start a game, the laptop is not using its dedicated gpu (amd hd 8970) but the gpu integrated in the processor ( amd 89650 )
    I've tried a lot of stuff to fix this, like disabling the onboard gpu. When i disable the onboard gpu, the pc start using a microsoft basic render drive. I also tried to uninstalll both cards and reinstall them, not working. tried going into the bios, but there is now option for me to disable the onboard gpu there.
    So please, i need help because it's getting pretty frustrating.
    Thanks in advance!
    grts

    Quote from: Dblkk;108339
    OP, please let us know if those worked or not. So that we can eiher continue to help, or if it worked reply with what you did to fix the matter. So that any other users experiencing the same issue, reading this, will know what to do.
    I will, but for the moment i can't :p
    I gave it back to the shop to see if they can fix it and my laptop suddenly black screened after i updated the drivers. So i hope they can find some drivers where i can just manually disable the integrated gpu.
    Also, when i was playing games the power button was orange if i remember correctly, but the game was still very laggy (about 40fps on smite, which is too low for this card) and in black ops ll the fps was really unstable (immense drops from 120 to 30) i think this also shouldn't be happening with this card right? And in games where you CAN manually pick the gpu, the dedicated one was just not given as an option. Also in benchmarks the dedicated card was noticed by the benchmark, but not used for some reason (having 20fps in a benchmark with this card at medium settings).
    All this concludes for me that the dedicated gpu was not processing when ingame.
    This is all the information i've gathered, if you have any other thoughts of what it could be, feel free to give them.
    Regards
    pj

  • Does tethering my iPad to my iPhone 4s use more data than using an iPad that has its own data plan?

    Does tethering my iPad to my iPhone 4s use more data than using an iPad that has it's own data plan?

    No, it won't work.. the Airports are not media devices.. they have no brains .. no media extensions.. and itunes must be running on a computer.
    You can however watch movies from storage but not with itunes..
    See how people use tools like VLC to get around Apple's built in iTunes limitations.
    http://www.videolan.org/vlc/download-ios.html
    https://itunes.apple.com/gb/app/vlc-streamer/id410031728?mt=8

  • Cpu time is not getting displayed in explain plan

    Hi All,
    I am trying to analyze one query using explain plan .like below
    1) explain plan for
    SELECT /*+ parallel(tsp,8) use_hash( tsp tp) */ count(1)
    FROM router tp,
    receiver tsp
    WHERE tp.rs = tsp.rp
    AND creater_date >=to_date('04032009000000','ddmmyyyyhh24miss')
    and tsp.XVF is not null
    and tp.XVF is not null
    and tp.role_name='BR';
    2)@$ORACLE_HOME/rdbms/admin/utlxpls.sql
    But i am getting only following columns in result .
    | Id | Operation | Name | Rows | Bytes | Cost |
    No Cpu time preset .
    How can i extimate CPU time ?
    Pls help
    Thanks

    am_73798 wrote:
    I am trying to analyze one query using explain plan .like below
    But i am getting only following columns in result .
    | Id | Operation | Name | Rows | Bytes | Cost |
    No Cpu time preset .
    How can i extimate CPU time ?You need to mention your database version (4-digits, e.g. 9.2.0.8).
    In Oracle 9i CPU costing is disabled by default, you need to gather WORKLOAD system statistics to enable the CPU costing.
    In 10g CPU costing is enabled by default and uses default NOWORKLOAD system statistics if no WORKLOAD system statistics have been gathered. It can only be disabled by setting an undocumented parameter or by changing the OPTIMIZER_FEATURES_ENABLE parameter back to 9i compatibility.
    You can check the status of your system statistics by running the following query in SQL*Plus:
    column sname format a20
    column pname format a20
    column pval2 format a20
    select
    sname
    , pname
    , pval1
    , pval2
    from
    sys.aux_stats$;Can you show us the actual (complete) output you get from "utlxpls.sql"? Use the \ tag to preserve formatting here:
    \output
    \will show asoutput
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Sub Partitioning does not have considerable impact Explain Plan

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

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

  • Loading bundle resources from a plugin that does not know its own directory

    Hi,
    I am writing a plugin that is distributed as a bundle file. This bundle file is dynamically loaded by the host application(source unavailble). Is there a way of finding out the directory/filename of the plugin's bundle file?
    If i use a c++ command to list the current directory, it gives the directory of the host application-not the plugin. Since all file system calls are relative to the host application's startup directory, I need to know how to get the directory so the plugin can load files inside of its own bundle resource directory.
    Any advice?

    UMNGraphics wrote:
    I am not using NSBundle nor any objective-c functionality.
    In that case I think your best bet is CFBundle, which is a C-API. See the CF example code (e.g. Listing 3-2 and 3-4) under Locating and Opening Bundles in the +Bundle Programming Guide+, and the CFBundle Reference.
    \- Ray
    [

  • Why is Oracle not using the index??

    Hi,
    I have a table called 'arc_errors' which has an index on 'member_number' as follows:- Create/Recreate indexes
    create index DWO.DW_ARC_CERRORS_MNO on DWO.DW_ARC_CERRORS (MEMBER_NUMBER);
    But surpisingly, when I execute the following query, it does not use the index.
    SELECT member_number,
    COUNT(*) error_count
    FROM arc_errors a
    WHERE member_number = 68534152 AND
    ( tx_type = 'SDIC' AND
    error_number IN (4, 7, 12, 13, 15, 17, 18, 705) )
    OR
    ( tx_type = 'AUTH' AND
    error_number IN (100, 104, 107, 111, 116) )
    OR
    ( tx_type = 'BHO' AND
    error_number IN (708,710) )
    OR
    ( tx_type = 'XLGN' AND
    ( error_number BETWEEN 102 AND 105 OR
    error_number BETWEEN 107 AND 120 OR
    error_number BETWEEN 300 AND 304 ) )
    OR
    ( tx_type = 'None' AND
    ( error_number IN (20, 112) OR
    error_number BETWEEN 402 AND 421 ) )
    OR
    ( tx_type = 'HYBR' AND
    error_number IN (303, 304) )
    GROUP BY member_number;
    This is what 'explain plan' tell me
    SELECT STATEMENT, GOAL = RULE               237907     502923     15087690     
    SORT GROUP BY               237907     502923     15087690     
    PARTITION RANGE ALL                              
    TABLE ACCESS FULL     DWO     DW_ARC_CERRORS     237209     502923     15087690     
    Can someone tell me why a 'table acess full' is required here?
    Thanks in advance,
    Rajesh

    Sorry, I just found the solution myself. I need to put an extra pair of braces around the set of conditions seperated by OR.

Maybe you are looking for

  • Send answers of these qutions

    1.     Strengths in technical subject ? 2.     Explain best report which u did ? 3.     Major events of reports ? 4.     Difference between interactive and classical reports ? 5.     Types of BDC’s 6.     If you say session than why ? 7.     If you s

  • Need a Modem for my G4

    Hello, I just received a used G4 Power Mac Audio Digital version by way that the headphones and mic ports are arrainged, which tells me which version. The telephone line jack cube was turned to its blank side, and I turned it around to connect a regu

  • Alternate to READ statement

    Purpose :- To read multiple rows of internal table on a search criteria. Read statement selects only single row. Any other option to select multiple rows at a time? Answers will be rewarded!

  • Sony Handycam and Mac - how to get working?

    My Macbook does not recognise the Sony - any ideas?

  • How to set a data packet to red status.

    I have a big load which ended mostly in green data packets except for two, which were red,  because of server / resources issues. I tried to update them manually and they turned yellow but all processes ended and they are still in yellow. I want to t