select * from dba_tables where owner = 'user' and table_name='G_AR_METER';
由於我的數據庫表的num_rows 統計分析的是7250,但是實際只有2450行數據。
加上where條件count非常慢,但是不加where條件還算是hi正常。
執行下面腳本以後完美解決。
執行之前數據1600萬數據,用索引 count部分數據,需要70-80秒才能返回結果
EXEC dbms_stats.gather_table_stats('user','G_AR_METER',cascade=>true);
EXEC dbms_stats.gather_schema_stats('user',estimate_percent=>100,cascade=> TRUE);
執行完成以後數據1600萬數據,用索引 count部分數據,3-4秒能返回結果
暫時不確定爲什麼需要這樣執行