一、建表
CREATE TABLE TABLE1
(
DATE_ORD DATE NOT NULL,
SEQ_ORD NUMBER(6) NOT NULL,
SMALL_VC VARCHAR2(5)
)
PCTFREE 90
PCTUSED 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_tables
where table_name = 'TABLE1';
四、收集并查看列的统计信息
分析表:
dbms_stats.gather_table_stats(
'SH',--用户名
'TABLE1',--表名
cascade =>true,--是否同时收集索引信息
estimate_percent =>null,--抽样统计,null表示完全统计
method_opt =>'f