# PSA: Update your table statistics 😠

**URL:** <https://www.epiusers.help/t/psa-update-your-table-statistics/69856>\
**Category:** Epicor ERP 10\
**Tags:** baq, sql\
**Created:** [August 11, 2020, 4:49pm UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856 "2020-08-11T16:49:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![josecgomez](https://www.epiusers.help/user_avatar/www.epiusers.help/josecgomez/32/55731_2.png) [@josecgomez](https://www.epiusers.help/u/josecgomez)\
**Post date:** [August 11, 2020, 4:49pm UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/1 "2020-08-11T16:49:50Z")

</div>

This is something that should be part of your SQL maintenance already, but if it isn’t please do yourself a favor and update statistics on your Db at least once or twice a month (more often if you have a really heavy usage)

We just spent 2 hours chasing an incredibly slow BAQ which was returning \< 300 records and taking an inordinate amount of time to run.

We were using a new UD table for the first time in this BAQ and after much todo, we neded up generating an execution plan for our BAQ using SQL Server Profiler

This yielded a clean execution plan however a “few” warnings we noted on there said “Warning Columns with No Statistics”

 ![image](https://www.epiusers.help/uploads/default/original/3X/3/3/33b4f60a1f5eec3f87899d966a2566547e6f1a0f.png)

Ran Update statistics on those tables with a full table scan, and the BAQ that was taking forever returned in 600ms…  
 ![](https://media3.giphy.com/media/xT0xeJpnrWC4XWblEk/giphy-downsized-large.gif)

Don’t mind me, I’m gonna go sit and rock in the corner… cause that’s several hours of me and @Banderson’s life we won’t get back… SIGH

---

<div class="post-metadata">

**Author:** ![kylepbsps](https://www.epiusers.help/user_avatar/www.epiusers.help/kylepbsps/32/30579_2.png) [@kylepbsps](https://www.epiusers.help/u/kylepbsps)\
**Post date:** [August 12, 2020, 1:22pm UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/2 "2020-08-12T13:22:42Z")

</div>

Do you have a tutorial on this? I’m doing some googling but I’m not sure I really understand what im doing.

---

<div class="post-metadata">

**Author:** ![jgiese.wci](https://www.epiusers.help/user_avatar/www.epiusers.help/jgiese.wci/32/51553_2.png) [@jgiese.wci](https://www.epiusers.help/u/jgiese.wci)\
**Post date:** [August 12, 2020, 2:54pm UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/3 "2020-08-12T14:54:44Z")

</div>

Also if you are using the [SQL Server Index and Statistics Maintenance](https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html) scripts it may not be doing a full scan. I assumed these are updating my statistics, but i’m having the slow BAQ issues too. Still need to determine if running it manually fixes that.

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [August 12, 2020, 9:28pm UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/4 "2020-08-12T21:28:28Z")

</div>

Hey @jgiese.wci

We’re all still waiting to see if it actually fixed your issue.

![](https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExYmU3OWJjZDljZmI1NDhmMWMxMTMwNzEzZWU2Mzg0OGZjNTBkNzRhNSZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc/jqScOnk9Dqk7ILU4kF/giphy.gif "Tick Tock GIF by memecandy - Find & Share on GIPHY")

---

<div class="post-metadata">

**Author:** ![Arul](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/b2d939/32.png) [@Arul](https://www.epiusers.help/u/Arul)\
**Post date:** [August 12, 2020, 11:39pm UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/5 "2020-08-12T23:39:36Z")

</div>

@josecgomez

If you run PDT, it shows the required SQL setting. This is part of that.

 ![image](https://www.epiusers.help/uploads/default/original/3X/f/3/f3f88024376abf90ace236dcce9664bdc70eb421.png)

---

<div class="post-metadata">

**Author:** ![josecgomez](https://www.epiusers.help/user_avatar/www.epiusers.help/josecgomez/32/55731_2.png) [@josecgomez](https://www.epiusers.help/u/josecgomez)\
**Post date:** [August 12, 2020, 11:40pm UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/6 "2020-08-12T23:40:54Z")

</div>

Interesting, however in my experience

The Table stats are not covered by pdt at least not in any reasonable way

You have to have a job to update it’s maybe it’s not frequent enough

I had the issue until I manually updated the table stats and I have 100% pass on pdt

So something is a miss somewhere

---

<div class="post-metadata">

**Author:** ![Arul](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/b2d939/32.png) [@Arul](https://www.epiusers.help/u/Arul)\
**Post date:** [August 12, 2020, 11:45pm UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/7 "2020-08-12T23:45:44Z")

</div>

Cool. Will check the SQL jobs.

---

<div class="post-metadata">

**Author:** ![enbw](https://www.epiusers.help/letter_avatar_proxy/v4/letter/e/ce73a5/32.png) [@enbw](https://www.epiusers.help/u/enbw)\
**Post date:** [August 13, 2020, 6:03am UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/8 "2020-08-13T06:03:58Z")

</div>

Hi, out of interest what sql version are you running and how many rows are in the ud table. Did you have chance to run the sql query direct?

---

<div class="post-metadata">

**Author:** ![josecgomez](https://www.epiusers.help/user_avatar/www.epiusers.help/josecgomez/32/55731_2.png) [@josecgomez](https://www.epiusers.help/u/josecgomez)\
**Post date:** [August 13, 2020, 10:12am UTC](https://www.epiusers.help/t/psa-update-your-table-statistics/69856/9 "2020-08-13T10:12:35Z")

</div>

There were only 300 rows in the UD table  
And I did run the query manually and it did take forever until we updated statistics  
( I ran the same exact query as Epicor by capturing the query run using sql profiler)

When I say forever I mean 25 seconds for a 300 row table

After stats update it ran in less than 1 second (registered as 0 in Mssql studio)
