Ms sql updating statistics

There are different ways you can view the details of the statistics objects.

For example, as shown in the query below, you can use the DBCC SHOW_STATISTICS command.

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.

That is whether such actions are required or not for a specific index, a rebuild of the index and all the locking and churning in the logs occurs.

That is why so many of us "roll our own" index maintenance solutions as it were. Ah, at any rate, by only maintaining indexes that are fragmented, statistics updates do not occur globally against the tables/indexes in your databases. I've touched upon this in an earlier tip, SQL Server's engine will update the statistic when: Based upon this criteria, there will be many cases where the underlying data changes in such a way or in such levels that the statistics that exist for an index will not be indicative of the actual data in the database.

On my test server this code yields the following results.

Statistics refers to the statistical information about the distribution of values in one or more columns of a table or an index.

The SQL Server Query Optimizer uses this statistical information to estimate the cardinality, or number of rows, in the query result to be returned, which enables the SQL Server Query Optimizer to create a high-quality query execution plan.

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.