Monday, December 19, 2022

UPDATE STATS WITH FULL SCAN is a must run when u migrate or upgrade SQL SERVER

We had some performance issues after migrating SQL Server from windows server 2012 to windows server 2019 and after analysis, I found that I should do

sp_msforeachtable 'UPDATE STATISTICS? WITH FULLSCAN'

or do individual tables 

This helped....



If you use FULLSCAN, it will read the entire table.

Question: When do you recommend using updated stats with FULLSCAN rather than default sampled?

Answer: When you know there is skew in the column.

Note: Skewed columns are columns in which the data is not evenly distributed among the rows.


Updating statistics ensures that queries compile with up-to-date statistics. Updating statistics via any process may cause query plans to recompile automatically.

No comments:

Post a Comment

https://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context...