A reader, January 08, 2020 - 11:42 am UTC
actually that same gather STAT script is taking more time in Pre-Prod compare to Prod and working perfectly fine.
I read some article that remove STAT for index and then again gather STAT, do you think it will be useful?
can i use "DBMS_STATS.DELETE_INDEX_STATS" for that purpose?
January 08, 2020 - 2:06 pm UTC
First question:
Have you got any slow queries with "wrong" plans because these indexes haven't been analyzed recently?
If the answer is no, your action is easy. DO NOTHING!
Deleting stats means that there will be a period of time where the optimizer has no information about these indexes. Which is likely to lead to some... undesirable plans.
If gathering stats for an index enables the optimizer to find a better plan you're better off manual gathering for just that index with:
DBMS_STATS.GATHER_INDEX_STATS
But I repeat: it's only worth doing this if performance is worse than normal AND you think it's due to out-of-date stats. If performance is "good"/the same as usual, leave it as is!
A reader, January 14, 2020 - 1:17 pm UTC
Thank you very much for you clear response !!!