Chapter 2. DB2 SQL Hints

Every RDBMS has hints you can code in SQL statements to try to get the optimizer to choose something different in its optimization. For example, you might want to direct DB2 to choose a different index, a different order of the table flow, or a different join method. You use these hints when the access path for an SQL statement does not perform very well and all other options, including the following, have been exhausted:

• Rewriting the query a different way

• Hard coding rather than using host variables

• Reorganizing the table and index files

• Using runstats for the tables involved

• Using frequency value runstats for specific columns involved

• Redesigning any appropriate indexes

• Rewriting predicates yet keeping ...

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.