I worked on an interesting issue today and the outcome deserves a post. The issue was that when auto update statistics executed the query went from 6 seconds to 6+ minutes. select count(*) from tblImageData where blobData is null Turing on the SP-:StmtStarting and SP:StmtCompleted trace events the internal sample query can be retrieved. SELECT StatMan ( [SC0] ) FROM ( SELECT TOP 100 PERCENT SUBSTRING ( [logo] , 1 , 100 )++ substring ( [blobData] , case when datalength ( [blobData] )<= 200 then 101 else datalength ( [blobData] )- 99 end , datalength ( [blobData] )) AS [SC0] FROM [dbo] .
The rest is here:
How It Works: Statistics Sampling for BLOB data