首页 > 应用开发 > IT综合 > Histograms
10-bucket:
![]()
The default number of buckets for a histogram is 75. This value provides an appropriate level of detail for most data distributions.
ENDPOINT_NUMBER ENDPOINT_VALUE--------------- ---------------1365 4
1370 5
2124 8
2228 18
|
Bucket (values) |
|
Number of Values in Bucket |
|
1 (0 to 4) |
N/A |
N/A |
|
2 (4 to 5) |
1370 - 1365 |
5 |
|
3 (5 to 8) |
2124 - 1370 |
754 |
|
4 (8 to 18) |
2228 - 2124 |
104 |
Table 3-5 shows that the buckets hold very different numbers of values. The data is skewed: 754 values are between 5 and 8, but only 104 are between 8 and 18. More buckets should be used.
Analyze 里的语句对histogram更好的理解
• COMPUTE: This option calculates exact statistics. It performs a full table scan and several calculations. For large tables, this operation can take a considerable amount of time.
• ESTIMATE: You estimate statistics with this option. If you use this option with a suitable sample of the data, it is almost as reliable as the COMPUTE option.When you want to clear the collected statistics, you can use the DELETE option. You do not need to use DELETE option before reanalyzing an object, because existing statistics are overwritten.
The FOR Clause
The FOR clause offers the following options:
• FOR TABLE: Restricts the statistics collected to only table statistics rather than table and column statistics.
• FOR COLUMNS: Restricts the statistics collected to only column statistics for the specified columns, rather than for all columns and attributes.
• FOR ALL COLUMNS: collects column statistics for all columns.
• FOR ALL INDEXED COLUMNS: Collects column statistics for all indexed columns in the table.
• FOR ALL [LOCAL] INDEXES: Specifies that all indexes associated with the table will be analyzed. LOCAL specifies that all local index partitions are analyzed.
The SIZE Clause
The SIZE clause specifies the maximum number of histogram buckets. The default value is 75, and the maximum value is 254.

例子:
exec dbms_stats.gather_table_stats('e3','article',method_opt=>'FOR COLUMNS id');
对表aritcle进行分析,并分析id列。如果去掉后面的method_opt=>'FOR COLUMNS id',就会分析表和全部列。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14377/viewspace-1060105/ ,如需转载,请注明出处,否则将追究法律责任。