HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Directly acessing the NULL bitmap of a row in SQL Server

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thesqlnullacessingdirectlybitmapserverrow

Problem

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.)

Solution

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.

Context

StackExchange Database Administrators Q#20411, answer score: 7

Revisions (0)

No revisions yet.