Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I was reading the question Checking a wide table for nulls and I'm wondering if it's possible to somehow directly access the NULL bitmap of a row to fast check if a row contains NULL values. Would that be a reliable technique?

(From my reading, there might be issues with the newly introduced SPARSE columns since SQL Server 2008, but can't tell for sure.)

share|improve this question
    
As well as sparse columns you would also have to consider dropped and altered columns that have the NULL bit set but which are no longer part of the table. There is no easy way to access this anyway. The only way I know of is DBCC commands. –  Martin Smith Jul 5 '12 at 11:10
add comment

1 Answer 1

up vote 7 down vote accepted

No, there isn't. Besides, this is a very very very misguided effort. Since you've already loaded the page in memory, you have already paid the price for any row and any column on that page. This is a given for any row oriented storage. The price for fetching the page overwhelms the price of looking up values in the page.

If you want to optimize for retrieving the value (including whether it is NULL) for only a specific column then what you are asking for is columnar oriented storage, which is an entirely different game.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.