常用统计信息收集语句

收集表统计信息
analyze table t_vital_signs compute statistics for table;
收集索引统计信息
analyze index INDEX_T_VITAL_SIGNS_TIME compute statistics;


一次性以计算模式收集表T2、表T2的所有列和表T2上的所有索引的统计信息:
analyze table t_vital_signs compute statistics;


只对表T2收集统计信息,并且是以计算模式收集
exec dbms_stats.gather_table_stats(ownname=>'emr',tabname=>'t_vital_signs',estimate_percent=>100,method_opt=>'FOR TABLE',cascade=>false);


如下命令可以以计算模式收集索引的统计信息
exec dbms_stats.gather_index_stats(ownname=>'emr',indname=>'INDEX_T_VITAL_SIGNS4',estimate_percent=>100);


如果想一次性以计算模式收集表T2、表T2的所有列及表T2的所有索引的统计信息:
exec dbms_stats.gather_table_stats(ownname=>'emr',tabname=>'t_vital_signs',estimate_percent=>100,cascade=>true);
请使用浏览器的分享功能分享到微信等