You are here: Re: Heap table: why 454 rows of two INT columns use 2 data pages? « MsSQL Server « IT news, forums, messages
Re: Heap table: why 454 rows of two INT columns use 2 data pages?

Posted by Erland Sommarskog on 03/02/07 22:26

serge (sergea@nospam.ehmail.com) writes:
> If I entered 454 rows : 454 * 8 = 3,632 bytes
>
> each SQL Page is 8KB = 8 * 1024 bytes
>= 8,192 bytes
>
> a data page header takes the first 96 bytes
> leaving 8096 bytes for data and row offsets.
>
> Each record uses a row offset at the end of the page
> consisting of 2 bytes. 454 * 2 = 908 bytes.
>
> 8096 - 3632 - 908 = 3,556 bytes. Should this be
> free data bytes?

No. You are forgetting that there is fixed overhead of each row of at
least nine bytes. See page 253 in "Inside SQL Server 2000".

454*17 is still only 7718, but I believe that there is some margin
left for the page to grow.

> A uniqueidentifier of 4 bytes gets added when a clustered index
> exists but it is NOT a UNIQUE clustered index. AND only
> if duplicate record is added those two records only get
> a uniqueidentifier value.

Actually it's called a "uniquifier". I like to make this distinction,
since uniqueidentifier is a data type which is 16 bytes wide.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация