Oracle之segmenthi高水平相关情况讨论??

来源:互联网 发布:数据库如何打开mdf文件 编辑:程序博客网 时间:2024/06/08 19:14
--构造表
drop table t purge;
create table t as select * from dba_objects;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
commit;


exec dbms_stats.gather_table_stats(ownname => 'SCOTT',tabname => 'T',estimate_percent => 10,method_opt=> 'for all indexed columns',cascade=>TRUE) ;  


select num_rows,blocks from user_tab_statistics where table_name='T';


 NUM_ROWS     BLOCKS  --行数 --对象使用块的数量
--------- ----------
  2320250      33583


set autotrace off
delete from t where rownum<=2300000;
commit;
exec dbms_stats.gather_table_stats(ownname => 'SCOTT',tabname => 'T',estimate_percent => 10,method_opt=> 'for all indexed columns',cascade=>TRUE) ;  


select num_rows,blocks from user_tab_statistics where table_name='T';


  NUM_ROWS     BLOCKS
---------- ----------
     32480      33583

     


扩展知识:

ALL_TAB_STATISTICS

ALL_TAB_STATISTICS displays optimizer statistics for the tables accessible to the current user.

--显示当前用户可访问的表的优化器统计信息。

Related Views

  • DBA_TAB_STATISTICS displays optimizer statistics for all tables in the database.

  • 显示数据库中所有表的优化器统计信息。

  • USER_TAB_STATISTICS displays optimizer statistics for the tables owned by the current user. This view does not display the OWNER column.

  • 显示当前用户拥有的表的优化器统计信息。此视图不显示所有者列。

https://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2102.htm#REFRN20376

原创粉丝点击