--收集直方图信息
exec dbms_stats.gather_table_stats('SCOTT','TEST',ESTIMATE_PERCENT=>100,METHOD_OPT=>'for columns size auto ID',cascade=>true);
--对所有索引列以自动收集的方式收集直方图信息
for all indexed columns size auto
--对表上的ID1、ID2列收集直方图信息
for columns size auto ID1 ID2
--对表上的ID1、ID2列收集直方图信息并指定bucket数量
for columns size 10 ID1 ID2
for columns ID1 size 10 ID2 size 5
--删除ID列直方图信息
for columns ID size 1
--删除所有列的直方图信息
for all columns size 1
--查看直方图信息
select table_name,column_name,num_distinct,density,num_buckets,histogram from dba_tab_col_statistics where table_name='TEST';
select table_name,column_name,endpoint_number,endpoint_value from dba_tab_histograms where table_name='TEST';
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29337971/viewspace-1853927/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29337971/viewspace-1853927/