# 表的相关统计信息select table_name,num_rows,blocks,last_analyzed from user_tableswhere table_name in ('&table_name');# 索引的相关统计信息select table_name,index_name,blevel,num_rows,leaf_blocks,last_analyzed from user_indexeswhere table_name in ('&table_name');
数据库统计信息的收集
# 收集表统计信息exec dbms_stats.gather_table_stats(ownname=>'&owner',tabname=>'&table_name',estimate_percent=>10,method_opt=>'for all indexed columns');# 收集索引统计信息exec dbms_stats.gather_index_stats(ownname=>'&owner',indname=>'&index_name',estimate_percent=>'10',degree=>'4');# 收集表和索引统计信息exec dbms_stats.gather_table_stats(ownname=>'&owner',tabname=>'&table_name',estimate_percent=>10,method_opt=>'for all indexed columns',cascade=>TRUE);# 收集分区表指定分区统计信息exec dbms_stats.gather_table_stats(ownname=>'&owner',tabname=>'&table_name',partname='&partition_name',estimate_percent=>10,method_opt=>'for all indexed columns',cascade=>TRUE);
SELECT a.sjhmFROM bfcrm8.hyk_hyxx b, bfcrm8.hyk_grxx a, bfcrm8.hyxfjl c, bfcrm8.hyxfjl_sp dWHERE a.hyid =b.hyid AND a.hyid =c.hyid AND c.xfjlid =d.xfjlid AND b.hyktype IN ('101') AND b.status >=0 AND a.sex ='1' AND d.bmdm LIKE '010104%' AND TO_CHAR(sysdate,'YYYY') - TO_CHAR(a.csrq,'YYYY')>='20' AND TO_CHAR(sysdate,'YYYY') - TO_CHAR(a.csrq,'YYYY') <'41'GROUP BY a.sjhm