Hi, I'm working on the pluggable storage patch and zheap at the moment. The latter the latter has no alignment padding for byval attributes - since we copy them anyway - and I was looking which places need to be adjusted for that. That lead me to notice that get_rel_data_width() currently doesn't take alignment padding into account, even for byval or fixed-width datatypes. In a lot of cases that's probably a wash, but it's easy enough to come up with cases where a substantial portion of a row is padding,
It's probably not trivial to do better for all cases, but it woudln't be too hard to estimate padding between some types of columns (say fixed width and byval columns). I'm not planning to work on this anytime soon, but it seems like this is worth fixing at some point. Greetings, Andres Freund