Skip to main content

COMP

Short Description

Indicates a session is waiting for CPU while executing SQL, i.e. it is actively computing rather than blocked on I/O, locks, or latches.

Detailed Description​

COMP in IBM Db2 LUW is a wait event that indicates a session is waiting for CPU while executing SQL, i.e. it is actively computing rather than blocked on I/O, locks, or latches.

In practical terms, COMP means Db2 has work to do (query execution, expression evaluation, joins, sorts, aggregates, etc.) but is not getting CPU time immediately or is spending significant time on CPU-intensive operations.

Common causes include:

  • CPU saturation on the host
  • Expensive query execution plans
  • Large scans, joins, or sorts
  • Missing or ineffective indexes
  • Poor cardinality estimates leading to bad access paths
  • High concurrency causing CPU contention

COMP is therefore a CPU pressure / query efficiency signal, not a blocking wait.

How to reduce this wait​

Key levers to reduce COMP waits:

1. Reduce CPU pressure​

  • Check overall CPU utilisation at the OS level
  • Avoid running DB2 on already saturated hosts
  • Ensure Db2 has enough CPU entitlement (especially in VMs / containers)

2. Tune SQL and access paths​

  • Identify top CPU consumers using:
    • MON_GET_PKG_CACHE_STMT
    • MON_GET_ACTIVITY
  • Look for:
    • Table scans instead of index access
    • Large joins with poor join order
    • Repeated expression evaluation
  • Add or fix indexes to reduce scanned rows

3. Improve statistics​

  • Run RUNSTATS regularly on large or volatile tables
  • Include distribution and column group stats where needed
  • Bad stats = bad plans = high COMP time

4. Reduce unnecessary work​

  • Avoid SELECT *
  • Reduce row and column counts early (filters first)
  • Push predicates down where possible

5. Watch sorts and hashes​

  • Large sorts and hash joins are CPU-heavy
  • Increase sort memory where appropriate
  • Avoid sorts caused by ORDER BY without indexes

6. Control concurrency​

  • Too many active queries can drive COMP waits even if each query is β€œreasonable”
  • Throttle workloads using:
    • Workload Management (WLM)
    • Connection pooling limits

Search online​

If this article doesn't have the information you need you can try searching online. Remember, you can contribute suggestions to this page.