Wednesday, May 8, 2013

Can I prevent SQL Server from consolidating histogram steps in statistics?

Hello Gert and wBob,


first of all, thanks for sharing the information :) Now concerning your points:


1. As already stated a couple of times in this thread, it’s not Merge Join vs Nested Loops for the DimDate/FactTable query I posted here – both provide similar performance. It’s a cardinality estimate after join, which may be 1, and this results in problem down the road (see my reply to Gert earlier).


2. The filtered stat was actually a (failed) attempt to cure the same problem. You can drop the stat dbo.DimDatum.Stat_DatumID_Latest, and then the problem will arise with some other date.


After I drop the filtered stat in the sample database I get the same problem with the condition


WHERE dd.DatumID >= 2012121000 AND dd.DatumID < 2012121100


3. I’m not quite sure that this could be a SQL Server Bug. I would need some additional info (and time :)) before I file a Connect Ticket, because I just don’t understand the behaviour completely


I would appreciate if you could explain how I could solve the problem without a filtered statistics (which doesn’t solve the problem either)


No comments:

Post a Comment