[bbk2340] 第45集 - Chapter 09-Optimizing Sore Perations(00)

Ojbectives

After completing this lesson,you should be able to do the following

Understanding Statistics

管理statistic的package:dbms_stats.

Managing Statistics

 

Use the dbms_stats packages:

  • gather_table_stats
  • gather_index_stats
  • gather_schema_stats
  • gahter_database_stats
  • gather_stable_stats
创建表、插入数据
SQL> create table t(id int,name char(10));

Table created.

SQL> insert into t values(0,'arcerzhang');

1 row created.

SQL> insert into t values(1,'arcerzhang');

1 row created.

SQL> insert into t values(2,'arcerzhang');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from t;

        ID NAME
---------- ----------
         0 arcerzhang
         1 arcerzhang
         2 arcerzhang
分析之前查询数据字典DBA_TABLES
SQL> select num_rows,blocks from dba_tables where owner='HR' and table_name='T';

NUM_ROWS BLOCKS
---------- ----------
分析表
SQL> exec dbms_stats.gather_table_stats('HR','T');

PL/SQL procedure successfully completed.
分析之后查询数据字典DBA_TABLES
SQL> select num_rows,blocks from dba_tables where owner='HR' and table_name='T';

  NUM_ROWS     BLOCKS
---------- ----------
         3          5

 

分析完成后,将分析结果存放在数据字典里面的;上述图表列出了Tables、Columns、Indexes对应的信息(分析完成数据之后,各自存放在数据字典表中的位置). 

注意:上述信息,是10g以后才有的,之前的版本是没有这些数据的.

When to Gather Statistics 

 

 

 

 

 

 

 

转载于:https://www.cnblogs.com/arcer/archive/2013/05/07/3064549.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值