"Business Central is slow" is a symptom, not a diagnosis.
The statement can mean a page takes eight seconds to open, a posting routine takes forty minutes, an API times out, a report fails at month-end, or one user on a hotel Wi-Fi has a bad afternoon. Each has a different root cause and a different fix.
Changing code before you have a reproducible problem is how performance work becomes superstition.
Define the symptom
Start with a sentence that contains a subject, an action, a dataset, and a measurement:
"On the production environment, opening the Sales Order List for a customer with 8,000 open lines takes 14 seconds for the inside-sales role. It was 3 seconds before extension X was deployed."
That sentence gives you something to reproduce. "Slow" does not.
Capture:
- The exact environment (production, sandbox, on-premises, cloud).
- The company and user role.
- The action and page or report.
- The time of day and whether it is repeatable.
- The data volume and filters.
- The device, browser, and network.
- The first known occurrence and any recent deployment.
Collect evidence in the right order
| Source | What it tells you | When to use it |
|---|---|---|
| User reproduction | Whether the symptom is repeatable and for whom | First |
| Browser and network tools | Whether the delay is client, network, or server | First |
| Business Central telemetry | Long-running operations, errors, web requests, job queue | Early |
| Performance profiler | Which AL statements and calls consume time | After the area is narrowed |
| SQL or environment metrics | Query cost, blocking, memory, CPU | When AL points at data access |
| Extension and deployment history | What changed recently | Immediately if the issue is new |
The order matters. Starting with a profiler for every complaint produces impressive traces and no prioritization.
Separate the layers
A slow page can spend its time in six different places:
- Client: rendering a huge page, a slow browser, a bad extension in the browser.
- Network: latency, proxy, DNS, or a large response.
- Business Central service: session queuing, environment load, or a platform issue.
- AL code: an expensive loop, repeated lookups, or a page trigger that loads too much.
- Data access: missing filters, non-indexed search, lock contention, or a large transaction.
- External dependency: an API call, a file share, or a service that the process waits on.
A page that is fast in a sandbox but slow for one user is not the same problem as a page that is slow for everyone. A report that is slow only at month-end is probably a data-volume problem. An API that times out only on retries is probably an integration problem.
The AL patterns that show up repeatedly
Loading the whole table
SalesLine.SetRange("Document Type", SalesLine."Document Type"::Order);
SalesLine.SetRange("Document No.", SalesHeader."No.");
SalesLine.FindSet();
repeat
// Process each line.
until SalesLine.Next() = 0;This is not automatically wrong. It becomes a problem when the loop calls another FindFirst, calculates flow fields, or updates a related table for every line.
Missing SetLoadFields
When the code only needs Quantity and Amount, loading every field on a wide table adds cost. Use SetLoadFields where the access path allows it, and be aware of when the platform must load additional fields anyway.
SalesLine.SetLoadFields("Item No.", Quantity, "Unit Price");
SalesLine.SetRange("Document No.", SalesHeader."No.");
SalesLine.FindSet();FlowFields in a loop
A FlowField looks like a field but can execute a query when it is evaluated. Doing that inside a loop over thousands of records produces the classic quadratic slowdown.
Repeated CalcFields
The same principle applies to CalcFields, CalcSums, and lookups. Calculate once when the value is stable, not once per iteration.
Commits inside a loop
A Commit releases locks and changes transaction behavior. It can also cause partial updates and make the process much harder to reason about. Understand why it is there before copying the pattern.
Wrong access path
A filter on a non-indexed field can force a scan. The fix may be a key, a different filter order, a query object, or a smaller data set; adding an index without understanding the workload can make writes worse.
A triage example
A customer reports that posting a purchase invoice takes two minutes.
- Reproduce in production with a specific document and note the session ID.
- Check telemetry for the long-running operation and correlate the timing.
- Run the performance profiler on the posting action in a copy of the environment.
- Identify that a customization validates every item against a custom staging table with a
FindFirstinside the line loop. - Confirm the staging table has no index on the search field.
- Add the appropriate access path or replace the per-line lookup with a set-based check.
- Re-profile with the same document and compare.
- Test posting under concurrent load, not only in isolation.
The fix might be a key, code refactoring, or a design change. The important part is that the decision came after evidence.
Fix one thing at a time
Performance work attracts broad refactors. Resist them during a triage.
- Establish a baseline measurement.
- Change one variable.
- Re-run the same scenario.
- Record the result.
- Keep the change only if it improves the target and does not regress something else.
A change that makes the page faster but breaks the posting routine is not a performance improvement. It is a new incident.
Production is different from the demo
Sandbox data is small. Production data has years of history, multiple companies, concurrent users, job queues, integrations, and a backup window.
Before declaring a fix successful, test:
- The largest realistic dataset.
- The busiest time of day or a simulated concurrent load.
- The same user role and permissions.
- The real extension set.
- The network path users actually have.
- The background jobs that run at the same time.
Prevention
The most useful performance investment is not a profiling session after go-live. It is a delivery habit:
- Review data access in code review, not only syntax.
- Include a production-like volume test for batch and reporting processes.
- Instrument integrations with duration and correlation data.
- Treat every new extension as a potential page-load and posting cost.
- Keep telemetry enabled and review long-running operations regularly.
- Write down the known capacity limits of the environment.
Performance is a property of the whole system. The best time to find a problem is before a user reports it.
For reporting-specific performance, read RDLC vs Word Layouts in Business Central. For integrations that retry under load, see Designing Idempotent Business Central API Integrations.
Primary sources
Official references for this topic
Documentation and reference material from the vendor or standards body, kept alongside this article.
Full reference shelf