2. About Me
• Technical Director @ Enmo Tech
• ACOUG Co-founder, President
• Interests:
– My wife and my son
– Database technology (all related)
– World of Warcraft (online game)
• http://www.enmotech.com
• http://www.acoug.org
• http://www.dbform.com
云和恩墨 成就所托
4. What is Histogram
12
10
8
Value 1
Value 2
6
Value 3
4 Value 4
Value 5
2
0
Column 1 Column 2 Column 3 Column 4
云和恩墨 成就所托
5. What is Histogram
• frequency
800
700
700
600
500
500 Distinct Value 1
400 Distinct Value 2
400
Distinct Value 3
300
200 Distinct Value 4
200 Distinct Value 5
100
100
0
Records#
云和恩墨 成就所托
9. How Many Choices
dba_tab_modific
• method_opt=> ations
– for columns size skewonly [column_name]
– for columns size auto [column_name]
COL_USAGE$
– for columns size repeat [column_name]
– for columns size 1 [column_name]
– for all columns
– for all indexed columns
云和恩墨 成就所托
10. How Should We Do?
• Step 1
– method_opt=>FOR ALL COLUMNS SIZE 1
• Step 2 (repeat)
– method_opt=>FOR COLUMNS SIZE AUTO [COLUMN_NAME]
• Step 3
– Using atomatic statistics gathering job
– (10g) exec DBMS_STATS.SET_PARAM ('METHOD_OPT', 'FOR
ALL COLUMNS SIZE REPEAT');
– (11g) exec
DBMS_STATS.SET_GLOBAL_PREFS('METHOD_OPT','FOR ALL
COLUMNS SIZE REPEAT');
云和恩墨 成就所托
11. What is Granularity
• 只针对分区表
• ALL
• AUTO (默认值)
• DEFAULT = GLOBAL AND PARTITION
• GLOBAL
• GLOBAL AND PARTITION
• PARTITION
• SUBPARTITION
云和恩墨 成就所托
granularity Granularity of statistics to collect (only pertinent if the table is partitioned).'ALL' - gathers all (subpartition, partition, and global) statistics'AUTO'- determines the granularity based on the partitioning type. This is the default value.'DEFAULT' - gathers global and partition-level statistics. This option is obsolete, and while currently supported, it is included in the documentation for legacy reasons only. You should use the 'GLOBAL AND PARTITION' for this functionality. Note that the default value is now 'AUTO'.'GLOBAL' - gathers global statistics'GLOBAL AND PARTITION' - gathers the global and partition level statistics. No subpartition level statistics are gathered even if it is a composite partitioned object.'PARTITION '- gathers partition-level statistics'SUBPARTITION' - gathers subpartition-level statistics.