Analyze a table

Hi,
This is regarding SQL tuning:
Oracle gathers statistics on the table when we analyze a table.
Actually what happens when we analyze a table internally?
Can some body please explain?
Thanks in advance.

Because the cost-based approach relies on statistics, you should generate statistics for all tables and clusters and all indexes accessed by your SQL statements before using the cost-based approach. If the size and data distribution of the tables change frequently, then regenerate these statistics regularly to ensure the statistics accurately represent the data in the tables.For more information you can view the following link
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96533/stats.htm#13547
Thanks

Similar Messages

  • Analyzing a table

    Could anybody please explain what is analyzing a table in oracle.. and whether this improves the performance.. like faster access of data from those tables.
    Thanks in advance

    The first thing could be the reading of the concept manual, Understanding the statistics.
    And yes, Oracle can change his explain plan (the "mannear" how Oracle will process your query) within different values of table statistics. Better or not, that depend.
    Nicolas.

  • Urgent :Analyze 14GB table

    Experts,
    I need to analyze a table which is 14GB and i have tried analyzeing it 3 times in sqlplus ,....but still wondering why its not analyzed.
    Iam using the below query to analyze
    EXECUTE SYS.DBMS_STATS.GATHER_TABLE_STATS (OwnName=>'SIEBEL',TabName=>'XXXXXX',Estimate_Percent=>10,Method_Opt=>'FOR ALL INDEXED COLUMNS SIZE AUTO ', DEGREE=>12, CASCADE=>TRUE, No_Invalidate=> FALSE);
    Could anyone help me in
    1)To check how much time it takes to analyse.
    2)How to confirm if its really analyzed.
    3)How to check if its analyzing.
    4)Any way to run it back ground

    and it depends on how many dependent object because cascade => true.Only INDEXES. Not dependent objects.
    cascade
    Gather statistics on the indexes for this table. Index statistics gathering is not parallelized. Using this option is
    equivalent to running the GATHER_INDEX_STATS Procedure on each of the table's indexes. Use the constant
    DBMS_STATS.AUTO_CASCADE to have Oracle determine whether index statistics to be collected or not. This is the
    default. The default value can be changed using theSET_PARAM Procedure.http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#i1036461

  • Analyze all tables of one schema

    hi,
    the analyze table command is:
    analyze table hr.employees compute statistics;
    Now I want analyze all tables in the hr schema
    how can I do it in a easy way,
    thanks,
    Zhiwei.

    the only way to disable monitoring (globally) is to set statistics_level=basic.Exactly.
    SYS@db102 SQL> select table_name,monitoring from dba_tables
      2  where table_name like 'TEST%';
    TABLE_NAME                     MON
    TEST_P                         YES
    TEST_MV                        YES
    TEST_F                         YES
    TEST11                         YES
    TEST                           YES
    TEST_TABLE                     YES
    TEST_PART                      YES
    TEST_LOB                       YES
    TEST_EMP                       YES
    TESTDECIMAL                    YES
    TEST3                          YES
    TEST1_DL2                      YES
    TEST01                         YES
    13 rows selected.
    SYS@db102 SQL> alter system set statistics_level=basic;
    System altered.
    SYS@db102 SQL> select table_name,monitoring from dba_tables
      2  where table_name like 'TEST%';
    TABLE_NAME                     MON
    TEST_P                         NO
    TEST_MV                        NO
    TEST_F                         NO
    TEST11                         NO
    TEST                           NO
    TEST_TABLE                     NO
    TEST_PART                      NO
    TEST_LOB                       NO
    TEST_EMP                       NO
    TESTDECIMAL                    NO
    TEST3                          NO
    TEST1_DL2                      NO
    TEST01                         NO
    13 rows selected.
    SYS@db102 SQL>                                                                                                            that's what I meant by "in 10g you have to do it explicitly".

  • Analyzing all tables in schema

    Hello everyone,
    I am used below command to analyze all tables in schema
    EXEC DBMS_STATS.gather_schema_stats (ownname => 'CONTRACT', cascade =>true,estimate_percent => dbms_stats.auto_sample_size);when look at tables in dba_tables, for none of the tables LAST_ANALYZED date is changed to today. But when I did below
    EXECUTE DBMS_STATS.GATHER_TABLE_STATS(ownname => 'CONTRACT', tabname => 'CONT_NAME', method_opt => 'FOR ALL COLUMNS', granularity => 'ALL', cascade => TRUE, degree => DBMS_STATS.DEFAULT_DEGREE);I am see LAST_ANALYZED changed to today in dba_tables.
    If I need to change LAST_ANALYZED to all tables do I need to produce the above command for all tables? There are more then 700 tables for this application.
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    user3636719 wrote:
    EXEC DBMS_STATS.gather_schema_stats (ownname => 'CONTRACT', cascade =>true,estimate_percent => dbms_stats.auto_sample_size);
    and
    EXECUTE DBMS_STATS.GATHER_TABLE_STATS(ownname => 'CONTRACT', tabname => 'CONT_NAME', method_opt => 'FOR ALL COLUMNS', granularity => 'ALL', cascade => TRUE, degree => DBMS_STATS.DEFAULT_DEGREE);are fundamentally different, you cannot compare them. In gather_schema_stats, oracle used most defaults, decided none needed new stats collected, so it didn't do anything. In the second, you changed method_opt, granularity and degree etc from default values (as set in your db perhaps), so db went ahead and collected stats.
    You need to look up manual and try to understand the default and non-default behavior for parameters and then make an educated decision. Changing stats randomly is not generally a great idea.

  • Analyzing few table and customize output

    I have 20 sql scripts to analyze 20 tables, when one script done analyze i got out put and it say
    PL/SQL procedure successfully completed.
    there is any way i can modified this out to specific with each table name appeay with this output like
    PL/SQL procedure successfully completed on table_name.
    Thanks

    Are they all independent procedures? And are they materially different for each table? You might benefit by dynamically generating the anaylze commands and selecting the names from the data dictionary.
    I posted some sample code last week on this at
    Re: CBO v/s RBO advice needed

  • Oracle DTP plug-in running analyze when table is exploded in schema browser

    When I click on the + next to a table name in this plug-in, this plug-in is submitting an analyze table {table_name} compute statistics;
    I have verified this by monitoring the Oracle session I am connected to.
    We CANNOT release this product to our developers, since simply opening up a table defintition to view it's columns indexes, etc. on a large table (and we have tables in the 100's of GB range) will hammer our databases, not to mention the fact that it may run for who knows how long.
    For the life of me, I cannot imagine why it is doing this, especially since statistics are already available in the database.
    Has anyone else experienced this behavior?

    Thanks Robert,
    Thanks for ur reply.
    Yes this has been understood that this is due to the browser's pluginn shortage.
    But ist is not specifing the specific plugin requred.
    I tried the same with netscape .
    It specifies to the '' application/x-java-applet;jpi-version=1.4.2_06 ''
    Now tell me where to and how to get that plugin
    Thanks..........

  • Hyperion Analyzer Repository Tables

    I am creating a cross-reference report that shows me the access privileges assigned to each report in Hyperion Analyzer. I found that the information resides in the HsDsAttributes and HsDsACL SQL Server repository tables but I have no metadata for these tables. Does anyone know what the values in the columns for these tables are defined as? Specifically the class, type, and intval columns in the HsDsAttributes table.
    Thanks.

    Hi John,
    Thanks for sharing the pdf related to the HSP tables.
    When a FORM is submitted in planning application and the Final submission status= "Pick Yes/No" should be stored in the HSP table. As per the pdf which you have provided for the planning tables- Looks like the HYP_PLANAPP3.HSP_JOB_STATUS and HYP_PLANAPP3.HSP_AUDIT_RECORDS should have this information.
    example if the Form is saved for final submission status = Yes, this value should be stored some where in the HSP table, and my guess is under HYP_PLANAPP3.HSP_JOB_STATUS and column RUN_STATUS with values like 0 or 1. Please correct me If I am wrong.
    Sorry I might not be using the correct Hyperion terms.
    Thanks,
    Sikandar

  • What will happened when analyze a table

    Hi all,
    Can any one explain ,when analyze objects what will happend internally.
    Thanks in advance,
    Abk

    Abk wrote:
    Jonathan Lewis wrote:
    Which version of the analyze command did you have in mind ?
    If it's the "gather statistics" option then you probably shouldn't be using it and probably don't need to know.Database Version Oracle 9.2 and 10.2
    Analyze table SCOTT.EMPLOYEES extimate statistics;
    EXEC DBMS_STATS.gather_table_stats('SCOTT', 'EMPLOYEES');For 9.2 and 10.2 you should be using the dbms_stats package to collect statistics. It's what the optimizer is expecting, and since the numbers collected by analyze and dbms_stats are not consistent with each other it's what you should use (unless specifically directed otherwise by an application supplier).
    As far as "what happens when you use dbms_stats to gather statistics for a table" - one of the other posters has given you the overview, if you want specific details than check the PL/SQL supplied procedures manual, and the Performance Tuning guides. The precise actions vary between versions: here's a warning note about some of the differences: http://jonathanlewis.wordpress.com/2007/02/02/10g-upgrade/
    Regards
    Jonathan Lewis

  • AVG_ROW_LEN not update , even I analyze the table in compute statistics

    I execute DBMS_STATS.GATHER_SCHEMA_STATS on my old table , but the statistics doesn't update the row length.
    After that , I give up the gather_schema_stats stored proc and use sql statement -> ANALYZE TABLE COMPUTE STATISTICS.
    The statistics still is stale .
    Is there anything I have missed ?

    San KTN wrote:
    Hi Banka,
    I suggest you to perform followings :-
    1. Delete the table statistics first.
    2. Create another table as select from this target table , in same schema and same tablespace.
    3. exec dbms_stat.gather_table_stats with METHOD_OPT parameter value as
    FOR ALL INDEXED COLUMNS SIZE n ( n is any number )
    or FOR COLUMNS (Column list ... even if all columns in the list)
    or NULL
    on new and old table respectively.
    4. Compare the results.
    You better paste the results here for investigation.It's strange. The new table could be updated. AVG_ROW_LEN and AVG_COL_LEN both make change.
    The old table only partial be updated. AVG_COL_LEN is ok but not AVG_ROW_LEN.

  • Does improve performance to analyze all tables?

    Will the SELECT, INSERT, UPDATE and DELETE commands work faster if I analyze the main tables every month?

    It's unlikely that you will see month-on-month improvement. Once the tables get to a certain size the stats son't really get stale (if you add 10,000 records a month to a table with 10,000,000 rows, there's not really a lot of difference).
    So the advice is to gather stats for your tables once. Then use the monitoring option for tables that you think may be volatile and refresh their stats if they have grown stale. Note that in 10g the monintoring option has been deprecated because DBMS_STATS now supports the option to explicitly refresh stale statistics.
    Cheers, APC

  • IOT tables ..Analyze

    I see that Oracle Index Organized Tables are not getting analyzed by itself. Is this expected? Do i need to analyze this table manually ?
    We are using 10.1.0.5
    Thanks

    Look at the dbms_iot built-in package
    http://www.psoug.org/reference/dbms_iot.html

  • Analyzing Table

    The table has millions of records and my Oracle db is 8.1.6 . I need to analyze this table , when can i do analyze this big table. Actually my environment is offline env, after 6 Pm it would be shutdown .
    So please help me out when can i do analye that table and please send me the steps for doing analyzation.
    Thanks

    816:
    http://download.oracle.com/docs/cd/A81042_01/DOC/server.816/a76989/ch4d8.htm#30559
    If the database is down at 6pm, i'd do it before 6pm. Like right after it comes up.
    Why do you feel you need to analyze the table? What optimizer mode are you running?

  • Analyze table

    Dear all,
    What are the advantages if we do
    analyze table <table name> compute statisticsWhen ever i run this it is computing huge CPU utilization and taking long time........
    if we do this as far as i know
    1)it will analyze the table and count number of rows in a table properly.......
    Is there any advantage for INDEX if we do this operation.
    Regards,
    Vamsi

    Hey,
    Actually this command is old. I think it is 9i and below; It is still there for backwards compatibility.
    Since you are computing the statitics, oracle is going over all the records to get the stats. You can do estimate statics instead.
    OR, even better, you can use the new DBMS_Stats Package:
    EXEC DBMS_STATS.GATHER_TABLE_STATS (ownname=>'SCHEMA_NAME', tabname => 'TABLE_NAME', estimate_percent=>dbms_stats.auto_sample_size, degree=>2);
    This uses DBMS stats package, to estimate the statistics via a sample size automatically set through oracle.
    You can also use a similar command to estimate the stats of the whole schema
    EXEC DBMS_STATS.GATHER_SCHEMA_STATS (ownname=> 'SCHEMA_NAME', estimate_percent=>dbms_stats.auto_sample_size, degree=>2);
    From previous experience, creating an index is not enough, you have to gather the stats on the related table, so that the execution plan gets optimized.
    This command get table stats, histogram, uniqueness.. etc

  • Query takes very long time and analyze table hangs

    Hi
    One of the oracle query taking very long time (ie more than a day) and affecting business requirment of getting the report in time.
    I tried to analyze the table with compute statistics option, however it hangs/runs forever on one of the huge table?
    Please let me know how to troubleshoot this issue

    Hi,
    What's your Oracle version?
    You should use DBMS_STATS package not ANALYZE..
    Regards,

Maybe you are looking for

  • Java Plug-in problems following installation of Oracle 9i

    I have been experiencing repeatable problems with the Sun Java Plug-in following installation of Oracle 9i on our servers. Our installation of the Sun JDK 1.3.1_04 or higher seems to conflict with the Oracle installation. Following the install, navig

  • Way of allowing car stereo to control playlists

    I don't know if anyone else has figured this out but I thought I would post so others could enjoy. I got the ISIMPLE ipod interface for my honda civic and hooked it up to my new 80g ipod classic. It sounded great and the seek buttons advance to the n

  • About  table

    hi. this is Arijit.......... could anyone tell me !)what is the diifrence between Append & include structure???which is used to modify a standard table??which is better??? 2)how to delete a table when the table has some data?? bye i will reward by po

  • FreeMsg £2.50 weekly charges for texts recieved.

    I have received since march charges for £2.50 a week to recieve a text message as below; FreeMsg: UR subscribe to hot New Babes unlimited sexy videos for £3 per week. Helpline 08081349827 SP: Intrugo Ltd text STOP to 82999 to stop. I have no knowledg

  • BW Roles and profiles Tables

    I would like to download a list of all users and what roles and profiles each has.  I did it once before but now I can't remember the table names.  Can anyone help?