CREATE TABLE dbo.overhead ( myID INT NOT NULL ) ;
CREATE CLUSTERED INDEX CIX_overhead -- not unique!
ON dbo.overhead(myID) ;
INSERT INTO dbo.overhead
( myID )
SELECT 1 ;
SELECT min_record_size_in_bytes ,
max_record_size_in_bytes
FROM sys.dm_db_index_physical_stats(DB_ID(), OBJECT_ID(N'dbo.overhead'),
NULL, NULL, N'SAMPLED') ;
min_record_size_in_bytes max_record_size_in_bytes
------------------------ ------------------------
25 25
It should give 4 bytes as INT record 1 row is inserted, why 25?
当插入INT记录1行时,它应该给4个字节,为什么25?
1 个解决方案
#1
3
- 4 bytes for the record header
- 4 bytes for the int
- 2 bytes for the count of columns in the null-bitmap
- 1 byte for the null bitmap
- 14 bytes versioning tag because you have snapshot isolation enabled (or are using MARS)
记录头的4个字节
int的4个字节
空位图中列数的2个字节
空位图为1个字节
14字节版本标记,因为您启用了快照隔离(或正在使用MARS)
That's 25 bytes in total. There are also 2 additional bytes for the slot pointer at the bottom of the page, but those are not accounted for in the DMV.
这总共是25个字节。页面底部的插槽指针还有2个额外字节,但DMV中不考虑这些字节。
Source: http://www.sqlskills.com/blogs/paul/inside-the-storage-engine-anatomy-of-a-record/
#1
3
- 4 bytes for the record header
- 4 bytes for the int
- 2 bytes for the count of columns in the null-bitmap
- 1 byte for the null bitmap
- 14 bytes versioning tag because you have snapshot isolation enabled (or are using MARS)
记录头的4个字节
int的4个字节
空位图中列数的2个字节
空位图为1个字节
14字节版本标记,因为您启用了快照隔离(或正在使用MARS)
That's 25 bytes in total. There are also 2 additional bytes for the slot pointer at the bottom of the page, but those are not accounted for in the DMV.
这总共是25个字节。页面底部的插槽指针还有2个额外字节,但DMV中不考虑这些字节。
Source: http://www.sqlskills.com/blogs/paul/inside-the-storage-engine-anatomy-of-a-record/