cancel
Showing results for 
Search instead for 
Did you mean: 

Has Create Statistics any effect for varchar columns?

MCMartin
Participant
2,258

In relation to this question: How can I help the optimizer estimating better?

No histogram is returned by the tools for varchar columns. Instead one shall use the Estimate function to check for the selectivity the optimizer is anticipating for a certain value.

Therefore I am wondering if Create Statistics or Drop Statistics will have any effect for varchar columns?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

CREATE and DROP STATISTICS work for string values as well as numeric values. For strings, the histogram "buckets" are really frequent-value statistics, since with strings of arbitrary length there isn't a useful "width" to use as the bucket size, as there are for ordered, numeric domains such as integers.

The reason that a histogram is not returned is that the frequent-value statistics are hashed, and their internal representation isn't convertible into a useful form that would make sense to an application developer.

Answers (0)