Performance tuning

From 5throck/ai-workspace-standards · View interactive version

Performance tuning is an AI agent skill from the GitHub repository 5throck/ai-workspace-standards. Use when investigating slow ABAP programs, expensive SQL statements, or reviewing performance risk on large tables (VBAK, BSEG, ACDOCA, etc.). Provides a standardized workflow using TraceExecution, ListSQLTraces, and GetCallGraph to diagnose and document performance issues before they reach producti

How to use this skill

Skill file

Performance Tuning Workflow

Standardizes performance analysis so findings are reproducible and comparable across sessions,

instead of ad-hoc RunQuery sampling. Owned by the DBA agent (agents/dba.md); the

Architect and QA Engineer may trigger it during technical design or QA review.

Origin: raised by the DBA agent in the 2026-07-05 project review meeting — large-table access

paths (VBAK, BSEG) need a standard procedure, not one-off spot checks.

When to Use

Workflow

1. Baseline trace
   TraceExecution(object) → capture runtime, DB time %, top statements

2. SQL statement analysis
   ListSQLTraces() → GetSQLTraceState() → identify statements with high execution count
   or full table scans (missing index usage)

3. Call graph / dependency check
   GetCallGraph(object) or AnalyzeCallGraph(object) → confirm no redundant nested SELECTs
   inside loops (SELECT-in-LOOP anti-pattern)

4. Index verification (hand off to DBA table-design duties)
   GetTable(table) → check existing secondary indexes cover the WHERE/JOIN predicates
   used by the traced statements

5. Report
   Document findings using the Performance Report format below

Performance Report Format

### Performance Analysis — <object name>

**Trigger**: <why this was analyzed — slow report / pre-release check / QA escalation>
**Trace summary**: <total runtime, DB time %, top 3 statements by execution count>

#### Findings
| # | Statement / Pattern | Table(s) | Issue | Severity |
|---|---------------------|----------|-------|----------|
| 1 | ... | VBAK | Full table scan (missing index on ERDAT) | High |

#### Recommendations
- <index addition / query rewrite / SELECT-in-LOOP fix, one per finding>

**Verdict**: <Pass / Needs optimization before transport release>

Anti-Patterns to Flag

SELECT ... FOR ALL ENTRIES or JOIN.

Severity → Disposition

| Severity | Disposition |

|----------|-------------|

| High (full scan / N+1 on a large table) | Block transport release until fixed |

| Medium (missing index, acceptable volume today) | PM disposition — fix now or track as follow-up task |

| Low (style-only inefficiency, negligible volume) | Note in QA report, no gate |

Related

Context

This skill standardizes performance analysis for ABAP programs and SQL queries so findings are reproducible and comparable across sessions. It replaces ad-hoc RunQuery sampling with a structured workflow using TraceExecution, ListSQLTraces, and GetCallGraph to diagnose bottlenecks and document recommendations before they reach production. It is owned by the DBA agent but may be triggered by Architect or QA Engineer during design or review.

Execution Steps

  1. Baseline trace — Use TraceExecution on the target object to capture runtime, DB time percentage, and top statements.
  2. SQL statement analysis — Use ListSQLTraces and GetSQLTraceState to identify high-execution-count statements or full table scans.
  3. Call graph check — Use GetCallGraph or AnalyzeCallGraph to detect redundant nested SELECTs inside loops (N+1 anti-pattern).
  4. Index verification — Use GetTable to check whether existing secondary indexes cover the WHERE/JOIN predicates in traced statements.
  5. Report — Document findings using the standardized Performance Report format with findings table and recommendations.

Output Format

A structured Performance Analysis Report containing:

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.