Ian Jose's WebLog

This weblog is intended to help T-SQL developers get the best performing query plans from SQL Server. Some of the posts describe simple mistakes that can be easily avoided. Other posts describe complex solutions to limitations in SQL Server. Lastly, some posts describe recent improvements in SQL Server, and the means to employ them best.

Regularly Update Statistics for Ascending Keys

Ascending key columns, such as IDENTITY columns or datetime columns representing real-world timestamps, can cause inaccurate statistics in tables with frequent INSERTS because new values all lie outside the histogram.  Consider updating statistics on such columns frequently with a batch job if your application seems to be getting inadequate query plans for queries that have a condition on the ascending key column. How often to run the batch job depends on your application. Consider daily or weekly intervals, or more often if needed for your application. Alternatively, trigger the job based on an application event, such as after a bulk load or after a certain number of INSERT operations.

Published Thursday, November 10, 2005 2:02 PM by ianjo

Comments

 

msdngtnexus said:

Is there anyway to get to the statistics histogram and/or the stats header information without using dbcc show_statistics. I would like to run some queries across all the stats objects in the database?

I looked for some DMVs to do this but couldnt find any.

Thanks.

October 22, 2007 7:17 PM
 

Ian Jose s WebLog Regularly Update Statistics for Ascending Keys | fire pit said:

June 19, 2009 2:01 AM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker