扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
create table col_usage$
(
obj# number, /* object number */
intcol# number, /* internal column number */
equality_preds number, /* equality predicates */
equijoin_preds number, /* equijoin predicates */
nonequijoin_preds number, /* nonequijoin predicates */
range_preds number, /* range predicates */
like_preds number, /* (not) like predicates */
null_preds number, /* (not) null predicates */
timestamp date /* timestamp of last time this row was changed */
)
storage (initial 200K next 100k maxextents unlimited pctincrease 0)
/
create unique index i_col_usage$ on col_usage$(obj#,intcol#)
storage (maxextents unlimited)
/
LOCK TABLE SYS.col_usage$ IN EXCLUSIVE MODE NOWAIT;在以下1小时采样的报告中,3条SQL执行了数千次:
UPDATE SYS.col_usage$
SET equality_preds = equality_preds + DECODE (BITAND (:flag, 1), 0, 0, 1),
equijoin_preds = equijoin_preds + DECODE (BITAND (:flag, 2), 0, 0, 1),
nonequijoin_preds =
nonequijoin_preds + DECODE (BITAND (:flag, 4),
0, 0,
1
),
range_preds = range_preds + DECODE (BITAND (:flag, 8), 0, 0, 1),
like_preds = like_preds + DECODE (BITAND (:flag, 16), 0, 0, 1),
null_preds = null_preds + DECODE (BITAND (:flag, 32), 0, 0, 1),
TIMESTAMP = :TIME
WHERE obj# = :objn AND intcol# = :coln;
INSERT INTO SYS.col_usage$
VALUES (:objn, :coln, DECODE (BITAND (:flag, 1), 0, 0, 1),
DECODE (BITAND (:flag, 2), 0, 0, 1),
DECODE (BITAND (:flag, 4), 0, 0, 1),
DECODE (BITAND (:flag, 8), 0, 0, 1),
DECODE (BITAND (:flag, 16), 0, 0, 1),
DECODE (BITAND (:flag, 32), 0, 0, 1), :TIME);
Parse Calls | Executions | % Total Parses | SQL Id | SQL Module | SQL Text |
---|---|---|---|---|---|
986 | 4,075 | 0.71 | 3c1kubcdjnppq | update sys.col_usage$ set eq... | |
986 | 69 | 0.71 | 53btfq0dt9bs9 | insert into sys.col_usage$ val... | |
986 | 986 | 0.71 | b2gnxm5z6r51n | lock table sys.col_usage$ in e... |
SELECT /*+ RULE */
c.NAME col_name, c.type# col_type, c.CHARSETFORM. col_csf,
c.default$ col_def, c.null$ col_null, c.property col_prop,
c.col# col_unum, c.intcol# col_inum, c.obj# col_obj, c.scale col_scale,
h.bucket_cnt h_bcnt, h.distcnt h_pndv, c.LENGTH col_len,
cu.TIMESTAMP cu_time, cu.equality_preds cu_ep,
cu.equijoin_preds cu_ejp, cu.range_preds cu_rp, cu.like_preds cu_lp
FROM SYS.user$ u,
SYS.obj$ o,
SYS.col$ c,
SYS.col_usage$ cu,
SYS.hist_head$ h
WHERE u.NAME = :b1
AND o.owner# = u.user#
AND o.type# = 2
AND o.NAME = :b2
AND o.obj# = c.obj#
AND c.obj# = cu.obj#(+)
AND c.intcol# = cu.intcol#(+)
AND c.obj# = h.obj#(+)
AND c.intcol# = h.intcol#(+);
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者