暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
Analyze-table表分析
1310
9页
7次
2020-05-27
5墨值下载
Analyze table
做了什么工作?表如何降低
HWM
(High Water Mark)?

只影响

的统计数据

不影响

占用空间等
参数。

会分析
 !"#!$%&

'()**'+

用来收集统计信息,作为
'(
优化器的依据。数据发生大的变化后不重新
收集会导致
'(
判断错误,会出现性能问题。
,
--
降低
.
只有
/
可以缩减表,
01
不支持。
(2(3+
415)'+
&('56)('57&('5
8
$
不能降低
.
即使表数据被全部
9
,也不会降低全表扫描的时间,
表也不会释放占用空间 。
'
则把
.
降到最初始值
占用
:;
('5&
('57/
实验开始:
Create table t nologging as select * from dba_objects;
Table created;
fkz@ORCL>select count(*) from t;
COUNT(*)
----------
73188
create table t$user_tables nologging as select * from user_tables where table_name ='T';
Table created;
select table_name,blocks,num_rows,avg_row_len,last_analyzed,empty_blocks,avg_space
from t$user_tables;
TABLE_NA
ME
BLOCK
S
NUM_ROW
S
AVG_ROW_LE
N
LAST_ANALYZ
ED
EMPTY_BLOC
KS
AVG_SPAC
E
T 1068 73188 97 2010/11/14
12:46:16
0 0
fkz@ORCL>delete from t where rownum<=3188;
已删除
3188
行。
fkz@ORCL>commit;
提交完成。
fkz@ORCL>select count(*) from t;
COUNT(*)
----------
70000
--
,

fkz@ORCL>analyze table t compute statistics;
表已分析。
--
存储第二次

的结果。
fkz@ORCL>insert into t$user_tables select * from user_tables where table_name ='T';
已创建
1
行。
fkz@ORCL>commit;
提交完成。
--
查询第 二 次分析的结果

select
table_name,blocks,num_rows,avg_row_len,last_analyzed,empty_blocks,avg_space
from t$user_tables
order by last_analyzed desc

;
TABLE_NA
ME
BLOCK
S
NUM_ROW
S
AVG_ROW_LE
N
LAST_ANALYZ
ED
EMPTY_BLOC
KS
AVG_SPAC
E
T 1068 70000 101 2010/11/15
20:34:48
84 1137
of 9
5墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜