Wednesday, May 8, 2013

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

If you need a work around, then fooling around with the following two things will probably be effective:


1. add dummy rows to DimDatum


2. create filtered stats


When I added one dummy row for each existing row in DimDatum in my repro script, the problem was immediately gone. All you need to add to the repro script is the statement "insert into DimDatum select DatumID+1,null from DimDatum".


I expect that once you have created this situation and you create filtered stats that cover a maximum of 2 x 200 rows (including dummy data), then I expect that are collaped to only half the number of stats entries (200), where each row would cover an actual row and a dummy row. There is a big chance that that will work around your problem.


As for the proof that this is a bug: I think the repro script I posted (based on you description and data) should be sufficient to illustrate and prove the problem.




Gert-Jan


No comments:

Post a Comment