liveBook · Manning

Column offset array

As explained in 100 SQL Server Mistakes and How to Avoid Them

A column offset array is row metadata containing offsets that identify where variable-length column values begin.

A column offset array is row metadata that records where each variable-length column begins. Because those values can have different lengths, the offsets let SQL Server determine where one value ends and the next begins. section 3.2

Each variable-length column requires a 2-byte offset, even when it contains NULL. Consequently, VARCHAR(10) can use 12 bytes when storing ten characters, while CHAR(10) uses 10 bytes in the stated comparison. section 3.2

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Defines the row-storage mechanism and quantifies its 2-byte-per-column cost, without detailing broader record-layout internals.
Examples
Compares CHAR(10) and VARCHAR(10) for a ten-character value, including the offset overhead.
What you can do after
Evaluate storage trade-offs between fixed-length and variable-length columns using offset overhead and actual value length.
How it connects
Connects variable-length columns with fixed-length columns, NULL values, row metadata, and storage space.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.