Dominique Devienne <ddevienne@xxxxxxxxx> writes: > On Tue, Oct 18, 2022 at 6:04 PM Tom Lane <tgl@xxxxxxxxxxxxx> wrote: >> Thus, there's always a header to store the actual length. That can >> be either 1 or 4 bytes (I think the doc you are looking at might be >> a little out of date on that point). > Even the doc on v15 (or devel) still says 5-to-8. > https://www.postgresql.org/docs/15/datatype-bit.html Oh, if you're thinking about bit rather than string types, that's correct: in addition to the overall-field-width header (1 or 4 bytes) there's a length-in-bits field (always 4 bytes), then the bits themselves. The overall width is clearly insufficient to know how many bits are valid in the last byte, so some additional storage is necessary. This could have been done in a more compact way no doubt, but we aren't likely to change it now. regards, tom lane