Search code examples
sql-serverdbccdata-paging

Sql Server page structure. What is Fdata length?


I am trying to understand the structure of the Sql Server data pages. This is the screenshot from the Pro SQL Server Internals by Dmitri Korotkevitch enter image description here I've created 3 tables:

  1. 1 INT Column
  2. 2 INT Columns
  3. 4 INT Columns

All columns are NOT NULL

Then I run

dbcc traceon(3604);
dbcc page
(
'DbName' 
,1 /*File ID*/
,368 /*Page ID*/
,3 /*Output mode: 3 - display page header and row details */
);

and getting following values for Fdata length:

  1. With 1 Column - 0800 = 0008 = 8 = 4 + 1x4
  2. With 2 Columns - 0c00 = 00c0 = 12 = 4 + 2x4
  3. With 4 Columns - 1400 = 0014 = 20 = 4 + 4x4

Here I've listed "value in the output" = "swapped value" = "decimal value"

EDITED: So far as I understand it is Const_4 + Nbr_of_Columns * Size_Of_Columns. What is this Const_4?


Solution

  • "Fdata length" in the picture is the offset where the fixed-length data part of the row ends.

    In your example the data occupie 4, 8 and 16 bytes, and the row starts with another 4 bytes (1+1+2: status bits A, status bits B, Flength), so the "end" (offset) of storing fixed length data is 8, 12 and 20 respectively.