Understanding the concept of simple row compression in SQL server -


i read row compression feature of sql server reduces space needed store row using bytes required store given value. without compression int column needs 4 bytes. need whole 4 bytes if storing number 1 or 1 million. row compression turned on, sql server looks @ actual value being stored , calculates amount of storage needed.

what don't understand - why 1 , 1mn need full 4 bytes , why other numbers, bigger 1 require lesser memory ?

edit - taken book: delivering business intelligence sql server 2008

row compression reduces space required store row of data. using bytes required store given value. example, without row compression, column of type int occupies 4 bytes. true if storing number 1 or number 1 million. sql server allocates enough space store maximum value possible data type. when row compression turned on, sql server makes smarter space allocations. looks @ actual value being stored given column in given row, , determines storage required represent value. done nearest whole byte. of course, added complexity adds overhead data inserted or updated in table. adds smaller amount of overhead when data retrieved table. in cases, time taken additional processing negligible. in fact, in cases, saving in disk read , disk write time can greater calculation time required data compression.

1 , 1 million examples of values require 4 bytes if row compression off. not mean other numbers require less space.

1 , 1 million picked out examples because 1 small , 1 million big.

an int take 4 bytes regardless of value has if row compression off.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -