Does compressing a "byteint not null" column help size or performance at all?

Database
N/A

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 (1)
1 REPLY
Junior Contributor

Re: Does compressing a "byteint not null" column help size or performance at all?

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.