If database was created using DBCA, an automatic statistics gathering procedure should be already set up. It can be observed under the Scheduler jobs. You need to be logged in as "sys as sysdba" to see it.
To gather statistics manually you can use the ANALYZE SQL command, or DBMS_STATS package. You can also use EM, but that's just an interface for the DBMS_STATS.
When gathering statistics you can use the COMPUTE or ESTIMATE option. COMPUTE will gather fill stats when ESTIMATE will only take a representative sample of the rows in the table thus performing faster but not guaranteeing maximum correctness like COMPUTE does.
Gathering stats using the DBMS_STATS
Summary of DBMS_STATS subprograms
Most frequently needed are:
GATHER_DATABASE_STATS
GATHER_FIXED_OBJECTS_STATS
GATHER_INDEX_STATS
GATHER_SCHEMA_STATS
GATHER_TABLE_STATS
There is also a "DELETE_%" procedure corresponding to each "GATHER_%' procedure.
It is also possible to EXPORT and IMPORT statistics. You could have several different sets of statistics for different purposes.
Tuesday, June 5, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment