PSA: Update your table statistics šŸ˜ 

,

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ā€

Ran Update statistics on those tables with a full table scan, and the BAQ that was taking forever returned in 600msā€¦

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

11 Likes

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

Also if you are using the SQL Server Index and Statistics Maintenance 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.

Hey @jgiese.wci

Weā€™re all still waiting to see if it actually fixed your issue.

@josecgomez

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

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

Cool. Will check the SQL jobs.

1 Like

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?

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)