Chapter 6. Runstats

The major causes of SQL performance problems often revolve around insufficient statistics on the tables involved. One great thing starting with DB2 V8 is the ability to run both cardinality and frequency value statistics on both indexed and non-indexed columns. This gives the optimizer more information on predicates coded against these columns, enabling it to predict filter factors more accurately. Prior to V8, these statistics could only be run on columns that were part of an index, and only on leading columns or leading column combinations.

When it comes to multi-table joins, often the optimizer makes an incorrect choice about which table is the leading (composite) table. DB2 should choose the table that gets filtered the ...

Get DB2 SQL Tuning Tips for z/OS Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.