8078 bytes in 8060 B datapage (SQL Server)?

Everywhere they write that data in SQL Server is written on pages 8K (8192 B) each with 8060 bytes for data, and the rest are service (system information).

Although in a recent article [1] there is an example code that illustrates, as I understand it, 8078 bytes of data that fit into the page.

What am I missing in understanding 8,060 B per page?

I checked the code on x86 SQL Server 2008 R2 ...




Update:

I saw an answer telling about the next steps in [1]? I'm sorry that I did not mark this as useful (for me) and comment right away ... I just wanted to examine myself more before replying ...




Update 2:

I posted a subquery [2]

[one]
How can table design affect SQL Server performance?
http://sqlserver-training.com/how-table-design-can-impact-your-sql-server-performance/-

[2]
How to get to the limits of 8060 bytes per line and 8000 bytes (varchar, nvarchar)?
How do you reach the limits of 8060 bytes per line and 8000 per (varchar, nvarchar) value?

+4
sql-server tsql data-structures sql-server-2008 data-storage
Sep 23 '10 at 13:16
source share
2 answers

The long answer is short, the limit is 8060 bytes per line, but 8096 bytes per page. The lines in the article you linked have a line size of ~ 4000 bytes, so they are under the line limit. However, this does not answer the question of how many such lines fit on the page.

See "Heap Sizing" in the online documentation:

http://msdn.microsoft.com/en-us/library/ms189124.aspx

If you perform the calculations for the tables in this article, you will see that the first table has a physical row size of 4048 bytes, which is half the 8096 page limit.

+4
Sep 23 '10 at 13:46
source share
  • The maximum row size is 8060 bytes.
  • In this case, there are two lines of 4039 bytes
+2
Sep 23 '10 at 13:48
source share



All Articles