yochananrachamim / AzureSQL

132 stars 61 forks source link

Out of date stats aren't always updated #11

Closed dandenton closed 4 years ago

dandenton commented 4 years ago

Statistics aren't being updated if they belong to an index that wasn't updated. In the section with the comment Remove statistics if it is handled by index rebuild / reorganize the script removes stats that exist in #idxBefore but that includes all indexes, not just the ones that are being rebuilt. It should probably include the same where clause and/or delete records from #idxBefore that aren't being updated.

This was the change we made locally to fix the issue: image

yochananrachamim commented 4 years ago

Fixed.