I am using DBMS_STATS.GATHER_TABLE_STATS () function to analyze tables. Currently i am executing these once new data is loaded. I wanted to know when these user defined statistics expire? After how much time i need to run DBMS_STATS.GATHER_TABLE_STATS () command on my tables?
Regards, Vijay Jamadade.
( Nothing is Impossible.)
The statistics never expire. They may become stale (inaccurate) due to modifications that happen to the table after the statistics were gathered. So if your table doesn't ever change after loading data, you don't need to update its statistics at all. If it changes a lot, you may need to update statistics quite often.
There is an automatic mode for gathering statistics from Oracle 10g onward (or so), it gathers the stats when more than some fraction (10%, I believe) of table rows change.
I'd suggest reading Oracle documentation on statistics, you might start here (if you're not on 11g, find documentation for the version you're using).