Statistics gathering in 10g - Histograms

I went through some articles in the web as well as in the forum regarding stats gathering which I have posted here.
http://structureddata.org/2008/03/26/choosing-an-optimal-stats-gathering-strategy/
In the above post author mentions that
"It may be best to change the default value of the METHOD_OPT via DBMS_STATS.SET_PARAM to 'FOR ALL COLUMNS SIZE REPEAT' and gather stats with your own job. Why REPEAT and not SIZE 1? You may find that a histogram is needed somewhere and using SIZE 1 will remove it the next time stats are gathered. Of course, the other option is to specify the value for METHOD_OPT in your gather stats script"
Following one is post from Oracle forums.
Statistics
In the above post Mr Lewis mentions about adding
method_opt => 'for all columns size 1' to the DBMS job
And in the same forum post Mr Richard Foote has mentioned that
"Not only does it change from 'FOR ALL COLUMNS SIZE 1' (no histograms) to 'FOR ALL COLUMNS SIZE AUTO' (histograms for those tables that Oracle deems necessary based on data distribution and whether sql statements reference the columns), but it also generates a job by default to collect these statistics for you.
It all sounds like the ideal scenario, just let Oracle worry about it for you, except for the slight disadvantage that Oracle is not particularly "good" at determining which columns really need histograms and will likely generate many many many histograms unnecessarily while managing to still miss out on generating histograms on some of those columns that do need them."
http://richardfoote.wordpress.com/2008/01/04/dbms_stats-method_opt-default-behaviour-changed-in-10g-be-careful/
Our environment Windows 2003 server Oracle 10.2.0.3 64bit oracle
We use the following script for our analyze job.
BEGIN DBMS_STATS.GATHER_TABLE_STATS
(ownname => ''username'', '
'tabname => TABLE_NAME
'method_opt => ''FOR ALL COLUMNS SIZE AUTO''
'granularity => ''ALL'', '
'cascade => TRUE, '
'degree => DBMS_STATS.DEFAULT_DEGREE);
END;
This anayze job runs a long time (8hrs) and we are also facing performance issues in production environment.
Here are my questions
What is the option I should use for method_opt parameter?
I am sure there are no hard and fast rules for this and each environment is different.
But reading all the above post kind of made me confused and want to be sure we are using the correct options.
I would appreciate any suggestions, insight or further readings regarding the same.
Appreciate your time
Thanks
Niki

Niki wrote:
I went through some articles in the web as well as in the forum regarding stats gathering which I have posted here.
http://structureddata.org/2008/03/26/choosing-an-optimal-stats-gathering-strategy/
In the above post author mentions that
"It may be best to change the default value of the METHOD_OPT via DBMS_STATS.SET_PARAM to 'FOR ALL COLUMNS SIZE REPEAT' and gather stats with your own job. Why REPEAT and not SIZE 1? You may find that a histogram is needed somewhere and using SIZE 1 will remove it the next time stats are gathered. Of course, the other option is to specify the value for METHOD_OPT in your gather stats script"
This anayze job runs a long time (8hrs) and we are also facing performance issues in production environment.
Here are my questions
What is the option I should use for method_opt parameter?
I am sure there are no hard and fast rules for this and each environment is different.
But reading all the above post kind of made me confused and want to be sure we are using the correct options.As the author of one of the posts cited, let me make some comments. First, I would always recommend starting with the defaults. All to often people "tune" their dbms_stats call only to make it run slower and gather less accurate stats than if they did absolutely nothing and let the default autostats job gather stats in the maintenance window. With your dbms_stats command I would comment that granularity => 'ALL', is rarely needed and certainly adds to the stats collection times. Also, if the data has not changed enough why recollect stats? This is the advantage of the using options=>'gather stale'. You haven't mentioned what kind of application your database is used for: OLTP or data warehouse. If it is OLTP and the application uses bind values, then I would recommend to disable or manually collect histograms (bind peeking and histograms should not be used together in 10g) using size 1 or size repeat. Histograms can be very useful in a DW where skew may be present.
The one non-default option I find myself using is degree=>dbms_stats.auto_degree. This allows dbms_stats to choose a DOP for the gather based on the size of the object. This works well if you dont want to specify a fixed degree or you would like dbms_stats to use a different DOP than the table is decorated with.
Hope this helps.
Regards,
Greg Rahn
http://structureddata.org

Similar Messages

  • Doubt Regarding Statistics Collection in 10g

    Hello,
    Me Jr Dba i have a doubt regarding statistics calculation in 10g.As we know that if we set
    the initilization parameter STATISTICS_LEVEL=Typical then AOS(Automatic Optimizer staistics) calculate the statistics for the tables, whose blocks are greater then 10% changed from the last calculation.Here my doubt is since already statistics are gathered,
    is there any necessity for us to gather the statistics manually by using
    DBMS_STATS.GATHER to see the tables or system statistics.
    Can u plz assist me on the above
    Regards,
    Vamsi

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

  • Statistics gathering

    Hello ,
    Every one I'm little confuse about "Statistics gathering" in ebs so I have some question in my mind which are following.
    kindly any one clear my concept about it.I really appreciate you.
    1.What is Statistics gathering ?
    2. What is the benefit of it?
    3.Can after this our ERP performance is better?
    one question is out this subject is that can If any one wanna APPS DBA then who must be DBA(oracle 10g,9i etc) or who only have a concept of oracle dba like backup,recovery,cloning etc.
    Regards,
    Shahbaz khan

    1.What is Statistics gathering ?
    Statistics gathering is a process by which Oracle scans some or all of your database objects (such as tables, indexes etc.) and stores the information in objects such as dbal_tables, dba_histograms. Oracle uses this information to determine the best execution path for statements it has to execute (such as select, update etc.)
    2. What is the benefit of it?
    It does help the queries become more efficient.
    3.Can after this our ERP performance is better?
    Typically, if you are experiencing performance issues, this is one of the first remedies.
    one question is out this subject is that can If any one wanna APPS DBA then who must be DBA(oracle 10g,9i etc) or who only have a concept of oracle dba like backup,recovery,cloning etc.I will let Hussein or Helios answer that question. They can offer a lot of helpful advice. You can also refer to Hussein's recent thread on a similar topic.
    See Re: Time Management and planned prep
    Hope this helps,
    Sandeep Gandhi

  • Setting of Optimizer Statistics Gathering

    I'm checking in my db setting and database is analysing each day. But as I notice there are a lot of tables that information shows last analysis in about month ago... Do I have to change some parameters?

    lesak wrote:
    I don't have any data that show you that my idea is good. I'd like to confirm on this forum that my idea is good or not. I've planned to make some changes to have better performance of query that read from top use tables. If this is bad solutions it's also important information for me.One point of view is that your idea is bad. That point of view would be to figure out what the best access for your query is and set that as a baseline, or figure out what statistics get you the correct plans on a single query that has multiple plans that are best with different values sent in through bind variables, and lock the statistics.
    Another point of view would be to gather current plans for currently used queries, then do nothing at all unless the optimizer suddenly decides to switch away from one, then figure out why.
    Also note the default statistics gathering is done in a window, if you have a lot of tables changing it could happen that you can't get stats in a timely fashion within the window.
    Whether the statistics gathering is appropriate may depend on how far off histograms are from describing the actual data distribution you see. What my be appropriate worry for one app may be obsessive tuning disorder for another. 200K rows out of millions may make no difference at all, or may make a huge difference if the newly added data is way off from what the statistics make the opitmizer think it is.
    One thing you are probably doing right is to recognize that tuning particular queries may be much more useful than obsessing over statistics.
    Note how much I've used the word "may" here.

  • How to genrate and check wait statistics in oracle 10g

    Dear all,
    how to genrate and check WAIT STATISTICS in oracle 10g on RHEL4.
    Regards,
    Ali

    Oracle Kernel keeps track of these statistics. Query v$waitstat for overall system level wait statistics or v$session_wait for individual session wait statistics.

  • Cgi statistics gathering under 6.1 and Solaris 9

    Hello all,
    is it possible to log for cgi requests the value for handling each of the time spent on the request?
    I see a lot of editable parameters in the 'Performance, Tuning and Scaling Guide' but can't figure out how to do that.
    Once in a thread I read "...enable statistics gathering, then add %duration% to your access log format line".
    I can't find the terminus %duration% in the guide, which parameter is taken?
    Regards Nick

    Hello elvin,
    thanks for your reply. Now I think I managed to let the webserver log the duration of a cgi request, but I'm unsure how to interpret the value eg. in the access log I get
    ..."GET /cgi/beenden.cgi ... Gecko/20040113 MultiZilla/1.6.3.1d" 431710"
    ..."GET /pic.gif ... Gecko/20040113 MultiZilla/1.6.3.1d" 670"
    so the last value corresponds to my %duration% in the magnus.conf.
    431710 ... in msec? - makes no sense
    670 ... in msec?
    The complete string in magnus.conf reads as follows:
    Init fn="flex-init" access="$accesslog" format.access="%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] \"%Req->reqpb.clf
    -request%\" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% \"%Req->headers.user-agent%\" \%duration%\""Regards Nick

  • How to check the progress of statistics gathering on a table?

    Hi,
    I have started the statistics gathering on a few big tables in my database.
    How to check the progress of statistics gathering on a table? Is there any data dictionary views or tables to monitor the progress of stats gathering.
    Regds,
    Kunwar

    Hi all
    you can check with this small script.
    it lists the sid details for long running session like
    when it started
    when last update
    how much time still left
    session status "ACTIVE/INACTIVE". etc.
    -- Author               : Syed Kaleemuddin_
    -- Script_name          : sid_long_ops.sql
    -- Description          : list the sid details for long running session like when it started when last update how much time still left.
    set lines 200
    col OPNAME for a25
    Select
    a.sid,
    a.serial#,
    b.status,
    a.opname,
    to_char(a.START_TIME,' dd-Mon-YYYY HH24:mi:ss') START_TIME,
    to_char(a.LAST_UPDATE_TIME,' dd-Mon-YYYY HH24:mi:ss') LAST_UPDATE_TIME,
    a.time_remaining as "Time Remaining Sec" ,
    a.time_remaining/60 as "Time Remaining Min",
    a.time_remaining/60/60 as "Time Remaining HR"
    From v$session_longops a, v$session b
    where a.sid = b.sid
    and a.sid =&sid
    And time_remaining > 0;
    Sample output:
    SQL> @sid_long_ops
    Enter value for sid: 474
    old 13: and a.sid =&sid
    new 13: and a.sid =474
    SID SERIAL# STATUS OPNAME START_TIME LAST_UPDATE_TIME Time Remaining Sec Time Remaining Min Time Remaining HR
    474 2033 ACTIVE Gather Schema Statistics 06-Jun-2012 20:10:49 07-Jun-2012 01:35:24 572 9.53333333 .158888889
    Thanks & Regards
    Syed Kaleemuddin.
    Oracle Apps DBA
    Mobile: +91 9966270072
    Email: [email protected]

  • Understand Oracle statistics gathering

    Hi experts,
    I am new in Oracle performance tuning. can anyone tell me what the mean of "Oracle statistics gathering" in simple words/way. i has read it from Oracle site http://docs.oracle.com/cd/A87860_01/doc/server.817/a76992/stats.htm.
    But i am not understand it properly. It Any role in oracle performance tuning? Does it make good performance of Oracle DB???
    Reg
    Harshit

    Hi,
    You can check this in some Easy way :ORACLE-BASE - Oracle Cost-Based Optimizer (CBO) And Statistics (DBMS_STATS)
    >> It Any role in oracle performance tuning? Does it make good performance of Oracle DB???  :Yes
    HTH

  • Gathering statistics manually in 10g !!

    Hi, all.
    The database is 2 node RAC 10.2.0.2.0.
    By default, 'GATHER_STATS_JOB' job is enabled and it takes statistics of
    "ALL objects in a database" every 22:00 on a daily basis.
    (objects that have changes more than 10% of the rows).
    I found that the default job is causing library cache lock wait event by
    invalidating objects too frequently in the shared pool
    ( especially in a RAC environment).
    Therefore, I am considering taking statistics only for application schema
    on a weekly basis by using "DBMS_STATS.GATHER_SCHEMA_STATS" procedure.
    "EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS('NMSUSER',DBMS_STATS.AUTO_SAMPLE_SIZE);"
    takes statistics of all objects of NMSUSER schema.
    I would like to take statistics for objects that have more than "10% changes"
    of rows.
    What is the option for that??
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#sthref8115
    Thanks and Regards.
    Message was edited by:
    user507290

    Be very careful taking statistics with default setting of method_opt => 'FOR ALL COLUMNS SIZE AUTO' in 10g.
    Check the number of histograms you have (dba_tab_columns and dba_tab_histograms).
    The results may not be what you expect ...
    And they may be playing a part in your latch issues.
    Cheers
    Richard Foote

  • MBRC and SYSTEM STATISTICS in Oracle 10g database.

    Hi All,
    I am performing database upgrade from Oracle 8i Solaris to Oracle 10g HP-UX using exp/imp method.
    But i do have some doubts regarding MBRC and System statistics.
    MBRC in Oracle 10g is automatically adjusted if MBRC parameter is not set, but i found value 128 as shown below.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for HPUX: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> sho parameter multi
    NAME                                 TYPE                             VALUE
    db_file_multiblock_read_count        integer                          128Also i performed one simple full table scan to test it...but db file scattered read is performing on 128 blocks. So i dont think 128 is suitable and is automatic, i mean MBRC is not set accrodingly it always uses 128.
    Does this MBRC value affects whole database performance?
    Regarding SYSTEM STATISTICS i found below result:
    SQL> select * from AUX_STATS$
    SNAME                          PNAME                               PVAL1 PVAL2
    SYSSTATS_INFO                  STATUS                                    COMPLETED
    SYSSTATS_INFO                  DSTART                                    11-09-2009 04:59
    SYSSTATS_INFO                  DSTOP                                     11-09-2009 04:59
    SYSSTATS_INFO                  FLAGS                                   1
    SYSSTATS_MAIN                  CPUSPEEDNW                     128.239557
    SYSSTATS_MAIN                  IOSEEKTIM                              10
    SYSSTATS_MAIN                  IOTFRSPEED                           4096
    SYSSTATS_MAIN                  SREADTIM
    SYSSTATS_MAIN                  MREADTIM
    SYSSTATS_MAIN                  CPUSPEED
    SYSSTATS_MAIN                  MBRC
    SYSSTATS_MAIN                  MAXTHR
    SYSSTATS_MAIN                  SLAVETHRNow whether NOWORKLOAD or WORKLOAD is better, and this server is still under building process....so how can i collect WORKLOAD stats as high load on this server can't be performed?? Is it really require to gather system statistics, what will happen with NOWORLOAD stats?
    I have not seen single database where system stats are gathered in our organisation having more than 2000 databases.
    -Yasser

    Maybe this article written by Tom Kite helps:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:499197100346264909

  • Table Statistics Gathering Query

    Hey there,
    I'm currently getting trained in Oracle and one of the questions posed to me were create a table, insert a million rows into it and try to find the number of rows in it. I've tried the following steps to solve this,
    First table creation
    SQL> create table t1(id number);
    Table created.Data insertion
    SQL> insert into t1 select level from dual connect by level < 50000000;
    49999999 rows created.Gathering statistics
    SQL> exec dbms_stats.gather_table_stats('HR','T1');
    PL/SQL procedure successfully completed.Finally counting the number of rows
    SQL> select num_rows from user_tables where table_name='T1';
      NUM_ROWS
      49960410
    SQL> select count(*) from t1;
      COUNT(*)
      49999999My database version is,
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - ProductionI would like to know why there are two different results for the same table when using "num_rows" from the view "user_tables" and the aggregate function "count()" over the same table. Please do keep in mind that i'm studying oracle and this is from a conceptual point of view only. I would like to know how gathering the table statistics works using dbms_stats package works.
    Thank You,
    Vishal

    vishm8 wrote:
    Gathering statistics
    SQL> exec dbms_stats.gather_table_stats('HR','T1');
    PL/SQL procedure successfully completed.I would like to know why there are two different results for the same table when using "num_rows" from the view "user_tables" and the aggregate function "count()" over the same table. Please do keep in mind that i'm studying oracle and this is from a conceptual point of view only. I would like to know how gathering the table statistics works using dbms_stats package works.
    Thank You,
    VishalBecause you aren't specifying a value for estimate_percent in the procedure call (to gather_table_stats) Oracle will pick an estimate value for you. If you want to sample the entire table you would need to explicitly specify that in your procedure call.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_stats.htm#ARPLS68582

  • Statistics gather after 10g upgrade

    I am on apps 11.5.10.2, database has been recently upgraded from 9.2.0.6 to 10.2.0.4. I used to periodically use GATHER SCHEMA STATISTICS (ALL SCHEMA), in the previous release of db.
    What should be practiced after the upgrade? There are some custom schemas for third party tool. Does gather schema statistics concurrent program gather statistics for all the schema?
    Thanks
    SA

    user593719 wrote:
    Hussein,
    To register a custom schema, I have to go thru the series of steps like registering application, creating a TOP etc., right? What if my custom application is in some other windows server and only schema is in the apps database? Do we need still follow the same steps?
    Regards,
    SAI am not sure why you have this custom schema in this Apps database. If your custom schema has nothing to do with Apps, you would be better off creating a separate instance for this custom app. You could then use the automatic stats gathering mechanism in 10g to gather stats for this custom schema app.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/stats.htm#i41282
    HTH
    Srini

  • AWR Statistics gathering is taking hours...

    Is it normal in 10g to have the following job run for hours?
    EXEC SYS.DBMS_SCHEDULER.RUN_JOB('GATHER_STATS_JOB');
    It takes like 4 hours sometimes to run - we run it once a day..Thank you!

    AWR is the automatic workload repository - which is similar in mechanism to statspack, taking regular snapshots of the dynamic performance views.
    The gather_stats_job has nothing to do with the operation of the AWR, beyond the fact that AWR data is stored in tables, so the gather_stats_job may decided to collect stats on those tables from time to time.
    The default action for gather_stats_job is to collect stats for all tables with missing or stale statistics. The sample size for each table is chosen automatically (effectively by trial and error starting with a very small sample. Histograms are also collected automatically, based on a check of which columns have been used historically for "where" clauses combined with a sample to check if such columns show skewed data patterns.
    If you do a lot of inserts, updates, and deletes on this particular database, you are more likely to end up with table statistics becoming stale more frequently, leading to longer lists of tables that need stats recalculated.
    You may find that Oracle is generating too many histograms, and histograms can take a long time to construct. If this is the case, then you could consider changing the default setting for stats collection to skip the automatic histogram generation and add code to build histograms only on the columns that you think need them.
    [addendum: you say you are running gather_stats_job daily - but it runs automatically every weekday at 10:00 pm and all weekend; did you disable the standard job, or did you mean that you were just letting the standard job).
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "The greatest enemy of knowledge is not ignorance,
    it is the illusion of knowledge." Stephen Hawking.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Statistics gathered during import

    Does after IMP import the tables are analyzed automatically?
    When i done import process of TEST user
    imp system/manager file=/home/oracle/test.dmp FROMUSER=TEST TOUSER=TEST
    and when i execute following query
    SELECT table_name,last_analyzed FROM DBA_TABLES WHERE owner=TEST'
    I find that table/indexes are analyzed automatically.
    Does it means statistics are gathered automatically during import?
    Oracle 10.2.0.1

    Refer to this link please
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm#i1020893
    It seems it takes statistics for tables during export
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • Statistics/memory for 10g database

    can anybody guide me how much memory needed for one oracle 10g database? can anybody share the statistics on each oracle 10g process memory? - we are in the process of building production databases and would like to have some estimates/statistics

    That depends almost entirely on the application(s) a database supports. You can get a minimal install using a couple hundred MB of RAM, but that would probably be terribly insufficient for a high volume OLTP application. If your database has particularly large meory requirements, you could easily require 10's of GB of RAM for acceptable performance, but that would obviously be overkill for a low volume departmental application.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

Maybe you are looking for

  • Horizontal scroll bar for combo/lsit box in JSP

    hi, i want "Horizontal Scroll bar" for combo box to display long names. regards, krishna

  • Rollovers in Interactive PDF acting a bit sticky...?

    CS6. I've created "previous" & "next" buttons to move between pages on click...and placed these on the master page. They have rollover states which changes their appearance sightly & this works as intended....until after i click one of the buttons, a

  • ADF UIX JAAS

    Have any one out there came accross a good example on how to set up authentication for Oracle ADF Business Components UIX Clients

  • Login password not accepted/user accounts not listed

    I woke my laptop from sleep today and it didnt accept my password. I tried several times and it just wouldnt work anymore. I restarted the computer and my account wasnt even in the list as an option to login to. So I logged into root and I was able t

  • Youtube videos from channels open as playlists. Is this Firefox's fault?

    I recently downloaded Firefox because of Shockwave Flash problems with my old browser. Unfortunately all the videos from YouTube channels open as a playlist... Which is more annoying than the Shockwave Flash problems. Is this a feature of Firefox, or