In a system there is a nightly data load process where all the foreign keys are dropped, all tables are truncated, repopulated from an external source, and the foreign keys are put back in place.
At the end of this process I would expect sp_updatestats
to run, so that statistics for all this new data is updated.
However, while inspecting the code I noticed the following line instead:
EXEC sp_MSforeachtable 'UPDATE STATISTICS ? WITH FULLSCAN'
Can you compare that with running sp_updatestats
? That is what is the differences and advantages/disadvantages of one over the other?