SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

A Minor Rant About Statistics

If you've ever taken a look at the auto generated statistics that SQL builds (typically on non indexed columns when you reference the column in a where clause) you'll see that they are named _WA_Sys...blahblah. But why? A quick search didn't reveal any good answer (though perhaps I just didn't ask the right question) and in practice why do we care? We never reference the statistics by name unless we're really deep into a problem.

My reason for ranting is based on an event earlier this week. I was doing an adhoc demo to show a new statistic being created via autocreate when I referenced a non-indexed column. It worked fine, but I wanted to show the result - which meant opening up 5 or so wrong ones before I got the right one. Given that the auto created ones are usually (always?) on a single column, would it hurt to name the statistic something more useful - like the column name? So while I'm complaining, why is it that I can view the statistics (same as dbcc showstatistics) via the properties for stats on indexes, but not for 'plain' stats?

Maybe there's a good reason.

SQLAndy

I'm Andy Warren, currently a SQL Server trainer with End to End Training. Over the past few years I've been a developer, DBA, and IT Director. I was one of the original founders of SQLServerCentral.com and helped grow that community from zero to about 300k members before deciding to move on to other ventures.

Comments

No comments.

Leave a Comment

Please register or log in to leave a comment.