afv-library/skills/debugging-apex-logs/references/common-issues.md
sandipkumar-yadav 37aa84df42
feat: @W-22444026@ Introducing Core Skills, Datacloud Skills, Industries and Utility Skills. (#268)
* Migrating Core Salesforce Skills

* Updating pr comments

* updat reference

* Updating a skill

* Migrating Datacloud skills

* Migrating Industries cloud skills

* Validating - skills fixing

---------

Co-authored-by: Sandip Kumar Yadav <sandipkumar.yadav+sfemu@salesforce.com>
2026-05-14 19:32:15 +05:30

69 lines
1.2 KiB
Markdown

# Common Debug Log Issues
## SOQL in loop
**Signals**
- repeating `SOQL_EXECUTE_BEGIN`
- query appears inside repeated method path
**Fix pattern**
- query once outside the loop
- use `Map<Id, SObject>` or grouped collections
## DML in loop
**Signals**
- repeated `DML_BEGIN`
- high DML statement count for small transactions
**Fix pattern**
- collect changes
- do one bulk DML operation
## Non-selective query
**Signals**
- high rows scanned
- slow query timing
- table-scan indicators
**Fix pattern**
- add indexed filters
- reduce scope
- use query-plan guidance
## CPU pressure
**Signals**
- CPU usage trending toward sync limit
- repeated expensive helper methods
- nested loops / repeated string work
**Fix pattern**
- reduce algorithmic complexity
- cache repeated work
- move heavy processing async where appropriate
## Heap pressure
**Signals**
- large collection allocations
- heap usage approaching sync limit
**Fix pattern**
- use SOQL for-loops
- reduce in-memory object size
- clear collections when done
## Null pointer / unhandled exceptions
**Signals**
- `EXCEPTION_THROWN`
- `FATAL_ERROR`
- clear stack trace with line numbers
**Fix pattern**
- guard null values
- make assumptions explicit
- improve result handling for empty query results