SQL Statement in AL Profiles
SQL Statement collection in AL performance profiles, available in Business Central 2025 Wave 2 (version 27), allows developers to see which SQL queries run during profiled code execution in sampling mode. This capability helps identify database-related performance issues faster by showing the exact SQL statements executed within methods.

post Dynamics 365 Business Central tales, myths, legends. And something serious.
"SQL Statement collection in AL profiles is enabled only when tracing in sampling mode and not in instrumentation mode."
Key points
- SQL statements are now visible in AL performance profiles through the in-client profiler, showing individual queries executed during method execution
- SQL collection works only in sampling mode, not instrumentation mode, limiting consistency of profiling data
- Available through in-client performance profiler, scheduled profiles, and snapshot debugging in Visual Studio Code
- Results can be viewed in VS Code by opening .alcpuprofile files or imported into the web client Performance Profiler tool
Quotes
- “SQL Statement collection in AL profiles is enabled only when tracing in sampling mode and not in instrumentation mode.” (Understanding the limitation helps developers know when they can use this feature and plan profiling strategies accordingly)
- “In the Method Name you will see that there are the SQL Statement collected and not just the Method itself, as in previous versions” (This demonstrates the key improvement - developers can now drill down from methods to see the actual SQL queries executed)
- “A real nice touch that will be helpful in pinpointing database access related performance issues in shorter time.” (Captures the practical value of the feature for developers troubleshooting performance problems)
Context
- Features: SQL statement profiling, in-client performance profiler, scheduled profiles, snapshot debugging, Time Spent by Application Object view, Call Tree inspection
- Versions: 2025 Wave 2, version 27
Source: Duilio Tacconi, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.