mercredi 4 mars 2015

Why wouldn't statistics update if all rows in a table were replaced?


We have several "reporting" tables in a SQL Server 2012 SP1 instance. Every hour, a job runs procedures that delete all the rows from these tables and then insert current data (involving lots of recursion and aggregations) into them. Each contains thousands of rows. Each such table is queried many times per day. The statistics show outrageous things like 94,000% of rows updated, with the last statistics update being several days ago.


I would have thought that the statistics would get updated every time the table was queried for the first time after the contents were last replaced, but that apparently is not happening. Why?





Aucun commentaire:

Enregistrer un commentaire