The author, Craig Mullen, presented great ideas on improving performance with DB2 SQL.

DB2 Performance
Photo by Medhat Ayad on Pexels.com

DB2 Performance tips

Here are some prime tips for improving DB2 performance.

  1. Always use query with where clause.
  2. Always create indexes on table.
  3. Explicit join is performance worth than Inner join.
  4. Always put exact columns that you want to retrieve in SELECT statement, not more than that.
  5. Use FETCH FIRST n ROWS ONLY. Take an example FETCH FIRST 1 ROWS ONLY, after returns 1 row, you will receive SQL CODE= +100.
  6. Use OPTIMIZE FOR n ROWS.
  7. For read only cursors always use FOR READ ONLY

References