Use the METHOD_OPT directive in DBMS_STATS.GATHER_TABLE_STATS to collect histograms for column ARTICLE_NAME in table SALES_Q1_RESULTS. In this example, 6 buckets are defined.
Check the view DBA_TAB_COLUMNS to confirm whether or not there are histograms collected on the column:
SELECT NUM_DISTINCT,DENSITY,NUM_NULLS,NUM_BUCKETS,HISTOGRAM FROM DBA_TAB_COLUMNS WHERE TABLE_NAME = 'SALES_Q1_RESULTS' AND COLUMN_NAME = 'ARTICLE_NAME';
NUM_DISTINCT | DENSITY | NUM_NULLS | NUM_BUCKETS | HISTOGRAM |
---|---|---|---|---|
0 | 0 | 0 | 0 | NONE |
BEGIN DBMS_STATS.GATHER_TABLE_STATS (OWNNAME => 'SH', TABNAME => 'SALES_Q1_RESULTS', METHOD_OPT => 'FOR COLUMNS SIZE 6 ARTICLE_NAME'); END; /
SELECT NUM_DISTINCT,DENSITY,NUM_NULLS,NUM_BUCKETS,HISTOGRAM FROM DBA_TAB_COLUMNS WHERE TABLE_NAME = 'SALES_Q1_RESULTS' AND COLUMN_NAME = 'ARTICLE_NAME';
NUM_DISTINCT | DENSITY | NUM_NULLS | NUM_BUCKETS | HISTOGRAM |
---|---|---|---|---|
7 | 0.166666666666667 | 0 | 6 | HEIGHT BALANCED |
Read more in Oracles Documentation
No comments:
Post a Comment