收集对象统计信息【表、列、索引】
来源:互联网 发布:php众筹源码 编辑:程序博客网 时间:2024/05/21 21:46
一、建表
CREATE TABLE TABLE1( DATE_ORD DATE NOT NULL, SEQ_ORD NUMBER(6) NOT NULL, SMALL_VC VARCHAR2(5))PCTFREE 90PCTUSED 10;
二、创建索引
create index nonuni_index tablespace users;
三、收集并查看表的统计信息
分析表:
--方法一:analyze table TABLE1 compute statistics;//完全统计--方法二:analyze table TABLE1 estimate statistics sample 20 percent;//抽样统计--方法三:dbms_stats.gather_table_stats('SH','TABLE1');
查看表的统计信息:
select table_name,--表名 num_rows,--记录数 blocks,--数据块数 avg_row_len--平均行长from dba_tableswhere table_name = 'TABLE1';
四、收集并查看列的统计信息
分析表:
dbms_stats.gather_table_stats('SH',--用户名'TABLE1',--表名cascade =>true,--是否同时收集索引信息estimate_percent =>null,--抽样统计,null表示完全统计method_opt =>'for columns SEQ_ORD size 10');
查看列的统计信息:
select table_name ,--表名 column_name,--列名 num_distinct,--不同的列值个数 density,--列的选择率 num_nulls,--空列的个数 avg_col_len,--平均列长度 histogram--直方图from dba_tab_columnswhere table_name = 'TABLE1';
查看列的直方图:
select rownum ,--频率直方图号 begin_num,--开始 end_num,--结束 end_num-begin_num width,--宽度 round(100000/(end_num-begin_num),2)--高度from( select endpoint_value end_num, lag(endpoint_value,1)over(order by endpoint_number) begin_num from dba_tab_histograms where table_name ='TABLE1' and column_name ='SEQ_ORD')where end_num is not nullorder by begin_num nulls first;
五、查看索引的统计信息
分析索引:
--方法一:analyze index nonuni_index compute statistics;//完全统计--方法二:analyze index nonuni_index estimate statistics sample 20 percent;//抽样统计--方法三:dbms_stats.gather_index_stats('SH','NONUNI_INDEX');
查看索引的统计信息:
select index_name,--索引名 blevel,--索引的层数 leaf_blocks,--叶节点数 distinct_keys,--不同键值的数量 avg_leaf_blocks_per_key,--每个键值的平均叶块数 avg_data_blocks_per_key,--每个键值的平均数据块数 clustering_factor,--聚簇因子 num_rows--索引的记录数from dba_indexeswhere index_name = 'NONUNI_INDEX';
- 收集对象统计信息【表、列、索引】
- Oracle收集表与列统计信息
- Oracle收集索引统计信息
- Oracle 收集对象统计信息
- postgresql 定时收集表和索引统计信息
- oracle表不走索引,收集一下表的统计信息
- 查询统计信息sql(表、索引、列-histogram)
- Oracle11g 多列收集统计信息--直方图
- Oracle11G多列收集统计信息实验
- 收集统计信息导致索引被监控
- Oracle收集统计信息和重建索引
- 单表收集统计信息
- 如何收集及删除列的统计信息
- 数据库性能优化、统计信息与对象统计信息概述收集、扩展统计信息、dbms_stats.get_prefs
- oracle 收集统计信息(除去备份表)
- oracle收集表的统计信息
- oracle统计信息收集
- oracle统计信息收集
- ListView 和 Adapter 的基础
- block学习
- 上路
- equance]伸展树Splay & 平衡树SBT(下)
- grunt 上手
- 收集对象统计信息【表、列、索引】
- 【er图】某项目的er图
- 密码强度检测
- 基于opencv人脸检测原理及实现
- 博弈题目总结
- severlet与jsp
- 生活再幸福网名没你也是空
- RTP H264 NAL
- C/C++中near和far的区别