« SQL 2012 Performance Dashboard Reports | Main | SQL Server 2012: Distributed Replay »

Temporary Statistics Objects in SQL Server 2012

Statistics are maintained by SQL Server to estimate cardinality of T-SQL queries which helps in the generation of execution plans. Statistics are metrics that are used by SQL Server to identifying the best approach to execute a particular query and it is created for each table based on the column data types.

 

Whenever the data in a particular table changes, the statistics are automatically updated by SQL Server using the AUTO UPDATE STATISTICS (this can be done manually as well). The problem occurs with read-only databases or database snapshots where no more changes happen and the statistics cannot be updated. This could be an issue since these types of databases are mainly used for analytics purposes and different types of queries will have to be executed at any point. In this case, using the existing statistics may not work and calls for creation of new statistics objects. This is the default behavior in SQL Server 2008 and prior versions and will cause performance bottlenecks.


In SQL Server 2012, a new feature called Temporary Statistics Objects has been introduced to address specifically this type of issue. Using this feature, SQL Server can create statistics for tables in read-only databases or snapshots and these statistics will be saved in the tempdb database. This feature can also be used in the active secondaries while implementing the AlwaysOn feature in SQL Server 2012.


More details on this feature can be found here.

TrackBack

TrackBack URL for this entry:
http://www.infosysblogs.com/apps/mt-tb.cgi/6651

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter