Bit data type header reduction in some cases - Mailing list pgsql-hackers

From Haribabu Kommi
Subject Bit data type header reduction in some cases
Date
Msg-id CAJrrPGc9CbOdHN6gs_e-XnJBaNLued--8XxWB7PpOCwCC9938Q@mail.gmail.com
Whole thread Raw
Responses Re: Bit data type header reduction in some cases  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
Hi,

It's regarding a Todo item of "Bit data type header reduction" in some cases. The header contains two parts. 1)  The varlena header is automatically converted to 1 byte header from 4 bytes in case of small data. 2) The bit length header called "bit_len" to store the actual bit length which is of 4 bytes in size. I want to reduce this bit_len size to 1 byte in some cases as similar to varlena header. With this change the size of the column reduced by 3 bytes, thus shows very good decrease in disk usage.

I am planning to the change it based on the total length of bits data. If the number of bits is less than 0x7F then one byte header can be chosen instead of 4 byte header. During reading of the data, the similar way it can be calculated.

The problem I am thinking is, as it can cause problems to old databases having bit columns when they
upgrade to a newer version without using pg_dumpall. Is there anyway to handle this problem? Or Is there any better way to handle the problem itself? please let me know your suggestions.

Regards,
Hari Babu
Fujitsu Australia

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Dump pageinspect to 1.2: page_header with pg_lsn datatype
Next
From: Heikki Linnakangas
Date:
Subject: Re: Bit data type header reduction in some cases