File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Oracle/OAS and the fly likes need information about DBMS_STATS.GATHER_TABLE_STATS () Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "need information about DBMS_STATS.GATHER_TABLE_STATS ()" Watch "need information about DBMS_STATS.GATHER_TABLE_STATS ()" New topic

need information about DBMS_STATS.GATHER_TABLE_STATS ()

vijay jamadade
Ranch Hand

Joined: May 12, 2008
Posts: 241
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.)
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3733

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).
vijay jamadade
Ranch Hand

Joined: May 12, 2008
Posts: 241
Got it. Many Thanks Martin.

I agree. Here's the link:
subject: need information about DBMS_STATS.GATHER_TABLE_STATS ()
It's not a secret anymore!