query performance with the most updated statistics is far worse than without any statistics
I have a query performance issue which I believe is related to statistics collection.
There are 3 tables in the query and one of the table is 30GB. The other 2 tables are small.
When there is no statistics in the large table, the query takes about 6 minutes to complete.
After gathering the statistics, the query takes 15 HOURS to complete.
The sympton can be reproduced at will.
Why a 100% accurate statistics would result in a far worse performance?
What could have gone wrong?
Here is the way I collect the statistics:
(The query does not use bind variables.)
begin
dbms_stats.gather_table_stats(