SQL Server 2008,这个占用了多少空间? [英] SQL Server 2008, how much space does this occupy?
问题描述
我想计算这将占用多少空间(Mb)。在数据库表中有7位列,2个微小的int和1个guid。
I am trying to calculate how much space (Mb) this would occupy. In the database table there is 7 bit columns, 2 tiny int and 1 guid.
尝试计算16 000行占用的数量。
Trying to calculate the amount that 16 000 rows would occupies.
我的想法是,7位列消耗1个字节,2个微小的int消耗2个字节,一个guid消耗16个字节。共有19byte的表中的一行?这将意味着304000字节为16 000行或〜0.3mbs我们纠正?是否还有元数据字节?
My line of thought was that 7 bit columns consume 1 byte, 2 tiny ints consumes 2 bytes and a guid consumes 16 bytes. Total of 19byte for one row in the table? That would mean 304000 bytes for 16 000 rows or ~0.3mbs us that correct? Is there a meta data byte as well?
推荐答案
There are several estimators out there which take away the donkey work
您必须考虑Null位图,在这种情况下为3个字节+每页行数+行标题+行版本+指针+这里的所有东西:
You have to take into account the Null bitmap which will be 3 bytes in this case + number of rows per page + row header + row version + pointers + all the stuff here:
编辑:
您的19个字节的实际数据
Your 19 bytes of actual data
- 有11个字节的开销
- 每行共30个字节
- 需要60页(16000/269)
- x 8192)
< <>每页约269行(8096/30)
- has 11 bytes overhead
- total 30 bytes per row
- around 269 rows per page (8096 / 30)
- requires 60 pages (16000 / 269)
around 490k space (60 x 8192)
这篇关于SQL Server 2008,这个占用了多少空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!