Automatic Optimizer Statistics Collection Enabled still tables not analyzed

Hello,
We have Oracle 11g R1 database. Our automatic Optimizer Statistics Collection settings are enabled, still I don't see the tables being analyzed, any suggestions if I am missing any settings. All tables do get analyzed if I do manual statistics gathering.
SQL> select CLIENT_NAME ,STATUS from DBA_AUTOTASK_CLIENT;
CLIENT_NAME STATUS
auto optimizer stats collection ENABLED
auto space advisor ENABLED
sql tuning advisor ENABLED
Thanks,
SK

user599845 wrote:
Hello,
We have Oracle 11g R1 database. Our automatic Optimizer Statistics Collection settings are enabled, still I don't see the tables being analyzed, any suggestions if I am missing any settings. All tables do get analyzed if I do manual statistics gathering.
SQL> select CLIENT_NAME ,STATUS from DBA_AUTOTASK_CLIENT;
CLIENT_NAME STATUS
auto optimizer stats collection ENABLED
auto space advisor ENABLED
sql tuning advisor ENABLED
Thanks,
SK
still I don't see the tables being analyzed, post SQL & results that lead you to this conclusion.
realize that statistics can be "collected" without updating LAST_ANALYZED column.
if data within table does not change, the nothing would be gained by "updating" statistics to same values as now/before.

Similar Messages

  • (10g) 자동 통계정보 수집(AUTOMATIC OPTIMIZER STATISTICS COLLECTION)

    제품 : ORACLE SERVER
    작성날짜 : 2006-07-21
    PURPOSE
    이 문서는 10g의 new feature인 자동 통계정보 수집(Automatic Optimizer
    Statistics Collection)에 대한 소개와 기능에 대한 자료이다.
    Explanation
    1. 개요
    Optimizer statistics는 GATHER_STATS_JOB에 의해서 자동으로
    수집된다. 이 JOB은 SYS 소유로서 OBJECT_TYPE이 JOB이다.
    이 JOB은 통계정보가 없거나 stale 상태의 통계정보를 갖는 DB 내의
    모든 OBJECT들에 대한 통계정보들을 수집한다.
    2. 자동 통계정보 수집을 위한 설정과 방식
    1) STATISTICS_LEVEL = TYPICAL | ALL
    2) 통계정보들은 predefined GATHER_STATS_JOB에 의해 수집된다.
    3) JOB이 수행될 때 JOB은 다음과 같은 사항들을 결정한다.
    - missing 또는 stale 상태의 통계정보를 갖는 object를 결정한다.
    - 좋은 통계정보를 생성하기 위해 필요한 적당한 sampling percentage.
    - histogram과 histogram의 사이즈를 요구하는 적절한 column.
    - 통계정보 수집에 대한 parallelism의 degree.
    - 어느 object에 대한 통계정보를 수집할지에 대한 우선순위
    3. GATHER_STATS_JOB에 대한 설명
    이 job은 데이타베이스 생성 시점에 생성되고 스케줄러에 의해 관리된다.
    GATHER_STATS_JOB 은 DBMS_STATS.GATHER_DATABASE_STATS_JOB_PROC procedure를
    call함으로써 통계정보를 수집한다.
    이 프로시져는 'GATHER AUTO' 옵션을 사용한 DBMS_STATS.GATHER_DATABASE_STATS
    procedure와 아주 유사한 형태로 동작한다. 이것과 다른 점은
    GATHER_DATABASE_STATS_JOB_PROC procedure는 통계정보를 수집해야 할
    Object에 대해 우선순위를 두고 순서대로 처리한다. 즉, 가장 많이
    통계정보가 update가 되어야 할 object를 가장 먼저 처리하는 것이다.
    이것은 maintenance window가 close되기 전에 가장 필요한 통계정보가
    먼저 수집되도록 하기 위함이다.
    4. Dictionary Objects에 대한 통계정보
    1) Oracle Database 10g부터 최적의 performance 결과를 얻기 위해 dictionary
    table들에 대한 통계정보도 수집할 수 있다.
    언제라도, DBMS_STATS.GATHER_SCHEMA_STATS procedure를 사용하여
    dictionary table들에 대한 통계정보를 수집하는 것이 가능하다.
    이 때 GATHER_SYS argument는 TRUE로 셋팅되어 있어야 한다.
    2) DBMS_STATS.GATHER_DICTIONARY_STATS라 하는 새로운 procedure도 사용
    하는 것이 가능하다. 이것을 사용하기 위해서는 ANALYZE ANY DICTIONARY
    라는 새로운 system privilege가 있어야 한다.
    이 권한은 만약 어떤 user가 SYSDBA 권한이 없는 경우 dictionary object와
    fixed object들을 analyze할 수 있도록 한다.
    3) GATHER_DATABASE_STATS라는 프로시져는 GATHER_FIXED라 불리우는 새로운
    argument를 가진다. 이 값은 default로 FALSE로 셋팅된다. 즉, 기본적으로
    fixed table들에 대해서는 통계정보를 생성하지 않도록 한다.
    전형적인 System WorkLoad가 있는 동안에는 fixed table들에 대하여
    한번만 analyze하면 충분하다.
    4) GATHER_FIXED_OBJECTS_STATS라는 procedure를 사용하여 fixed table들에
    대한 통계정보를 모으는 것도 가능하다. 또한 모든 fixed table들에 대하여
    통계정보를 delete하는 것도 가능하고, fixed table에 통계정보를
    export 또는 import하는 것도 가능하다.
    Example
    none
    Reference Documents
    <Note:266040.1>

    Hi,
    Please see here,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/stats.htm#i41448
    If the table/s are changing very frequently than its better to gather the stats manually.This would lead teh volatile table coming up into the stats job again and again.
    For the system stats and data dictionary stats,they are not collected by default.So there is no choice but to gather them manually.
    Aman....

  • Auto optimizer stats collection enabled, but not running and not showing up

    I enabled auto optimizer stats collection days ago, but it never ran. DB version is 11gr2, OS is redhat 5. It shows enabled in dba_autotask_client, but not in autotask_task. Please help on this issue.
    SQL> select client_name, status from dba_autotask_client;
    CLIENT_NAME STATUS
    auto optimizer stats collection ENABLED
    auto space advisor DISABLED
    sql tuning advisor ENABLED
    SQL> select task_name, status, to_char(last_good_date, 'YYYY-MM-DD HH24:MI:SS') last_good_date, last_good_duration
    from dba_autotask_task
    where client_name = 'auto optimizer stats collection'; 2 3
    no rows selected
    SQL> select program_action, number_of_arguments, enabled
    from dba_scheduler_programs
    where owner = 'SYS'
    and program_name = 'GATHER_STATS_PROG'; 2 3 4
    PROGRAM_ACTION NUMBER_OF_ARGUMENTS ENABL
    dbms_stats.gather_database_stats_job_proc 0 TRUE
    SQL> select w.window_name, c.autotask_status, c.optimizer_stats, w.repeat_interval, w.enabled
    -- , w.duration, w.last_start_date, w.next_start_date
    2 from dba_autotask_window_clients c , dba_scheduler_windows w
    3 4 where c.window_name = w.window_name
    5 order by last_start_date desc;
    WINDOW_NAME AUTOTASK OPTIMIZE REPEAT_INTERVAL ENABL
    MONDAY_WINDOW ENABLED ENABLED freq=daily;byday=MON;byhour=22;byminute=0; bysecond=0 TRUE
    SUNDAY_WINDOW ENABLED ENABLED freq=daily;byday=SUN;byhour=6;byminute=0; bysecond=0 TRUE
    SATURDAY_WINDOW ENABLED ENABLED freq=daily;byday=SAT;byhour=6;byminute=0; bysecond=0 TRUE
    FRIDAY_WINDOW ENABLED ENABLED freq=daily;byday=FRI;byhour=22;byminute=0; bysecond=0 TRUE
    THURSDAY_WINDOW ENABLED ENABLED freq=daily;byday=THU;byhour=22;byminute=0; bysecond=0 TRUE
    WEDNESDAY_WINDOW ENABLED ENABLED freq=daily;byday=WED;byhour=22;byminute=0; bysecond=0 TRUE
    TUESDAY_WINDOW ENABLED ENABLED freq=daily;byday=TUE;byhour=22;byminute=0; bysecond=0 TRUE
    7 rows selected.
    SQL>

    SQL> select max(last_analyzed) from all_tables where owner='ARAD';
    MAX(LAST_
    26-SEP-12

  • Disable Automatic Optimizer Statistics

    Hi there
    I wanted to query user_tab_modifications to track, number of rows updated in a week. Since this view is refreshed automatically when Automatic Optimizer Statistics gathers statistics, i disabled the Automatic Optimizer Statistics. Now i am executing execute dbms_stats.FLUSH_DATABASE_MONITORING_INFO(); manually to get the view populated with number of rows updated.
    My concern here is , will i get the exact number of rows updated in a week from user_tab_modifications by doing this ? Also, is there anything else that is also updating this view apart from optimizer statistics that are gathered on a table.
    Thanks

    You could try writing some PLSQL on your own.
    How about :
    SQL> create table count_X_updates (update_count number);
    Table created.
    SQL> insert into count_X_updates values (0);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> create table X (col_1 varchar2(5), col_2 varchar2(5), col_3 number);
    Table created.
    SQL> insert into X values ('a','first',1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> create or replace trigger count_x_updates_trg
      2  after update of col_1,col_2,col_3
      3  on X
      4  for each row
      5  declare prev_cnt number;
      6  begin
      7  update count_X_updates set update_count = update_count+1;
      8* end;
    SQL> /
    Trigger created.
    SQL>  update x set col_1 = 'b', col_2='secnd',col_3=2;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select * from count_X_updates;
    UPDATE_COUNT
               1
    SQL>  update x set col_1 = 'c' where col_3=2;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select * from count_X_updates;
    UPDATE_COUNT
               2
    SQL> select * from x;
    COL_1 COL_2      COL_3
    c     secnd          2
    SQL>Note : This trigger code has to be improved because
    a. Multiple sessions might get the same value
    b. It introduces a point of serialisation -- multiple session will wait on a row lock on the table count_X_updates -- effectively meaning that all other sessions attempting to update X will wait (even if they are updating different rows in X) till each preceding one issues a COMMIT.
    So, this demo code is only to show you PLSQL Triggers. But it cannot be used in Production.
    Practice some PLSQL. Read up on autonomous transactions.
    Hemant K Chitale

  • Optimizer Statistics collection after upgrade from 8i to 10R2

    I just upgraded database from 8.1.7 to 10R2 .
    What would the best approach for Optimizer Statistics collection. We would like to open database for test , but I afraid some quries going to run slow without latest stats. Should I run it manually or let Oracle run it’s default stats collection job later on.
    Any suggestions?

    user594143
    You really need a strategy before an upgrade like this, but you have two options -
    a) try to make the 10g stats collection identical to the 8i stats collection. Check the code you used to run, check the 8i default values for the parameters in your current dbms_stats() calls, and write them in explicitly when you run the code under 10g.
    OR
    b) do a full 10g conversion. Get rid of your own collection code, clear out most of the old settings you had in your parameter file for fiddling with the optimizer, do a 'gather_schema_stats' then leave 10g to do its default thing and fix any problems that appear.
    If you have testing time on a non-production system, then (b) is the strategic option - although personally I think it tends to collect too many histograms and still needs some refinement; if you don't have any testing time and you're going straight into production then (a) is the least threatening option (and if someone's made you do that, you might also set the optimizer_features_enable to 8.1.7 until you can do some proper upgrade tests).
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • Statistics Collection to a Table

    Hello,
    i need to gather statistics for few tables from a schema, to a separate table. Basically i have gather the stats into newly created table. my question is how can i do this? i know how to generate statistics using the dbms statspack, but do not have any idea of how to gather these statistics to a separate table>
    could any one shed some light here..
    Thanks..

    Hello,
    i created a table using the following dbms_stats package.
    BEGIN
    DBMS_STATS.create_stat_table (
    ownname => 'TEST',
    stattab => 'stats_table',
    tblspace => 'users');
    END;
    when this table created using the above script it created with the following columns.
    STATID VARCHAR2(30 BYTE),
    TYPE CHAR(1 BYTE),
    VERSION NUMBER,
    FLAGS NUMBER,
    C1 VARCHAR2(30 BYTE),
    C2 VARCHAR2(30 BYTE),
    C3 VARCHAR2(30 BYTE),
    C4 VARCHAR2(30 BYTE),
    C5 VARCHAR2(30 BYTE),
    N1 NUMBER,
    N2 NUMBER,
    N3 NUMBER,
    N4 NUMBER,
    N5 NUMBER,
    N6 NUMBER,
    N7 NUMBER,
    N8 NUMBER,
    N9 NUMBER,
    N10 NUMBER,
    N11 NUMBER,
    N12 NUMBER,
    D1 DATE,
    R1 RAW(32),
    R2 RAW(32),
    CH1 VARCHAR2(1000 BYTE)
    how can I interpret what column is for what? for example C1 to C5, N1 to N12 or R1, CH1 what do they mean?
    also will be able to get any info regarding the COst of the SQL statement that took to run? if not how can i obtain that info?
    Then I gathered statistics for one table to test.
    exec dbms_stats.gather_table_stats(ownname=>'TEST',
    estimate_percent=>10,
    statown=>'TEST',
    tabname=>'ord_receipts',
    stattab=>'STATS_TABLE',
    statid=>'TESTING');
    the data inserted into STATS_TABLE, but could not understand.
    I need to run these statistics on daily basis and save to a diffferent table daily . for example today is 01/01/2012 should have its own table for stats to collect and 01/02/2012 should have another table to collect the statistics.
    is there any way that i can dynamically incorporated when gathering the statistics, to create the STATS_TABLE concatanated with sysdate daily to analyze the statistics?
    Thanks..

  • Updated version installed and enabled, still does not work.

    I have installed the latest version of Adobe Flashplayer for internet explorer 11, does not work, tried unistalling using unistall tool then reinstalling, still does not work, disabled All security software and Firewall, tried reinstalling, still does not work, made sure scripting was allowed, reinstalled, still does not work, Tried installing active X version, still does not work. Manually went into program files, deleted Abobe Flash program, reinstalled still does not work. Used cleaning and registry repair tools, still does not work, unistalled then used cleaning registry tools, reinstalled, still does not work, tried older versions of Adobe Flashplayer, still does not work. Watched and followed Youtube video's on how to reair Adobe flash, still does not work. Tried disabling then unistalled and reinstalled, then enabled again, still does not work. Used the adobe Check from adobe website after uninstalling and reinstalling at least twenty times, still shows NOT Installed or enabled, downloaded again from adobe site, still not working, showing either not installed or enabled, check wether enabled or not, still enabled, went under Downloads on my computer, download is there, looked under programs, Adobe is in program menu on computer, still does not work. Any ideas? Anyone? I have tried everything, it just will not work no matter what I do.
    Running Window's 7 - Memory, DDR-2 667MHZ (1GB) 2037 MB, CPU Speed 3.2 GHZ, Hard Drive 320GB / 250GB- (699GB), Bandwidth 239 kbps,
    Internet Explorer 11, Charter High speed internet connection
    Message was edited by: Tiggerdad

    This is a known problem with Internet Explorer 11, which Microsoft has been aware of since October 18 when they released their latest "untested" browser. The pages can't recognize the browser, so they don't recognize any of the plugins, like Flash Player. So far, Microsoft has made NO indication that they have any plan to fix it soon.
    Microsoft's recommendation is to use Compatibility View for affected pages, and "pretend" you're using an different browser. Trouble with that is it has seen limited success at best, and you have to individually enable it for EVERY page that has problems.
    I'm not big on "pretending" so I recommend actually using another browser.
    Firefox (from Mozilla)
    Opera (from Opera)
    Safari (from Apple)
    Chrome (from Google)
    ANY of those will work where IE11 won't, with the Flash Player Plug-in (For all other browsers), and Chrome doesn't even need that because it has its own Flash Player plugin built in.

  • MaxDB UpdAllStats - missing optimizer statistics for one name space

    Hi experts,
    every weekend the job UpdAllStats runs in the SAP systems hosted by us (weekdays just PrepUpdStats+UpdStats). Now we're facing the issue that in one system there are no optimizier statistics for all tables in one special name space - let's call it /XYZ/TABLE1 etc.
    We randomly checked tables in that name space via DB20/DB50 and no optimizer statistics could be found. So we randomly checked other tables like MARA, VBAK etc. - all optimizer statistics up to date for those tables.
    We even started the statistics refresh via DB20 manually for one of the tables - still no optimizer statistics appearing for this table.
    I mean it's an update over all optimizer statistics - I rechecked note 927882 - FAQ: SAP MaxDB UPDATE STATISTICS and some others but couldn't find any reason for these tables being exluded. Especially I don't understand why the manual statistics refresh wouldn't work...
    Does anybody have an idea why this could happen?
    Thanks for your ideas in advance!
    Regards
    Marie

    Hi again,
    well it seems to be more of a visualisation problem I guess.
    We figured out that in MaxDB Database Studio you can see the optimizier statistics but not in the SAP system itself.
    We'll keep you up to date.
    Best
    Marie
    Edit: it was really just a visualisation problem... DB Studio rhows the right values

  • How to disable automatic statistics collections on tables

    Hi
    I am using Oracle 10g and we have few tables which are frequently truncated and news rows added to it. Oracle automatically analyzes the table by some means which collects statistics of the table but at the wrong time(when the table is empty). This makes my query to do a full table scan rather using indexes since the statistics was collected when the table was empty.Could any one please let me know how to disable the automatic statistics collection feature of Oracle?
    Cheers
    Anantha PV

    Hi
    I am using Oracle 10g and we have few tables which
    are frequently truncated and news rows added to it.
    Oracle automatically analyzes the table by some means
    which collects statistics of the table but at the
    wrong time(when the table is empty). This makes my
    query to do a full table scan rather using indexes
    since the statistics was collected when the table was
    empty.Could any one please let me know how to disable
    the automatic statistics collection feature of
    Oracle?
    First of all I think it's important that you understand why Oracle collects statistics on these tables: Because it considers the statistics of the object to be missing or stale. So if you just disable the statistics gathering on these tables then you won't have statistics at all or outdated statistics.
    So as said by the previous posts you should gather the statistics manually yourself anyway. If you do so right after loading the data into the truncated table, you don't need to disable the automatic statistics gathering as it only processes objects that are stale or don't have statistics at all.
    If you still think that you need to disable it there are several ways to accomplish it:
    As already mentioned, for particular objects you can lock the statistics using DBMS_STATS.LOCK_TABLE_STATS, or for a complete schema using DBMS_STATS.LOCK_SCHEMA_STATS. Then these statistics won't be touched by the automatic gathering job. You still can gather statistics using the FORCE=>true option of the GATHER__STATS procedures.
    If you want to change the automatic gathering job that it only gathers statistics on objects owned by Oracle (data dictionary, AWR etc.), then you can do so by calling DBMS_STATS.SET_PARAM('AUTOSTATS_TARGET', 'ORACLE'). This is the recommended method.
    If you disable the schedule job as mentioned in the documentation by calling DBMS_SCHEDULER.DISABLE('GATHER_STATS_JOB') then no statistics at all will be gathered automatically, causing your data dictionary statistics to be become stale over time, which could lead to suboptimal performance of queries on the data dictionary.
    All this applies to Oracle 10.2, some of the features mentioned might not be available in Oracle 10.1 (as you haven't mentioned your version of 10g).
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle:
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • How stop the automatic statistics collection job after the maintenance wind

    Hi,
    we are for a solution to stop the automatic statistics collection job after the maintenance window finished.
    we disable all jobs except the automatic statistics collection, because this is the only one we want to run. Then we define specific values for the interval and duration parameters of the maintenance window to customize this task.
    But for their systems it is very important that this job/task will immediately stop when the window is closed!!!
    So, how could we ensure this behavior.
    For Oracle 10g it is easy because the statistic job always exists and it is possible to set its duration and create an addtional event based job which kills all jobs that are running over duration.
    In Oracle 11g the statistic job is created by the system during the maintenance window is open.
    We are not able to modify parameters of this system job. After the maintenance window closed the job is already running - only with another resource priority - but it is running.
    Please help me in this scenario
    Thanks&Regards
    Prem

    ?So basically you are saying is if none of the tables are changed then GATHER_STATS_JOB will not run, but i see tables are updated still the job is not running. I did >query dba_scheduler_jobs and the state of the job is true and scheduled. Please see my previous post on the output
    Am i missing anything here, do i look for some parameters settings
    So basically you are saying is if none of the tables are changed then GATHER_STATS_JOB will not run,GATHER_STATS_JOB will run and if there are any table in which there's a 10 percent change in data, it will gather statistics on that table. If no table data have changes less than 10 percent, it will not gather statistics.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/stats.htm#i41282
    Hope this helps.
    -Anantha

  • Doubt regarding automatic statistics collection in Oracle 10g

    I am using Oracle 10g in Linux
    Does statistic collection for tables throughout the database happen automatically or should we manually analyze the tables using
    Analyze command or DBMS_STATS package ?
    AWR collects statistics(snapshots) every 1 hr but does it mean it collects only session and database related statistics and not the table related statistics?

    I am using Oracle 10g in Linux Version and os name and version?
    AWR collects statistics(snapshots) every 1 hr butIt's performance related statistics. Read about data gathering and AWR.
    Note that AWR is an extra licensable feature thru Management packs.

  • Managing statistics for object collections used as table types in SQL

    Hi All,
    Is there a way to manage statistics for collections used as table types in SQL.
    Below is my test case
    Oracle Version :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> Original Query :
    SELECT
         9999,
         tbl_typ.FILE_ID,
         tf.FILE_NM ,
         tf.MIME_TYPE ,
         dbms_lob.getlength(tfd.FILE_DATA)
    FROM
         TG_FILE tf,
         TG_FILE_DATA tfd,
              SELECT
              FROM
                   TABLE
                        SELECT
                             CAST(TABLE_ESC_ATTACH(OBJ_ESC_ATTACH( 9999, 99991, 'file1.png', NULL, NULL, NULL),
                             OBJ_ESC_ATTACH( 9999, 99992, 'file2.png', NULL, NULL, NULL)) AS TABLE_ESC_ATTACH)
                        FROM
                             dual
         )     tbl_typ
    WHERE
         tf.FILE_ID     = tfd.FILE_ID
    AND tf.FILE_ID  = tbl_typ.FILE_ID
    AND tfd.FILE_ID = tbl_typ.FILE_ID;
    Elapsed: 00:00:02.90
    Execution Plan
    Plan hash value: 3970072279
    | Id  | Operation                                | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                         |              |     1 |   194 |  4567   (2)| 00:00:55 |
    |*  1 |  HASH JOIN                               |              |     1 |   194 |  4567   (2)| 00:00:55 |
    |*  2 |   HASH JOIN                              |              |  8168 |   287K|   695   (3)| 00:00:09 |
    |   3 |    VIEW                                  |              |  8168 |   103K|    29   (0)| 00:00:01 |
    |   4 |     COLLECTION ITERATOR CONSTRUCTOR FETCH|              |  8168 | 16336 |    29   (0)| 00:00:01 |
    |   5 |      FAST DUAL                           |              |     1 |       |     2   (0)| 00:00:01 |
    |   6 |    TABLE ACCESS FULL                     | TG_FILE      |   565K|    12M|   659   (2)| 00:00:08 |
    |   7 |   TABLE ACCESS FULL                      | TG_FILE_DATA |   852K|   128M|  3863   (1)| 00:00:47 |
    Predicate Information (identified by operation id):
       1 - access("TF"."FILE_ID"="TFD"."FILE_ID" AND "TFD"."FILE_ID"="TBL_TYP"."FILE_ID")
       2 - access("TF"."FILE_ID"="TBL_TYP"."FILE_ID")
    Statistics
              7  recursive calls
              0  db block gets
          16783  consistent gets
          16779  physical reads
              0  redo size
            916  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              2  rows processed Indexes are present in both the tables ( TG_FILE, TG_FILE_DATA ) on column FILE_ID.
    select
         index_name,blevel,leaf_blocks,DISTINCT_KEYS,clustering_factor,num_rows,sample_size
    from
         all_indexes
    where table_name in ('TG_FILE','TG_FILE_DATA');
    INDEX_NAME                     BLEVEL LEAF_BLOCKS DISTINCT_KEYS CLUSTERING_FACTOR     NUM_ROWS SAMPLE_SIZE
    TG_FILE_PK                          2        2160        552842             21401       552842      285428
    TG_FILE_DATA_PK                     2        3544        852297             61437       852297      852297 Ideally the view should have used NESTED LOOP, to use the indexes since the no. of rows coming from object collection is only 2.
    But it is taking default as 8168, leading to HASH join between the tables..leading to FULL TABLE access.
    So my question is, is there any way by which I can change the statistics while using collections in SQL ?
    I can use hints to use indexes but planning to avoid it as of now. Currently the time shown in explain plan is not accurate
    Modified query with hints :
    SELECT    
        /*+ index(tf TG_FILE_PK ) index(tfd TG_FILE_DATA_PK) */
        9999,
        tbl_typ.FILE_ID,
        tf.FILE_NM ,
        tf.MIME_TYPE ,
        dbms_lob.getlength(tfd.FILE_DATA)
    FROM
        TG_FILE tf,
        TG_FILE_DATA tfd,
            SELECT
            FROM
                TABLE
                        SELECT
                             CAST(TABLE_ESC_ATTACH(OBJ_ESC_ATTACH( 9999, 99991, 'file1.png', NULL, NULL, NULL),
                             OBJ_ESC_ATTACH( 9999, 99992, 'file2.png', NULL, NULL, NULL)) AS TABLE_ESC_ATTACH)
                        FROM
                             dual
        tbl_typ
    WHERE
        tf.FILE_ID     = tfd.FILE_ID
    AND tf.FILE_ID  = tbl_typ.FILE_ID
    AND tfd.FILE_ID = tbl_typ.FILE_ID;
    Elapsed: 00:00:00.01
    Execution Plan
    Plan hash value: 1670128954
    | Id  | Operation                                 | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                          |                 |     1 |   194 | 29978   (1)| 00:06:00 |
    |   1 |  NESTED LOOPS                             |                 |       |       |            |          |
    |   2 |   NESTED LOOPS                            |                 |     1 |   194 | 29978   (1)| 00:06:00 |
    |   3 |    NESTED LOOPS                           |                 |  8168 |  1363K| 16379   (1)| 00:03:17 |
    |   4 |     VIEW                                  |                 |  8168 |   103K|    29   (0)| 00:00:01 |
    |   5 |      COLLECTION ITERATOR CONSTRUCTOR FETCH|                 |  8168 | 16336 |    29   (0)| 00:00:01 |
    |   6 |       FAST DUAL                           |                 |     1 |       |     2   (0)| 00:00:01 |
    |   7 |     TABLE ACCESS BY INDEX ROWID           | TG_FILE_DATA    |     1 |   158 |     2   (0)| 00:00:01 |
    |*  8 |      INDEX UNIQUE SCAN                    | TG_FILE_DATA_PK |     1 |       |     1   (0)| 00:00:01 |
    |*  9 |    INDEX UNIQUE SCAN                      | TG_FILE_PK      |     1 |       |     1   (0)| 00:00:01 |
    |  10 |   TABLE ACCESS BY INDEX ROWID             | TG_FILE         |     1 |    23 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       8 - access("TFD"."FILE_ID"="TBL_TYP"."FILE_ID")
       9 - access("TF"."FILE_ID"="TBL_TYP"."FILE_ID")
           filter("TF"."FILE_ID"="TFD"."FILE_ID")
    Statistics
              0  recursive calls
              0  db block gets
             16  consistent gets
              8  physical reads
              0  redo size
            916  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              2  rows processed
    Thanks,
    B

    Thanks Tubby,
    While searching I had found out that we can use CARDINALITY hint to set statistics for TABLE funtion.
    But I preferred not to say, as it is currently undocumented hint. I now think I should have mentioned it while posting for the first time
    http://www.oracle-developer.net/display.php?id=427
    If we go across the document, it has mentioned in total 3 hints to set statistics :
    1) CARDINALITY (Undocumented)
    2) OPT_ESTIMATE ( Undocumented )
    3) DYNAMIC_SAMPLING ( Documented )
    4) Extensible Optimiser
    Tried it out with different hints and it is working as expected.
    i.e. cardinality and opt_estimate are taking the default set value
    But using dynamic_sampling hint provides the most correct estimate of the rows ( which is 2 in this particular case )
    With CARDINALITY hint
    SELECT
        /*+ cardinality( e, 5) */*
    FROM
         TABLE
              SELECT
                   CAST(TABLE_ESC_ATTACH(OBJ_ESC_ATTACH( 9999, 99991, 'file1.png', NULL, NULL, NULL),
                   OBJ_ESC_ATTACH( 9999, 99992, 'file2.png', NULL, NULL, NULL)) AS TABLE_ESC_ATTACH)
              FROM
                   dual
         ) e ;
    Elapsed: 00:00:00.00
    Execution Plan
    Plan hash value: 1467416936
    | Id  | Operation                             | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                      |      |     5 |    10 |    29   (0)| 00:00:01 |
    |   1 |  COLLECTION ITERATOR CONSTRUCTOR FETCH|      |     5 |    10 |    29   (0)| 00:00:01 |
    |   2 |   FAST DUAL                           |      |     1 |       |     2   (0)| 00:00:01 |
    With OPT_ESTIMATE hint
    SELECT
         /*+ opt_estimate(table, e, scale_rows=0.0006) */*
    FROM
         TABLE
              SELECT
                   CAST(TABLE_ESC_ATTACH(OBJ_ESC_ATTACH( 9999, 99991, 'file1.png', NULL, NULL, NULL),
                   OBJ_ESC_ATTACH( 9999, 99992, 'file2.png', NULL, NULL, NULL)) AS TABLE_ESC_ATTACH)
              FROM
                   dual
         ) e ;
    Execution Plan
    Plan hash value: 4043204977
    | Id  | Operation                              | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                       |      |     5 |   485 |    29   (0)| 00:00:01 |
    |   1 |  VIEW                                  |      |     5 |   485 |    29   (0)| 00:00:01 |
    |   2 |   COLLECTION ITERATOR CONSTRUCTOR FETCH|      |     5 |    10 |    29   (0)| 00:00:01 |
    |   3 |    FAST DUAL                           |      |     1 |       |     2   (0)| 00:00:01 |
    With DYNAMIC_SAMPLING hint
    SELECT
        /*+ dynamic_sampling( e, 5) */*
    FROM
         TABLE
              SELECT
                   CAST(TABLE_ESC_ATTACH(OBJ_ESC_ATTACH( 9999, 99991, 'file1.png', NULL, NULL, NULL),
                   OBJ_ESC_ATTACH( 9999, 99992, 'file2.png', NULL, NULL, NULL)) AS TABLE_ESC_ATTACH)
              FROM
                   dual
         ) e ;
    Elapsed: 00:00:00.00
    Execution Plan
    Plan hash value: 1467416936
    | Id  | Operation                             | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                      |      |     2 |     4 |    11   (0)| 00:00:01 |
    |   1 |  COLLECTION ITERATOR CONSTRUCTOR FETCH|      |     2 |     4 |    11   (0)| 00:00:01 |
    |   2 |   FAST DUAL                           |      |     1 |       |     2   (0)| 00:00:01 |
    Note
       - dynamic sampling used for this statement (level=2)I will be testing the last option "Extensible Optimizer" and put my findings here .
    I hope oracle in future releases, improve the statistics gathering for collections which can be used in DML and not just use the default block size.
    By the way, are you aware why it uses the default block size ? Is it because it is the smallest granular unit which oracle provides ?
    Regards,
    B

  • AUTOMATIC UPDATE STATISTICS for VB* tables ON automatically

    Hello All,
    We had reviewed our ECC system with SAP and they recommended us to OFF the AUTOMATIC UPDATE STATISTICS for VBDATA, VBHDR and VBMOD.
    We executed the script EXEC sp_autostats <tablename>, 'OFF' but the status goes ON after a while.
    Checked the SAP note 771352 but did not get proper idea from it.
    MS SQL database used is 2008.
    Can someone suggest and share his/her experience.
    Regards,
    Mohit

    Hi Mohit,
    Did you ran the sap_z* script ?
    What is your SP level - did you check 1702325 - Alerts appear for VB tables
    Also, I asked to to use NORECOMPUTE - have you tried that ?
    Regards

  • Run optimizer statistics for one table

    dear all,
    i noticed an error in DB16 , that is  <b>Missing Statistics for a table </b> SAPGRP.MC03BF0SETUP.
    How to run/ generate the stats. for this table

    Dear Somckit
    here is the error msg.  from DB16.
                                                                                    Description         Table: SAPGRP.MC03BF0SETUP # Table or index has no optimizer
    Correction Type     D                                                           
    Corrective Action   Collect optimizer statistics                                
    Check Log           /oracle/GRP/sapcheck/cdwqhqnz.chk                           
    Single Messages                                                                      
    No.   Description                                                                    
    1     Table: SAPGRP.MC03BF0SETUP # Table or index has no optimizer statistics        
    2     Table: SAPGRP.MC03BX0SETUP # Table or index has no optimizer statistics        
    3     Table: SAPGRP.MC03UM0SETUP # Table or index has no optimizer statistics        
    4     Index: SAPGRP.MC03BF0SETUP~0 # Table or index has no optimizer statistics      
    5     Index: SAPGRP.MC03BX0SETUP~0 # Table or index has no optimizer statistics      
    6     Index: SAPGRP.MC03UM0SETUP~0 # Table or index has no optimizer statistics                                                                               
    Thank u.

  • I am trying to allow guests on windows to connect to shares on my Lion server but it keeps asking for a password for guest. I have allow guest users to access this share enabled but it still does not work.

    I am trying to allow guests on windows to connect to shares on my Lion server but it keeps asking for a password for guest. I have allow guest users to access this share enabled but it still does not work.

    Ditto. Guest accounts shouldn't have a password. No way to enter one in System Prefs...

Maybe you are looking for