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.
Take the next diagnostic step
Use these ERPClimb resources to explore the scenario. Verify all actions in your SAP system before making production changes.
- ABAP performance questions →
Review SQL trace and database access tuning scenarios.
- ABAP Code Lab →
Practice efficient Open SQL patterns.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Learn this properly
Lessons and topics
- Open SQL Part 2: SELECT Basics — Field Lists, WHERE and INTO
- CDS Views Part 10: Performance and Troubleshooting
- CDS Associations Part 5: Troubleshooting Duplicates, Missing Data and Slow Queries
- Performance tracing, SQL and HANA analysis — Guided debugger and evidence walkthrough
- Fiori Elements Part 5: Enterprise Scale — Performance, Draft and Clean Core
- BAdI Part 9: Performance and Database Access in BAdIs
- RAP Build-Along Part 9: Production Troubleshooting — Metadata, Behavior, Messages and Save
- Performance Part 3: Tuning in Real Projects — Measure, Fix, Verify
- OData V2 Part 3: Production Troubleshooting — Gateway Logs and Metadata
- Fiori Performance Part 2: OData Request and Back-End Performance
- User Exits Part 8: Performance Risks in User Exits
- Debugging Part 10: Production Debugging — Evidence First
- Performance Part 2: The Database-First Rule
- OData V4 Part 5: Troubleshooting HTTP Errors, Metadata and Payloads
- AMDP Part 2: Create Your First AMDP Method
- CDS Table Functions Part 4: Performance with HANA Plan Analysis
- Behavior Implementations Part 5: Performance, Unit Testing and Debugging
- SAP Gateway Part 4: Paging, Filtering, CSRF and Authorization
- Performance tracing, SQL and HANA analysis — Root-cause case, remediation and assessment
- Performance Part 7: JOIN vs FOR ALL ENTRIES vs Nested SELECT
- Managed RAP Part 5: Projection Layer, Testing, Performance and Clean Core
- AMDP Part 5: Debugging, Testing and Performance Analysis
- CDS Table Functions Part 1: When You Really Need a Table Function
- Performance tracing, SQL and HANA analysis — Concepts and mental models
- CDS Views Part 3: Performance — Joins, Associations, Filters and Aggregation
- Open SQL Part 1: How ABAP Reads the Database
- Open SQL Part 8: Performance Analysis with ST05, SAT and SQL Monitor
- RAP Build-Along Part 7: Clean Core, Security, Performance and Transport
- Open SQL Part 9: HANA-Friendly SQL and Code Pushdown
- Performance Part 4: SELECT Inside LOOP — The Classic Performance Killer
- Performance Part 5: FOR ALL ENTRIES — Correct Use and Hidden Risks
- Enhancements Part 9: Performance and Safety in Enhancements
- Performance Part 10: Indexes, Selectivity and WHERE Conditions
- Performance Part 1: Measuring with ST05, SAT and STAD
- Debugging Part 1: How to Approach an ABAP Problem
- Open SQL Part 10: Open SQL in Real Reports and Interfaces
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.