0% found this document useful (0 votes)
44 views

Dbms Stats

DBMS_STATS is an Oracle package for collecting statistics that is recommended over traditional ANALYZE. It collects statistics in parallel, for partitioned objects, and allows fine-tuning. It contains over 40 procedures for deleting, setting, exporting, importing, gathering statistics for schemas and databases, and monitoring tables. The traditional ANALYZE method is obsolete and can hurt performance, while DBMS_STATS provides better estimates and faster execution plans. Statistics are gathered using DBMS_STATS procedures to view, modify, export, import, delete, and gather statistics for tables, indexes, columns, and partitions.

Uploaded by

fowjil
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Dbms Stats

DBMS_STATS is an Oracle package for collecting statistics that is recommended over traditional ANALYZE. It collects statistics in parallel, for partitioned objects, and allows fine-tuning. It contains over 40 procedures for deleting, setting, exporting, importing, gathering statistics for schemas and databases, and monitoring tables. The traditional ANALYZE method is obsolete and can hurt performance, while DBMS_STATS provides better estimates and faster execution plans. Statistics are gathered using DBMS_STATS procedures to view, modify, export, import, delete, and gather statistics for tables, indexes, columns, and partitions.

Uploaded by

fowjil
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

DBMS_STATS

Mohamed Fowjil
DBMS_STATS
• Oracle Corporation strongly recommends to use the
DBMS_STATS package rather than ANALYZE for most
statistics collection.
• That package 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
DBMS_STATS
Procedures
• The DBMS_STATS package contains over 40 procedures.
These include procedures to: delete existing statistics for a
table, schema, or database; set statistics to desired values;
export and import statistics; gather statistics for a schema or
entire database; and monitor tables for changes.
• The old fashioned “analyze table” and dbms_utility methods
for generating CBO statistics are obsolete and somewhat
dangerous to SQL performance.
• This is because the cost-based SQL Optimizer (CBO) relies on
the quality of the statistics to choose the best execution plan
for all SQL statements.
• The dbms_stats utility does a far better job in estimating
statistics, especially for large partitioned tables, and the better
stats results in faster SQL execution plans.
Gathering Statistics with
DBMS_STATS Procedures
• Statistics are gathered using the DBMS_STATS package. This
PL/SQL package is also used to modify, view, export, import, and
delete statistics.
• The DBMS_STATS package can gather statistics on table and
indexes, and well as individual columns and partitions of tables.
• The DBMS_STATS package can gather statistics on table and
indexes, and well as individual columns and partitions of tables.
• When statistics are updated for a database object, Oracle
invalidates any currently parsed SQL statements that access the
object. The next time such a statement executes, the statement is
re-parsed and the optimizer automatically chooses a new
execution plan based on the new statistics.
• Oracle Corporation recommend setting the
ESTIMATE_PERCENT parameter of the gathering procedures
to DBMS_STATS.AUTO_SAMPLE_SIZE. This will
maximize performance gains while achieving good statistical
accuracy.

You might also like