07.02.2013 Views

Best Practices for SAP BI using DB2 9 for z/OS - IBM Redbooks

Best Practices for SAP BI using DB2 9 for z/OS - IBM Redbooks

Best Practices for SAP BI using DB2 9 for z/OS - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 4-7 explains how to influence the <strong>DB2</strong> optimizer to use the appropriate<br />

index by explicitly faking the <strong>DB2</strong> statistics. You will find the details in <strong>SAP</strong> note<br />

688133. Make sure that you test your RSADMIN entries by running function<br />

module RSDU_ANALYZE_TABLE_<strong>DB2</strong> <strong>for</strong> the given table and check the output<br />

list where the generated and executed INSERT or UPDATE statements are<br />

shown. Figure 4-7 further highlights <strong>SAP</strong> note 688133.<br />

How to influence <strong>DB2</strong> statistics (note 688133)<br />

� specific RSADMIN parameters <strong>for</strong> influencing the <strong>DB2</strong><br />

statistics<br />

� Use this possibility only if no other solution helps<br />

� Collect additional frequencies <strong>for</strong> an given index<br />

– <strong>DB2</strong>_""= FREQVAL NUMCOLS n COUNT c<br />

Example: <strong>DB2</strong>_"/<strong>BI</strong>C/DMYDIMT~0" = FREQVAL NUMCOLS 5 COUNT 30<br />

� Change the clusterratio of an index<br />

-> to <strong>for</strong>ce the optimizer to use a known index set the<br />

clusterratio to 100<br />

– <strong>DB2</strong>_"" = CLUSTERRATIO x<br />

Example: <strong>DB2</strong>_"/<strong>BI</strong>C/FMYCUBE~030" = CLUSTERRATIO 100<br />

– <strong>DB2</strong> catalog is updated accordingly after the RUNSTATS<br />

run<br />

Figure 4-7 Faking the <strong>DB2</strong> statistics with RSADMIN parameters<br />

4.2.2 New to <strong>DB2</strong> 9: histogram statistics<br />

In this section we discuss histogram statistics.<br />

Overview and advantages<br />

Data distribution statistics are very important <strong>for</strong> query optimization. <strong>DB2</strong><br />

chooses the best access path based on costing, and the very basic foundation of<br />

costing is predicate selectivity estimation, which heavily relies on data<br />

distribution statistics.<br />

Up to <strong>DB2</strong> v8, the only distribution statistics supported in <strong>DB2</strong> <strong>for</strong> z/<strong>OS</strong> were<br />

frequency statistics collected on single values, which could be <strong>for</strong> either<br />

single-column or multi-column. For multi-column, it is a concatenated<br />

multi-column value. Such frequency statistics are most commonly collected on<br />

the most biased values (that is, the most frequent or the least frequent).<br />

Chapter 4. Benefits of <strong>DB2</strong> 9 <strong>for</strong> <strong>SAP</strong> <strong>BI</strong> 45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!