All Forums Database
fecund 1 post Joined 04/13
09 Mar 2016
Does compressing a "byteint not null" column help size or performance at all?

I have a large table with some columns that are either 0 or 1, and are defined as "BYTEINT NOT NULL", thus they should be taking up 1 byte per record.
Does it make any sense to add "COMPRESS (0,1)" to the definition- will that save any disk space, or reduce processing time when filtering on those columns? I think it would not, since the datum takes up the same amount of space as the compressed value, but maybe there is something I'm not considering- for example, having the value in the index might help.

Tags:
dnoeth 4628 posts Joined 11/04
11 Mar 2016

There's a lot of details about compression in the Database Design manual, including calculations when it's usefull or not.
 
 
If there are two compress BITs available you will save 6 bits per row, but if you got bad luck and the COMPRESS results in adding a new compress BYTE per row you will need more space than before.
 

Dieter

You must sign in to leave a comment.