有时在做执行计划时,使用dbms_stats.gather_table_stats后反而不准。(以oracle 11g r2为例)
是因为我们有时需要这样写便可以解决
dbms_stats.gather_table_stats(user,'t',method_opt=>'for all indexed columns',cascade=>true)
需要加入method_opt=>'for all indexed columns'这个参数,默认值是FOR ALL COLUMNS SIZE AUTO
这样之后就准了