DB2 Performance Tuning Principles
Bring together indexing, statistics, isolation levels, and SQL-writing discipline into a coherent approach to diagnosing and fixing slow DB2 queries.
"This query is slow" is a diagnosis problem with a fixed sequence, not a list of tricks. The sequence itself is what the question is testing.
Tuning a slow DB2 query is like diagnosing why a delivery route suddenly takes twice as long — you check the map app's chosen route first (EXPLAIN), then whether the map data is current (RUNSTATS/REORG), then whether a shortcut even exists (indexing), then whether the delivery instructions themselves are oddly worded and confusing the app (SQL rewrite), before finally considering whether it's just rush hour traffic everywhere (environmental/concurrency factors).
Key Concepts
RUNSTATS -> measure the table as it is now
REBIND -> let the optimiser choose again WHERE YEAR(CREATED_DATE) = 2026 function on the column
WHERE ACCT_NUM = 12345 numeric literal, CHAR column
WHERE NAME LIKE '%son' leading wildcard SELECT * every column, including ones you ignore
DISTINCT "just in case" forces a sort
ORDER BY you do not use forces another