Subscribe to:
Post Comments (Atom)
Popular Posts
Labels
About Me
Best Practices
Career
Data Mining
Documentation
Feature Requests
Humor
MagicPASS
Meme Monday
Mirroring
Parameter Sniffing
PASS
Performance
PowerShell
Presentations
Query Tuning
Recognition
Replication
Scripts
Security
SQL Power Doc
SQL Server 2005
SQL Server 2008
SQLH2
SQLRally
SQLSaturday
SYDI
T-SQL Tuesday
Tips
Troubleshooting
Updates
VirtualBox
Windows
XML
What I'm Saying On Twitter
Copyright © 2015 Kendal Van Dyke. All rights reserved.
Kendal is a database strategist, community advocate, public speaker, and blogger. A practiced IT professional with over 15 years of SQL Server experience, Kendal excels at disaster recovery, high availability planning/implementation, & debugging/troubleshooting mission critical SQL Server environments. Kendal is a Senior Consultant on the Microsoft Premier Developer Support team and President of MagicPASS, the Orlando, FL based chapter of PASS. Before joining Microsoft, Kendal was a SQL Server/Data Platform MVP from 2011-2016.
[About Kendal]
(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9MNPJA4l6-fUucihu7dVXmOnHaSrHG-zuAhn6IXsjHqnZ2RJ4xSd3KNLMkYXnKcrDKORYVXxC1WGsrrt8s5U8k1atkLfg0xnLtZA6RbLt6qhppadMtWFJLRpNgg1zLjyG3qFeokfkc0xs/w139-h140-p/IMG_3503.JPG)
4 comments
Now this is very interesting and not something I had previously considered I must admit.
Out of interest, is this something that you perform quite often as part of say your regular performance tuning effort, such as looking for un-used indexes and the like?
I found a couple of issues with the script.
1) The code returns duplicate DROP statements sometimes. This happens when the statistics is duplicated more than once. (this is not a big deal).
2) The other rare issue deals with dropping some autogenerated statistics, and SQL Server will autogenete it again thereafter.
This occurs when the order of the columns in the underlying index is not the same as the order of the columns in the related index statistics.
I encountered the problem in SQL Server 2005 EE SP3 (e.g table dbo.ExecutionCache in "ReportServerTempDB" SSRS database, index "IX_ExecutionCache").
Thanks for the useful script, one question...
why do you only check sys.stats_columns.stats_column_id = 1?
Jag
Good script. I'm going to update my stats presentation to reference it. Let me know if you make any changes/improvements!
Post a Comment