The forum will be unavailable for maintenance at some point from Friday, April 13 at 19:00 EDT until Sunday, April 15 at 23:59 EDT. Downtime will be minimized but the exact timing is unknown.

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?

asked 26 Jul '11, 03:22

Martin's gravatar image

accept rate: 14%

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.

permanent link

answered 26 Jul '11, 12:02

Glenn%20Paulley's gravatar image

Glenn Paulley
accept rate: 43%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 26 Jul '11, 03:22

question was seen: 861 times

last updated: 26 Jul '11, 12:02