Updating x font indexes
He is the author of three books, “High Performance SQL Server”, “SQL Server 2014 Query Tuning & Optimization” and “Inside the SQL Server Query Optimizer” and has also coauthored other books including “SQL Server 2012 Internals”.
Benjamin has also been a speaker at many SQL Server conferences and events around the world including the PASS Summit, SQL Server Connections and SQLBits.
The simplest scenario is if you want to rebuild all the indexes and update all the statistics.
As mentioned before, if you rebuild all your indexes then all the index statistics will also be updated by scanning all the rows on the table.
var microsoft = microsoft
Let me show you how these commands work with some examples using the Adventure Works database. Sales Order Detail Use the previous sys.stats query to verify that two statistics objects were created, one for the Sales Order ID column and another one for the Order Qty column (they both have names starting with _WA_Sys as shown later).
Some other more complicated scenarios include when you have jobs which rebuild your indexes based on their fragmentation level.
Of course, the worst case scenario would be if you first rebuild your indexes, which also updates the index statistics by scanning the entire table, and later you run UPDATE STATISTICS using the default values, which again updates the index statistics but this time only with a default and smaller sample.
Using the COLUMNS option of this statement will update column statistics only.
Using the INDEX option will update index statistics only.
In general you should consider the following important points, focusing in the fact that there are two kinds of statistics: index and column statistics.