I am considering adding a column to a database table, and that column will be null possibly for most rows however I do want to be able to query on that column for particular non-null values. Therefore an index would help with retrieval time, however if null values are included that would ruin the selectivity of my index.
I have done some reading and I have got the impression that SQL Server doesn't necessarily adhere to standards when it comes to NULL values and indexes, but I can find no explicit statement about the topic in documentation (Index Design Basics, Nonclustered Index Structures and Nonclustered Index Design Guidelines). I also couldn't find a question on SO addressing this particular topic.
Any input (especially with a documentation reference) would be very much appreciated!
Note I am using SQL Server 2008 but if there have been relevant changes between '05 to '12 I'm interested in hearing about that.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…