How-toEpicor Kinetic / Epicor ERP 10BAQ / Reporting

Fixing a Slow Epicor BAQ (Business Activity Query)

Question
Epicor BAQ running slow how to fix performance

Also searched as

  • Epicor Business Activity Query timeout
  • how to optimize a slow BAQ in Epicor
  • Epicor BAQ taking too long to load dashboard
  • Epicor dynamic query performance tuning

Short answer

A slow BAQ in Epicor is usually caused by unindexed join columns, a subquery or calculated field forcing a table scan, or the BAQ pulling far more rows than the dashboard actually displays before filtering client-side. Fix it by reading the SQL Server execution plan Epicor generates, moving filters into the BAQ criteria instead of the dashboard filter panel, and replacing subqueries with joins where possible.

Applies to: Epicor ERP 10.1, 10.2, Epicor Kinetic - all BAQ, BAQ Report, and Dashboard-based BAQs

Diagnose and tune the query

  1. 1Open the BAQ in BAQ Designer, go to the Analyze or Execution Plan tab if available, or run the generated SQL directly in SQL Server Management Studio against the same company database.
  2. 2In SSMS, turn on Include Actual Execution Plan and run the query - look for Table Scan or Index Scan operators with a high relative cost, which point to the join column or WHERE clause that needs an index.
  3. 3Check every join for calculated or subquery-based fields (Sub-Query phrases in BAQ Designer) - these often run once per outer row instead of being flattened into a single set-based join, which is the single biggest cause of BAQ slowness.
  4. 4Move any filter that is always applied (company, site, a date range, a status) into the BAQ's Criteria tab as a fixed or default-value filter rather than leaving it to the dashboard's runtime filter panel, so SQL Server can use it during query planning.
  5. 5Check whether the BAQ selects fields from tables that are not actually joined on an indexed key - EntryPerson, LastChangedBy and similar audit columns are common offenders when pulled from a large table like OrderDtl.
  6. 6For dashboards, confirm Auto Search / Auto Refresh are off if the underlying BAQ is heavy, and set a sensible row limit (Top N or a default filter) so the query does not pull the entire table before the user narrows it.
  7. 7If the BAQ needs to remain complex, consider a BAQ-based Business Activity Query view materialized through a scheduled BAQ Export or a SQL indexed view, rather than recalculating on every open.

Where BAQ slowness actually comes from

BAQ Designer generates fairly literal SQL from the visual join and criteria tabs, so almost every performance problem traces back to something in the design rather than to Epicor itself: an unindexed join column, a subquery phrase that runs per row, or a calculated field that references another table inline instead of through a join.

The Epicor tables most often at fault are large transactional tables - OrderDtl, PartTran, JobOper, GLJrnDtl - where a join on a non-key column (Company plus one field instead of the full compound key) forces SQL Server into a scan of millions of rows instead of a seek.

Subqueries vs joins

BAQ Designer's "Sub-Query" phrase type is convenient for pulling a single related value (last invoice date, most recent PO price) but SQL Server frequently executes it as a correlated subquery, once per outer row, rather than optimizing it into a set-based join. For anything returning more than a few hundred rows, replace the sub-query phrase with an explicit table join and a calculated field or a Top 1 with an ORDER BY, or push the logic into a SQL view the BAQ then reads from.

Filters: BAQ criteria vs dashboard filter panel

A filter typed into the dashboard's runtime search panel is applied by the Epicor client after the BAQ has already returned its result set from SQL Server in many dashboard configurations, or at best as a late-bound parameter, which is less efficient than a WHERE clause SQL Server can use for an index seek during planning. Always push permanent filters (Company, a status list, a date window) into the BAQ Criteria tab as either a fixed filter or a required runtime parameter, so the generated SQL includes them from the start.

Indexing without touching Epicor system tables directly

Do not add custom indexes directly to Epicor's own tables through SSMS - upgrades and Epicor's own index maintenance can drop or conflict with them, and it is unsupported. Instead, work with your Epicor partner or Epicor Support to request an index change through supported channels, or materialize the heavy query into a separate reporting table or view outside the core schema that your BAQ reads from instead.

Common pitfalls

  • !Adding unsupported custom indexes directly on core Epicor tables instead of going through Epicor Support or a materialized reporting layer.
  • !Leaving default filters in the dashboard search panel instead of the BAQ Criteria tab, which defeats SQL Server's ability to plan around them.
  • !Using multiple nested sub-query phrases for lookups that would be a single join with a Top 1 or MAX aggregate.
  • !Testing performance only in a small test company - row counts and skew in production are what actually reveal the slow plan.
  • !Forgetting that a BAQ used inside a BPM directive runs on every affected transaction, so a slow BAQ there is a system-wide slowdown, not just a slow report.
  • !Rebuilding the whole BAQ from scratch before checking the execution plan, which often finds a single missing join condition instead.

How an ERP-grounded AI assistant handles this

ERPray, connected read-only to the Epicor database, can answer "why is this BAQ slow" by reading the same generated SQL and execution plan a DBA would, then explaining in plain language which join or sub-query phrase is the likely cause - shortening the diagnosis step before a developer opens BAQ Designer to fix it. It does not change indexes or the BAQ itself; that stays a reviewed, deliberate change.

Frequently asked questions

Does Epicor cache BAQ results?

Not by default for standard BAQs run interactively - each open or refresh re-runs the query. Some dashboard configurations and BAQ Reports scheduled through System Monitor do cache their last output, so check whether you are looking at a live query or a scheduled snapshot before assuming a slow BAQ got faster on its own.

Can I see the actual SQL Epicor generates from a BAQ?

Yes - most BAQ Designer versions have an Analyze tab or a way to export/view the generated SQL, or you can capture it with SQL Server Profiler or Extended Events while running the BAQ. Running that captured SQL directly in SSMS with an execution plan is the fastest way to find the real bottleneck.

Is a BAQ or an SSRS/BAQ Report slower for the same data?

The underlying query cost is usually identical since BAQ Reports run the same BAQ; the difference is rendering and pagination overhead in the report engine on top. If the BAQ itself is slow, fixing the query helps both the interactive BAQ and any report built on it.

Should I use a calculated field or a SQL view for complex logic?

For logic reused across several BAQs, a SQL view (deployed through supported customization practices, not directly against core tables) is usually faster and easier to maintain than repeating the same calculated field or sub-query phrase in every BAQ that needs it.

Related

Error fix

Fixing Epicor BusinessObjectException: BPM Directive Errors

A BusinessObjectException that says "A Business Process Management (BPM) directive has raised the following error" means a directive on that business object stopped the transaction, either deliberately via a Raise Exception widget or accidentally via an unhandled .NET error in Custom Code. Expand the InnerException on the error dialog to see the real message and the directive name, then open BPM Designer for that object and method to find the widget that fired.

How-to

Epicor MRP Runs but Generates No Suggestions

When Epicor's MRP process completes without a job or purchase suggestion for a part you expect one for, the cause is almost always the part's own configuration (Part Class Type, Make Direct, Non-MRP flag, planning Time Fence) or the demand not being linked in a way MRP recognizes, not a defect in the MRP engine. Work through the part's Planning tab, its safety stock and lead time setup, and the demand source (sales order line status, job material requirement) before assuming the run itself failed.

How-to

Preserving Customizations When Upgrading to Epicor Kinetic

Epicor Kinetic's web UI does not simply inherit classic smart-client customizations - most need to go through the Update Customization / Application Studio conversion process, and some WinForms-specific customizations cannot convert directly and must be rebuilt in the Kinetic designer. Plan the upgrade as a customization inventory and rework project, not a single technical cutover step.

Error fix

Fixing Epicor REST v2 API 401 Unauthorized Errors

A 401 Unauthorized calling Epicor's REST v2 (api/v2/odata) endpoint almost always comes down to one of three things: a missing or wrong x-api-key header, valid credentials but an API key scoped to a different company than the one in the URL, or REST services simply not enabled for that endpoint. Confirm the API key exists and is active in Application Studio (or the classic REST API help page), matches the company segment in the URL, and that the account used for Basic auth or OAuth has the right security group.

Advanced

How to create and call an Epicor Function

Open Function Studio from the main menu (Customization > Function Studio) or from inside a BPM designer's Call Context widget, define a Library and Function with typed inputs/outputs, write the logic in the C# widget, then compile and test with the built-in test harness before calling it from a BPM directive, a dashboard, or another function.

Advanced

Epicor Application Studio: understanding customization layers

Kinetic UI is built in layers loaded in order - Base (Epicor-delivered), Customization (Application Studio, company/layer-wide), Personalization (user- or role-specific, applied on top), and optionally Extended (packaged add-on layers) - and a change you make will not appear if a higher layer overrides the same control or if you are testing in the wrong layer context.

AI for ERP

AI for Epicor Kinetic, Beyond What Prism Covers

Add AI to Epicor Kinetic beyond Prism: private LLM over BAQs, BPM data, and REST v2, on-prem or private cloud, with honest guidance on when Prism already covers you.

Stuck on Epicor Kinetic / Epicor ERP 10?

Talk to engineers who work inside Epicor Kinetic / Epicor ERP 10 every week, and who build private AI that answers these questions from your own ERP data.