ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle dbms_stats与user_tables记录数区别与统计收集小例

oracle dbms_stats与user_tables记录数区别与统计收集小例

原创 Linux操作系统 作者:wisdomone1 时间:2012-09-23 10:42:17 0 删除 编辑
1,建表
        create table t_more_col(col1 int,col2 int,col3 int,col4 int,col5 int,col6 int,
                                                     col7 i  nt,col8 int,col9 int, col10 int);
2,查表
        select * from user_tables where table_name=upper('t_more_col')
3,插表
        declare
       type typ_tab_col1 is table of pls_integer index by pls_integer;
       typ_tab_col1_1 typ_tab_col1;
         
       begin
        for i in 1..1000000 loop
            typ_tab_col1_1(i):=i;
        end loop;
        
        forall i in 1..1000000
          insert into t_more_col                                 values(typ_tab_col1_1(i),null,null,null,null,null,null,null,null,null);
       commit;
       end;
4,--分析表 
exec dbms_stats.gather_table_stats('SCOTT','T_MORE_COL');

5,查表的记录数
select count(*) from t_more_col

6,多次运行统计语句,我作了个表格
  
6,小结
--为何表的记录数与分析表的记录数不一致呢,再分析下表,看下
--小结:1,分析表每次的结果稍有不同,所以说oracle每次分析是基于什么呢,
   --  2,每次分析表到底分析多大比例呢,收集到的数据比较准确呢
   --  3,所以每次表收集要注意些什么呢









QQ截图20120923110452.gif

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-744852/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12690141