To find out how to tune an SQL statement, you can use a
number of analysis tools and advisors.
Using analysis tools
The analysis tools can help you understand the structure
of an SQL statement, understand the access path for that statement,
test indexes before creating them, and compare access paths before
and after following recommendations from advisors.
Generating and acting on recommendations
The advisors can recommend RUNSTATS commands for collecting
statistics, new indexes (and show you whether existing indexes are
used by the DB2® optimizer),
revisions to an SQL statement, and ways to change an access plan.