topic hubPlatform, DevOps & Performanceofficial - Microsoftunreviewed - model text not yet checked

Analyzing database performance

Analyzing database performance for Business Central on-premises covers how to find slow SQL queries using the Windows Event Log, Application Insights telemetry, and SQL Server Query Store. It answers questions about thresholds, where long-running queries are logged, and how to compare query plans.

Path: Business Central on-premises > Administration > Analyzing database performance · tier official · system platform · narrative unreviewed (model text not yet checked)

Overview

This section is for administrators who need to find and troubleshoot slow database operations in an on-premises Business Central deployment. It has three pages and no subtopics. Two pages deal with long-running SQL queries reported by the server, and one deals with the SQL Server Query Store.

Start with the Event Log pages. They explain how the server writes queries that exceed the SqlLongRunningThreshold setting (default 750 milliseconds) to the Application log in Event Viewer, with the AL call stack to show what triggered the query. The monitoring page adds how to set thresholds with Set-NAVServerConfiguration, including a separate threshold for Application Insights telemetry, and mentions version 29.

Use the Query Store page when you need history rather than single events. It captures query plans and runtime statistics, so you can spot plan changes and compare performance over time.

Key points

  • Long-running SQL queries are logged to the Windows Event Log Application log when they exceed SqlLongRunningThreshold (default 750 ms).
  • Event entries include the SQL statement and the AL call stack, which helps find what caused the delay.
  • SqlLongRunningThresholdForApplicationInsights sets the threshold for sending long-running query telemetry to Application Insights.
  • Thresholds are changed with the Set-NAVServerConfiguration cmdlet.
  • The monitoring page references version 29.
  • Query Store is a SQL Server feature that keeps query history, plans, and runtime statistics.
  • Query Store helps identify query plan changes and compare performance between periods.
  • Use Event Log for spotting individual slow queries and Query Store for plan and trend analysis.

Learn pages

  • Monitoring Long-Running SQL Queries in the Event Log: Monitor long-running SQL queries from Business Central Server in the Windows event log and Application Insights to investigate slow database operations.
    • SqlLongRunningThreshold setting controls when successful SQL queries are logged as long-running in Windows event log.
    • Status: In Business Central version 29, the default value of SqlLongRunningThreshold is 750 milliseconds.
    • SqlLongRunningThresholdForApplicationInsights controls the threshold for Application Insights telemetry, also defaulting to 750 ms.
    • Queries meeting or exceeding the threshold are logged with a warning in the event log.
    • Step: Use Set-NAVServerConfiguration cmdlet with -ApplyTo Memory parameter to change the threshold without restarting the server.
    • Long-running query delays can result from database locks or missing indexes.
  • Troubleshooting: Using Query Store to Monitor Query Performance: Use SQL Server Query Store to troubleshoot query performance. The SQL Server Query Store feature provides insight on database query plan choice and performance.
    • SQL Server Query Store captures query history, compilation metrics, and runtime statistics aggregated over time intervals.
    • Status: Query Store available in SQL Server starting with version 2016 and Azure SQL Database.
    • Query Store helps identify queries with longest execution time, biggest IO reads, and other performance metrics.
    • Limit: Query Store retains history of aggregated metrics, not individual query execution logs.
  • Using Event Log to Monitor Long-Running SQL Queries: Use Windows Event Viewer to investigate long-running SQL queries in Business Central and inspect SQL statements and AL call stacks for optimization.
    • Step: Open Event Viewer and navigate to Windows Logs > Application to view long-running SQL queries.
    • Default SqlLongRunningThreshold is 750 milliseconds; successful queries meeting or exceeding it appear as warnings.
    • Long-running queries involving explicit AL code execution include an AL call stack in the event log showing which method generated the query.
    • Long-running queries from GetPage calls or empty triggers may not include AL call stack since no explicit AL code is executed.
    • Event log includes Statement field with SQL statement and AL CallStack field showing the AL method call sequence.
    • In the observatory: Table 2160 “Calendar Event”

Key facts from Microsoft Learn (CC BY 4.0), in our own words (D106); open the page for the full text.

Videos and posts

Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.

Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.

What Learn documents here 3 Learn pages