COMP
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
Additional Linksβ
- IBM Docs β Db2 LUW Wait Events
- IBM Docs β Identifying CPU-intensive SQL
- IBM Docs β Db2 Performance Tuning
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.