question

MiguelGavinhos-4453 avatar image
0 Votes"
MiguelGavinhos-4453 asked ErlandSommarskog commented

The last statistics update is null, and now?

Why is StatisticsUpdatedate is null? How to fix it ?

The script is :

SELECT *, OBJECT_NAME(object_id) AS [ObjectName]
,[name] AS [StatisticName]
,STATS_DATE([object_id], [stats_id]) AS [StatisticUpdateDate]
FROM sys.stats;

Best regards,
Miguel

sql-server-transact-sql
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MiguelGavinhos-4453 avatar image
0 Votes"
MiguelGavinhos-4453 answered ErlandSommarskog commented

I can observe that user tables without records get StatisticUpdateDate = null, but I have user tables with records that StatisticUpdateDate = null.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

And are these tables being updated? It is not uncommon that you have tables with reference data that are loaded once and never changed. Both Ola's script and sp_updatestats will skip tables where the modification count is 0.

You would also see this pattern on staging tables that are truncated, loaded and then indexed and then not touched until next reload. As I recall TRUNCATE TABLE clears all statistics, so you are essentially starting over.

And again the question is: do you have an actual problem with outdated statistics?

0 Votes 0 ·
TomPhillips-1744 avatar image
0 Votes"
TomPhillips-1744 answered

That is perfectly normal. It just means the stats have not been updated since they were created.

Are you having an issue of some kind?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MiguelGavinhos-4453 avatar image
0 Votes"
MiguelGavinhos-4453 answered ErlandSommarskog commented

It looks by design, and I can see that I have a bunch of user tables with a persistent statistics update date = 'null' that by no method can I get it changed from null to a date. I'm not saying that it is always or never I have no data to support this statement. The methods are https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html and sp_MSforeachdb 'use [?]; exec sp_updatestats'. I'm I missing something?

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is there any data in these tabels?

0 Votes 0 ·

I stated it is by design because databases and tables are regular. You may find the same behavior with your databases. The big question is how to work around it; so far, I have found no method.

0 Votes 0 ·

Workaround for what? Why would it be a problem that the date is NULL?

0 Votes 0 ·