# BAQ Query Execution Plan

**URL:** <https://www.epiusers.help/t/baq-query-execution-plan/66482>\
**Category:** Epicor ERP 10\
**Tags:** baq\
**Created:** [April 20, 2020, 11:43am UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482 "2020-04-20T11:43:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rppmorris](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@rppmorris](https://www.epiusers.help/u/rppmorris)\
**Post date:** [April 20, 2020, 11:43am UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/1 "2020-04-20T11:43:35Z")

</div>

When I attempt to Get a BAQ Query Execution Plan I receive the following:

![image](https://epiusers.help/uploads/default/original/3X/8/d/8d9ecb247f9024bc1b8dacca760467801988a550.png)  
Can anyone advise.

---

<div class="post-metadata">

**Author:** ![rppmorris](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@rppmorris](https://www.epiusers.help/u/rppmorris)\
**Post date:** [April 20, 2020, 12:33pm UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/2 "2020-04-20T12:33:26Z")

</div>

BAQ Execution

17/04/2020 - execution circa 3,000ms  
20/04/2020 - no execution - same query - no changes - timeout error  
20/04/2020 - an And has been added (by the system) to Joins as the first Table Relation on all Joins

 ![image](https://epiusers.help/uploads/default/original/3X/a/b/ab6b909645dc6cbf186eaa709324d503c0990c38.png)  
I have now changed to  
 ![image](https://epiusers.help/uploads/default/original/3X/3/d/3d7c6fee37e640f88305e089d532dee8004c8daf.png)  
20/04/2020 - manual removal of all the And Table Relations that have been added by the system  
20/04/2020 - execution circa 220,000ms  
20/04/2020 - execution circa 36,000ms - add Company = BAQ CurrentCompany constant to Table 1

This is very strange behavior - has anyone seen this before?

---

<div class="post-metadata">

**Author:** ![rppmorris](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@rppmorris](https://www.epiusers.help/u/rppmorris)\
**Post date:** [April 20, 2020, 12:39pm UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/3 "2020-04-20T12:39:51Z")

</div>

BAQ Execution

20/04/2020 - execution circa 20,000ms - no changes

---

<div class="post-metadata">

**Author:** ![rppmorris](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@rppmorris](https://www.epiusers.help/u/rppmorris)\
**Post date:** [April 20, 2020, 12:54pm UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/4 "2020-04-20T12:54:04Z")

</div>

BAQ Execution

20/04/2020 - execution circa 72,000ms - no changes

---

<div class="post-metadata">

**Author:** ![Olga](https://www.epiusers.help/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://www.epiusers.help/u/Olga)\
**Post date:** [April 20, 2020, 2:26pm UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/5 "2020-04-20T14:26:20Z")

</div>

The error in the first message means that you need to click Test button in the query designer first, and then look at the query execution plan.

If it still does not work, use SQL profiler to capture your query and then run it in SSMS to look at execution plan.

---

<div class="post-metadata">

**Author:** ![rppmorris](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@rppmorris](https://www.epiusers.help/u/rppmorris)\
**Post date:** [April 20, 2020, 3:56pm UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/6 "2020-04-20T15:56:39Z")

</div>

Thanks Olga.  
I’ve hit Analyze - then Test but still no Query Execution Plan.  
I’ll try through the SQL Profiler.

---

<div class="post-metadata">

**Author:** ![Randy](https://www.epiusers.help/user_avatar/www.epiusers.help/randy/32/51539_2.png) [@Randy](https://www.epiusers.help/u/Randy)\
**Post date:** [April 20, 2020, 4:15pm UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/7 "2020-04-20T16:15:56Z")

</div>

Agreed with @Olga, you need to Test the BAQ once you get the data grid to load then you can export the SQL Execution Plan and open it up in SSMS to see the results.

---

<div class="post-metadata">

**Author:** ![Olga](https://www.epiusers.help/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://www.epiusers.help/u/Olga)\
**Post date:** [April 20, 2020, 4:35pm UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/8 "2020-04-20T16:35:34Z")

</div>

hit Test, not Analyze

---

<div class="post-metadata">

**Author:** ![rppmorris](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@rppmorris](https://www.epiusers.help/u/rppmorris)\
**Post date:** [April 21, 2020, 7:11am UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/9 "2020-04-21T07:11:51Z")

</div>

Hi Olga,

I have hit Test - still produces the same error.  
Not sure what might be causing this?  
Roberto.

---

<div class="post-metadata">

**Author:** ![Olga](https://www.epiusers.help/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://www.epiusers.help/u/Olga)\
**Post date:** [April 21, 2020, 2:03pm UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/10 "2020-04-21T14:03:26Z")

</div>

i am not sure either… What SQL server version do you use?

---

<div class="post-metadata">

**Author:** ![rppmorris](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@rppmorris](https://www.epiusers.help/u/rppmorris)\
**Post date:** [April 23, 2020, 9:16am UTC](https://www.epiusers.help/t/baq-query-execution-plan/66482/11 "2020-04-23T09:16:15Z")

</div>

Olga  
We use SQL Server 2018 - v17.9.1  
Roberto
