[20130328]dbms_stats.seed_col_usage的使用2.txt

[20130328]dbms_stats.seed_col_usage的使用2.txt

对昨天dbms_stats.seed_col_usage的使用做一些补充。

SQL> exec dbms_stats.reset_col_usage(NULL,NULL)
PL/SQL procedure successfully completed.

-- This procedure deletes the recorded column (group) usage information
-- from dictionary. Column (group) usage information is used by gather
-- procedures to automatically determine the columns that require histograms.
-- Also this information is used by create_extended_stats to create extensions
-- for the group of columns seen in the workload. So resetting column usage
-- will affect these functionalities. This procedure should be used only in very
-- rare cases where you need to start from scratch and need to seed
-- column usage all over again.

在做1次10046跟踪看看,这些信息记录在那个表。

alter session set events '10046 trace name context forever, level 12';
exec dbms_stats.seed_col_usage(null,null,100);
Select * from t1 where id2=3 and name='test';
Select * from t1 where id2=3 and name='test';
Select * from t1 where id2=3 and name='test';
select dbms_stats.report_col_usage(user,'t1') from dual ;
alter session set events '10046 trace name context off';


检查跟踪文件发现:
/* Formatted on 2013/03/28 15:14 (Formatter Plus v4.8.8) */
MERGE INTO SYS.col_group_usage$ d
   USING (SELECT :1 obj#, :2 cols
            FROM DUAL) s
   ON (d.obj# = s.obj# AND d.cols = s.cols)
   WHEN MATCHED THEN
      UPDATE
         SET d.TIMESTAMP = :3, d.flags = d.flags + :4 - BITAND (d.flags, :4)
   WHEN NOT MATCHED THEN
      INSERT (obj#, cols, TIMESTAMP, flags)
      VALUES (:1, :2, :3, :4)

看看文件内容:

SQL> column cols format a30
SQL> select * from SYS.col_group_usage$;
      OBJ# COLS                           TIMESTAMP                FLAGS
---------- ------------------------------ ------------------- ----------
    273081 2,3                            2013-03-28 15:12:12          1

SQL> select * from dba_objects where object_id=273081;
OWNER  OBJECT_NAME          SUBOBJECT_  OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE         CREATED             LAST_DDL_TIME       TIMESTAMP           STATUS  T G S  NAMESPACE EDITION_NAME
------ -------------------- ---------- ---------- -------------- ------------------- ------------------- ------------------- ------------------- ------- - - - ---------- ------------------------------
SCOTT  T1                                  273081         273081 TABLE               2013-03-27 17:12:13 2013-03-28 14:46:24 2013-03-28:14:46:24 VALID   N N N          1

--可以确定就是T1表的2,3字段。

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

转载于:http://blog.itpub.net/267265/viewspace-757320/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值