SAP transaction codeObjectST05ModuleABAP

ST05 — SQL and Performance Trace

ST05 is the SQL/performance trace transaction. It records actual database calls, enqueue requests, RFC calls, and buffer activity for a chosen user during a defined recording window, then displays them as a sortable list. It is the tool used to see whether a slow transaction is spending its time in repeated or expensive SQL statements rather than in ABAP processing.

This page covers ST05, the kernel-level SQL trace transaction used to diagnose database-bound performance problems. It focuses on the recording workflow, what the trace list actually shows, and the recurring diagnostic mistakes: unrestricted traces full of noise, misreading buffered tables, and missing repeated-select patterns inside loops.

Reviewed by an ERPClimb SAP consultant on 15 Sept 2026· 1,244 words

What it does

ST05 switches on a kernel-level trace that captures every database call a work process makes for a chosen user: SELECT, INSERT, UPDATE, DELETE, COMMIT, and optionally OPEN CURSOR/FETCH. It can also trace RFC calls, enqueue/dequeue requests, table buffer activity, and HTTP calls. The trace is not a continuous monitor; it must be explicitly activated, the problem step reproduced, and the trace deactivated before the results are readable. The structural fact that explains most confusion: the trace list only contains what happened during the recording window for the filtered user. If the filter is left open to all users, or the window is too wide, the list fills with unrelated background activity and the real signal gets buried in noise.

When it is used

ST05 is reached for once a transaction, report, or interface step is confirmed slow and the question becomes where the time is going. It sits after basic timing checks (a stopwatch on the transaction, or a runtime analysis in SAT) once those point at the database rather than at ABAP-side loops or formatting. Typical triggers: a report that used to run in seconds now takes minutes, a batch job whose runtime scales badly with data volume, or an interface call that times out intermittently. ST05 is not used to monitor live system load in general; ST02, SM50, or workload monitoring cover that. It is a targeted, one-shot diagnostic run against a single reproducible step, not a background health check.

How to use it

  • Open ST05 and restrict the trace to a specific user, ideally the tester's own user ID, to avoid capturing unrelated work processes.
  • Select the trace components needed: SQL trace at minimum, add RFC trace, enqueue trace, or buffer trace only if those layers are suspected.
  • Activate the trace, then immediately execute the report or transaction step under investigation in a separate session or window.
  • Deactivate the trace as soon as the step finishes; leaving it running captures unrelated noise and grows the trace unnecessarily.
  • Display the trace list and sort by duration to find the statements consuming the most time.
  • Use the aggregation/summary view to group identical statement texts and count how many times each one ran.
  • Select an individual statement and use Explain to see the access path and which index, if any, was used.

Key fields

ST05 does not write its results into standard transparent application tables the way a business transaction writes master or transaction data. The trace is recorded by the kernel into temporary trace data tied to the work process and the trace request, and is read back into the transaction's own list display. There is no SE16-style table to browse for the raw trace content; the trace list inside ST05 is the record.

  • Trace buffer per work process - the raw, short-lived record of every DB/RFC/enqueue call made during the active recording window, cleared after the trace is stopped or reset.
  • Trace request/filter settings - the user, transaction, and component selections (SQL, RFC, enqueue, buffer, HTTP) that scope what gets captured, held for the duration of the session.
  • Explain plan output - generated on demand from the database's own execution plan for a selected statement, not stored by ST05 itself.

How to prove it in the data

There is no separate table to query for proof; the proof is the trace list itself. After recording, group the list by statement text and count occurrences: a single SELECT text executed hundreds of times with only the key values changing is the signature of a select-inside-loop or a missing FOR ALL ENTRIES/JOIN. To confirm the underlying table behavior, cross-check the key values seen in the trace against the actual table in SE16N: if the same key is fetched repeatedly and the data barely changes, that table is a candidate for buffering or for a bulk read instead of repeated single selects.

ECC vs S/4HANA

ST05 exists on S/4HANA and works the same way operationally: activate, reproduce, deactivate, review the list. On a HANA database the Explain output reflects HANA-specific plan operators rather than the classic database's access paths, so the details of what a good or bad plan looks like differ, but the trace workflow itself is unchanged. No Fiori app replaces ST05 as the primary SQL trace tool; broader end-to-end tracing capabilities exist in separate monitoring tools, but the SAP GUI transaction remains the standard entry point for this specific diagnostic.

Common pitfalls

  • Unrestricted trace scope: tracing without a user filter, or leaving the trace running across multiple unrelated steps, produces a list dominated by background noise; always scope to one user and stop the trace immediately after the step under test.
  • Buffered-table misreading: a statement against a fully buffered table may show near-zero database time because it was satisfied from the local buffer, not because the access is efficient at scale; check the table's buffering setting and buffer quality separately before concluding the access is cheap.
  • Repeated identical selects: the most common real finding is the same SELECT statement, same WHERE structure, executed many times with different key values inside a loop; this is the pattern to hunt for first by sorting the aggregated list by execution count, not just by single-statement duration.
  • Trace left running: forgetting to deactivate the trace inflates the trace size, adds overhead to the system, and can hit internal buffer limits causing wraparound where the earliest entries are silently dropped; always deactivate promptly and re-run in shorter windows if the step is long.
  • Explain misread as elapsed time: the Explain output is the database's estimated execution plan, not the actual measured duration of that call in the trace; the real cost is the duration column in the trace list, and Explain is only used to understand why that duration is high.
  • Wrong trace layer enabled: chasing a delay as a database problem when only SQL trace was active, while the actual wait was in an RFC call or an enqueue lock, produces no evidence; if the SQL trace shows gaps or idle time between statements, re-run with RFC and enqueue trace added.

Whose problem this is

Primarily an ABAP/development or performance-consulting task; Basis gets involved when the root cause is database configuration, missing indexes, or buffer sizing rather than the ABAP code path. A good handover includes the trace excerpt with the repeated-statement counts and durations highlighted, the exact transaction or report and variant used to reproduce it, and the time window the trace covered.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-tcodes/st05ERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.