Chinaunix首页 | 论坛 | 博客
  • 博客访问: 981184
  • 博文数量: 358
  • 博客积分: 8185
  • 博客等级: 中将
  • 技术积分: 3751
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:27
个人简介

The views and opinions expressed all for my own,only for study and test, not reflect the views of Any Company and its affiliates.

文章分类

全部博文(358)

文章存档

2012年(8)

2011年(18)

2010年(50)

2009年(218)

2008年(64)

我的朋友

分类: Oracle

2009-03-12 12:23:38

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
PL/SQL Release 9.2.0.4.0 - Production
CORE    9.2.0.3.0       Production
TNS for Solaris: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production

SQL> create table t_test3 as select * from dba_tables;

Table created.

SQL> analyze table t_test3 compute statistics;

Table analyzed.

SQL> select avg_row_len,num_rows,blocks from user_tables where table_name = 'T_TEST3';

AVG_ROW_LEN   NUM_ROWS     BLOCKS
----------- ---------- ----------
        188       5502        146

SQL> analyze table t_test3 delete statistics;

Table analyzed.

SQL> exec dbms_stats.gather_table_stats(user,'T_TEST3');

PL/SQL procedure successfully completed.

SQL> select avg_row_len,num_rows,blocks from user_tables where table_name = 'T_TEST3';

AVG_ROW_LEN   NUM_ROWS     BLOCKS
----------- ---------- ----------
        183       5502        146

SQL>

默认dbms_stats.gather_table_stats分析表得到平均行长貌视少一些。

SQL> create table t_test4 as select * from t_test3;

Table created.

SQL> exec dbms_stats.gather_table_stats(user,'T_TEST4',estimate_percent=>100);

PL/SQL procedure successfully completed.

SQL> select avg_row_len,num_rows,blocks from user_tables where table_name = 'T_TEST4';

AVG_ROW_LEN   NUM_ROWS     BLOCKS
----------- ---------- ----------
        183       5502        146

SQL>

dbms_stats.gather_table_stats的输入参数estimate_percent为100(即100%评估),分析表得到平均行长就是准确了。

--End--

阅读(913) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~