EXEC dbms_stats.gather_schema_stats Manual optimization statistics

Source: Internet
Author: User

oracle10g or later.
exec dbms_stats.gather_schema_stats (ownname = ' dfms ', options = ' Gather AUTO ',
estimate_percent = Dbms_stats.auto_sample_size,----11g sampling value is large, you can use samplesize,10g as if 5~20%, can be adjusted as needed
Method_opt = ' For all columns size auto ',--usually the first time it is collected, use ' for all columns size 1 ' to remove the histogram on all columns, and then use size auto to gradually adjust Stable recommended ' For all columns size repeat '
Cascade=>true,
degree = 8);


Collecting histogram information is resource-intensive, so skewonly is not recommended for use. In fact, after so many versions, Skewonly's algorithm has been very strange, and I didn't find a document describing how Oracle defines SKEWONLY's collection credentials.
Method_opt=> ' for columns size auto [column_name] '
What is Auto? Take a look at the definitions in Oracle's official documentation.
Oracle determines the columns to collect histograms based on data distribution and the workload of the columns.
That is, on the basis of skewonly added workload limit, what is workload? is actually what we mentioned earlier whether it appears in the Where condition. If a column never appears in the Where condition, Oracle considers it to be workload, so even if the data on this column is considered skew, the histogram information will not be collected, and only if it has occurred at least once, Oracle will collect it. [via Comment by Dbsnake] This workload information can be obtained from the data dictionary col_usage$, the columns that exist in the data dictionary are workload.

So auto is also problematic, and the histogram information on the N2 field will still be collected, which we don't need. Note that in the automatic Statistics collection task after oracle10g, the default is for all COLUMNS SIZE auto, which is problematic, so even if the automatic statistics collection is not disabled, it should be through dbms_stats. The Set_param stored procedure (replaced by the set_global_prefs stored procedure in the 11GR2 version) modifies the default value. Often the execution plan that we go through is inexplicably changed, and many occasions are caused by the automatic collection of statistics after oracle10g. For automatic statistical information collection, see: Automatic Statistics Gathering
Method_opt=> ' for columns size repeat [column_name] '
The histogram information is collected again only on columns that already have histogram information. This is how we recommend setting the default value.

Exec dbms_stats.gather_schema_stats Manual optimization statistics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.