Updating in sql
Here’s what the statistics look like on the table in Object Explorer. If you want to verify which column is in each auto-created statistic, you can do that with this query: SELECT s.name, s.auto_created, s.user_created, as colname FROM sys.stats AS s JOIN sys.stats_columns as sc on s.stats_id=sc.stats_id and s.object_id=sc.object_id JOIN sys.columns as c on sc.object_id=c.object_id and sc.column_id=c.column_id WHERE s.object_id=OBJECT_ID('agg.First Name By Year') and s.auto_created = 1 ORDER BY sc.stats_column_id; GO Sure enough, here are our statistics, and they are on Gender and First Name Id.
Trace Flag 7471 is a global trace flag released in SQL Server 2014 SP1 Cumulative Update 6.Download the video in WMV format or MOV format to watch. If I had a really good reason to run concurrent statistics updates against one table after exhausting other options to avoid the maintenance, I’d consider using this.I’d also only turn it on for that specific maintenance window, and turn it off afterward.This trace flag changes the locking behavior associated with updating statistics.With the trace flag on, if you set up jobs to concurrently update statistics on the same table, they won’t block each other on metadata related to statistics updates.