Oracle Training Oracle News Oracle Forum Class Catalog Our Staff Our Prices Help Wanted! Remote DBA Oracle Tuning Emergency 911 RAC Support Apps Support Analysis Design Implementation Oracle Support
SQL Tuning Security UNIX Oracle UNIX Linux Oracle Linux Monitoring Remote help Remote plans Remote services Oracle C++ Oracle Java Apache JDeveloper App Server Applications Oracle Forms Oracle Portal 11i Upgrades SQL Server Oracle Concepts HTML-DB Tips Software Help Remote Help Development Implementation
Financials Training Oracle 11i Oracle Apps 11i Oracle Workflow Oracle AR 11i Class Oracle AP 11i class Oracle GL 11i class Oracle HR 11i class Oracle FA 11i class 11i Project Mgt 11i procurement 11i collections
Oracle Posters Oracle Books Oracle Tuning Book Oracle RAC Book Oracle Security Easy Oracle Books Oracle Scripts SQL Server DBA SQL Design Patterns Ion Excel-DB
BC Oracle News Rednecks! Dress code Arabian Stallion Burleson Arabians Guide Horses Don Burleson Blog Golf & Travel Privacy Policy
Rednecks! Dress code Arabian Stallion Burleson Arabians Guide Horses Don Burleson Blog Golf & Travel Privacy Policy
Oracle Tips by Burleson Consulting February 3, 2004Don Burleson
Starting in Oracle9i release 2 we have several super-exciting ways to automate the tedious task of providing the cost-based SQL optimizer with index histograms: Details on new method_opt features: These automate the detection of columns that require histograms, and automatically create them: method_opt=>'for all columns size skewonly' method_opt=>'for all columns size repeat' method_opt=>'for all columns size auto' method_opt=>'for all columns for column (xxx(yyy))' Remember, analyzing for histograms is time-consuming, and histograms are used under two conditions: Table join order – The CBO must know the size of the intermediate result sets (cardinality) to properly determine the correct join order the multi-table joins. This is normally performed for foreign key constraints, and non-constraint, non-unique columns that are used in table joins. This is a critical task for the CBO to determine the optimal sequence for joining many tables together as efficiently as possible. Table access method – The CBO needs to know about columns in SQL where clauses, where the column value is skewed such that a full-table scan might be faster than an index range scan. Oracle uses this skew information in conjunction with the clustering_factor columns of the dba_indexes view. Hence, this is the proper order for using the dbms_stats package to locate proper columns for histograms: 1. Skewonly option - You want to use skewonly to do histograms for skewed columns, for cases where the value will make a difference between a full-table scan and an index scan. 2. Monitor - Next, turn-on monitoring. Issue an “alter table xx monitoring” and “alter index yyy monitoring” command for all segments in your schema. This will monitor workload against 3. Auto option - Once monitoring is in-place, you need to re-analyze with the "auto" option to create histograms for join columns within tables. This is critical for the CBO to determine the proper join order for finding the driving table in multi-table joins. 4. Repeat option - Finally, use the "repeat" option to re-analyze only the existing histograms. Periodically you will want to re-run the skewonly and auto option to identify any new columns that require histograms. Once located, the repeat option will ensure that they are refreshed with current values. Oracle guru Guy Harrison also offers this advice for 11g statistics collection for a function-based index column. DBMS_STATS.gather_table_stats (ownname => USER, tabname => ‘SALES’, method_opt => ‘FOR ALL COLUMNS FOR COLUMNS (sale_category(amount_sold))’ );
Starting in Oracle9i release 2 we have several super-exciting ways to automate the tedious task of providing the cost-based SQL optimizer with index histograms:
Details on new method_opt features:
1. Skewonly option - You want to use skewonly to do histograms for skewed columns, for cases where the value will make a difference between a full-table scan and an index scan. 2. Monitor - Next, turn-on monitoring. Issue an “alter table xx monitoring” and “alter index yyy monitoring” command for all segments in your schema. This will monitor workload against 3. Auto option - Once monitoring is in-place, you need to re-analyze with the "auto" option to create histograms for join columns within tables. This is critical for the CBO to determine the proper join order for finding the driving table in multi-table joins. 4. Repeat option - Finally, use the "repeat" option to re-analyze only the existing histograms.
Oracle guru Guy Harrison also offers this advice for 11g statistics collection for a function-based index column.
DBMS_STATS.gather_table_stats (ownname => USER, tabname => ‘SALES’, method_opt => ‘FOR ALL COLUMNS FOR COLUMNS (sale_category(amount_sold))’ );
Burleson is the American Team
Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals. Feel free to ask questions on our Oracle forum.
Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.
Errata? Oracle technology is changing and we strive to update our BC Oracle support information. If you find an error or have a suggestion for improving our content, we would appreciate your feedback. Just e-mail: and include the URL for the page. Burleson Consulting The Oracle of Database Support Oracle Performance Tuning Remote DBA Services Copyright © 1996 - 2009 by Burleson Enterprises, Inc. All rights reserved. Oracle © is the registered trademark of Oracle Corporation.
Burleson Consulting The Oracle of Database Support
Oracle Performance Tuning
Remote DBA Services
Copyright © 1996 - 2009 by Burleson Enterprises, Inc. All rights reserved.
Oracle