Wednesday, May 8, 2013

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

Did you declare a (trusted) foreign key relation from FactTable to DimDatum? Because that will allow the optimizer to apply your date range selection directly to the FactTable (which will probably include assessment of FactTable's statistics).


Without such constraint, the optimizer has no way of knowing whether all DatumIDs in FactTable are present in DimDatum, and it might think that DimDatum represents just a very small subset of all DatumIDs in FactTable (and choose a Loop Join as result).




Gert-Jan


No comments:

Post a Comment