开发者

SQL Server 2008, how much space does this occupy?

开发者 https://www.devze.com 2023-02-02 14:40 出处:网络
I am trying to calculate how much space (Mb) this would occupy. In the database ta开发者_开发知识库ble there is 7 bit columns, 2 tiny int and 1 guid.

I am trying to calculate how much space (Mb) this would occupy. In the database ta开发者_开发知识库ble there is 7 bit columns, 2 tiny int and 1 guid.

Trying to calculate the amount that 16 000 rows would occupies.

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

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:

Inside the Storage Engine: Anatomy of a record

Edit:

Your 19 bytes of actual data

  • 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)

  • a few KB for the index structure of the primary

0

精彩评论

暂无评论...
验证码 换一张
取 消