Updating a table from a join updating net
1) By default, the UPDATE STATISTICS statement updates both index and column statistics.
Using the COLUMNS option of this statement will update column statistics only.
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.
His blog can be found at he can also be reached on twitter at @Benjamin Nevarez.
Run again the query to verify that a new statistics object for the Product ID column has been created.
Notice the value of the auto_created column which tells if the statistics were automatically created by the query processor.
So depending on your maintenance jobs and scripts several scenarios can exist.
The simplest scenario is if you want to rebuild all the indexes and update all the statistics.
Properties class Program Data Adapters and Data Readers Row States and Row Versions Accept Changes and Reject Changes Merging Data Set Contents Retrieving Identity or Autonumber Values ADO.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.Not only you are updating your index statistics twice but you are overwriting the better of the two choices.One of the questions I was asked recently while speaking at the Los Angeles SQL Server Professionals Group and the Orange County SQL Server User Group (*) was regarding the order in which jobs like rebuilding indexes or updating statistics should be executed as part of the database maintenance activities.
In general you should consider the following important points, focusing in the fact that there are two kinds of statistics: index and column statistics.
Benjamin Nevarez is a database professional based in Los Angeles, California who specializes in SQL Server query tuning and optimization.