I always wondered, whast the difference between analyze and gather database statistics??? arent both used for performance tuning reasons too?
Printable View
I always wondered, whast the difference between analyze and gather database statistics??? arent both used for performance tuning reasons too?
DBMS_STATS is new introduced in 8i onwards and before that analyze command was used(gather_database statistics is one of the package for dbms_stats). Both are used for cost based optimizer to gather system statistics to optimize your queries. To answer your question, YES it is used for performance tuning purpose, but you can use it too to find information like no of blocks/rows/high water mark etc used by any system/user objects.
But
Abhay.Quote:
Note:
Oracle Corporation strongly recommends that you use the DBMS_STATS package rather than ANALYZE to collect optimizer statistics. That package lets you collect statistics in parallel, collect global statistics for partitioned objects, and fine-tune your statistics collection in other ways. Further, the cost-based optimizer will eventually use only statistics that have been collected by DBMS_STATS