[转] Oracle analyze 命令分析
转自:http://blog.sina.com.cn/s/blog_682841ba0101bncp.html
1.analyze table t1 compute statistics for table; -->user_tables
(只对表的总体信息进行统计,比如行数多少等,不涉及到表字段)
2.analyze table t2 compute statistics for all columns; -->user_tab_columns
(只会收集表字段信息)
3.analyze table t3 compute statistics for all indexed columns; -->user_tab_columns
(只会收集表中索引所在的字段信息)
4.analyze table t4 compute statistics for all indexes;à user_indexes
(只收集表索引的信息)
5.analyze table t5 compute statistics;
(收集表,表字段,索引的信息)
另外,可以删除分析数据:
SQL> analyze table my_table delete statistics;
SQL> analyze table my_table delete statistics for table for all indexes for all indexed columns;
例子:
create table t1 as select * from user_objects;
create table t2 as select * from user_objects;
create table t3 as select * from user_objects;
create table t4 as select * from user_objects;
create table t5 as select * from user_objects;
create table t6 as select * from user_objects;
create unique index pk_t1_idx on t1(object_id);
create unique index pk_t2_idx on t2(object_id);
create unique index pk_t3_idx on t3(object_id);
create unique index pk_t4_idx on t4(object_id);
create unique index pk_t5_idx on t5(object_id);
create unique index pk_t6_idx on t6(object_id);
<</B>刚建完表的时候>
(1) 查看表的统计信息
select table_name, num_rows, blocks, empty_blocks
from user_tables
where table_name in ('T1', 'T2', 'T3', 'T4', 'T5','T6');
(2) 查看字段的统计信息
select table_name,
column_name,
num_distinct,
low_value,
high_value,
density
from user_tab_columns
where table_name in ('T1', 'T2', 'T3', 'T4','T5','T6');
(3) 查看索引的统计信息
select table_name,
index_name,
blevel,
leaf_blocks,
distinct_keys,
avg_leaf_blocks_per_key avg_leaf_blocks,
avg_data_blocks_per_key avg_data_blocks,
clustering_factor,
num_rows
from user_indexes
where table_name in ('T1', 'T2', 'T3', 'T4', 'T5', 'T6');
二.执行analyze命令
analyze table t1 compute statistics for table; --针对表收集信息
analyze table t2 compute statistics for all columns; --针对表字段收集信息
analyze table t3 compute statistics for all indexes columns; --收集索引字段信息
analyze table t4 compute statistics; --收集表,表字段,索引信息
analyze table t5 compute statistics for all indexes; --收集索引信息
analyze table t6 compute statistics for table for all indexes for all columns; --收集表,索引,表字段信息
(1) 表的统计信息
select table_name, num_rows, blocks, empty_blocks
from user_tables
where table_name in ('T1', 'T2', 'T3', 'T4', 'T5','T6');
(2) 表中字段的统计信息
select table_name,
column_name,
num_distinct,
low_value,
high_value,
density
from user_tab_columns
where table_name in ('T1', 'T2', 'T3', 'T4','T5','T6');
<</B>其中会收集T2的表字段信息,T3是索引所在字段信息,T4表字段信息,T6表字段信息>
(3) 索引的统计信息
没有变化,说明在创建索引的时候就ORACLE就已经收集相关信息
[转] Oracle analyze 命令分析的更多相关文章
- Oracle Analyze 命令 详解
官网的链接如下: http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_4005.htm#SQLRF01105 使用DBMS ...
- [转] Oracle analyze table 使用总结
转自:http://www.cnblogs.com/einyboy/archive/2012/08/09/2630321.html analyze table 一般可以指定分析: 表,所有字段,所有索 ...
- 对于Oracle analyze table的使用总结 . 对于Oracle analyze table的使用总结 .
对于Oracle analyze table的使用总结 . 对于Oracle analyze table的使用总结 . analyze table 一般可以指定分析: 表,所有字段,所有索引字段,所有 ...
- [ SHELL编程 ] 编程常用的ORACLE相关命令
本文主要描述shell编程中常用的Oracle相关命令. 1.sqlplus -L/-S参数 sqlplus -L user/password #-L参数表示用户只尝试登录一次, 而不是在出错时再次提 ...
- Oracle内存全面分析
Oracle内存全面分析 Oracle的内存配置与oracle性能息息相关.而且关于内存的错误(如4030.4031错误)都是十分令人头疼的问题.可以说,关于内存的配置,是最影响Oracle性能的配置 ...
- 使用analyze命令统计信息
① 搜集和删除索引.表和簇的统计信息② 验证表.索引和簇的结构③ 鉴定表和簇和行迁移和行链接针对analyze的搜集和删除统计信息功能而言Oracle推荐使用DBMS_STATS包来代替analyze ...
- ORACLE ANALYZE使用小结
ANALYZE的介绍 使用ANALYZE可以收集或删除对象的统计信息.验证对象的结构.标识表或cluster中的行迁移/行链接信息等.官方文档关于ANALYZE功能介绍如下: · ...
- PLSQL_性能优化系列16_Oracle Tuning Analyze优化分析
2014-12-23 Created By BaoXinjian
- oracle常用命令【转载】
oracle常用命令 一.Oracle数据库实例.用户.目录及session会话查看: 1.ORACLE SID查看设置 查看SID.用户名 $ env|grep SID .select * from ...
随机推荐
- ES(一): 架构及原理
Elasticsearch 是一个兼有搜索引擎和NoSQL数据库功能的开源系统,基于Java/Lucene构建,可以用于全文搜索,结构化搜索以及近实时分析.可以说Lucene是当今最先进,最高效的全功 ...
- 再次理解javascript中的事件
一.事件流的概念 + 事件流描述的是从页面中接收事件的顺序. 二.事件捕获和事件冒泡 + 事件冒泡接收事件的顺序:
- UVA 247 电话圈(Floyd传递闭包+输出连通分量)
电话圈 紫书P365 [题目链接]电话圈 [题目类型]Floyd传递闭包+输出连通分量 &题解: 原来floyd还可以这么用,再配合连通分量,简直牛逼. 我发现其实求联通分量也不难,就是for ...
- PHP下的命令行执行 php -S localhost -t public
PHP 的命令行模式 以下是 PHP 二进制文件(即 php.exe 程序)提供的命令行模式的选项参数,您随时可以通过 PHP -h 命令来查询这些参数. Usage: php [option ...
- WCF netTcp配置
服务端配置 <system.serviceModel> <bindings> <netTcpBinding> <binding name="netT ...
- mybatis配置优化
1.加入日志log4j 1)加入jar包:log4j-1.2.17.jar 2)加入log4j配置文件: 可以使properties或者xml形式 log4j.rootLogger = DEBUG,C ...
- Chap5: question 35 - 37
35. 第一个只出现一次的字符 char firtNotRepeat(char *s) { if(s == NULL) return 0; int i = 0; while(s[i] != '\0') ...
- Change the Windows 7 Taskbar Thumbnail and List Mode
Manually in Registry Editor 1. Open the Start Menu, then type regedit in the search boxand press Ent ...
- service对象
Service 对象 提供用于创建服务程序的一组工具 语法 Shell.Service[.property|method] 属性 Description 服务描述,仅限于 Windows 2000 及 ...
- mac 下 chrome 语言环境 设置
当然,如果把系统语言更改为英文,Chrome.QQ 等一系列软件会自动变成英文界面,而且没有提供切换语言的设置. 啪了下 Google,找到了方法,直接在终端运行后重启 Chrome 即可更改. 英文 ...