6 ms·
Alignment padding is added in front of an attribute to get the attribute offset to a multiple of the alignment value - and an attribute must [0] start at the al
by mattashii 4y ago
Alignment padding is added in front of an attribute to get the attribute offset to a multiple of the alignment value - and an attribute must [0] start at the alignment boundary of its type.
E.g. attributes of types (in order) byte, smallint, smallint, int, bigint would have alignment padding of 0 (offset=0), 1 (o = 1 + 1 padding=2), 0 (o=4), 2 (o=6 +2p=8), and 4(o=12+4p=16), respectively, when all those attributes are filled with data.
[0] 'must' is the case most of the time, because variable length attributes have special handling rules when working with alignment of attributes -- but that's not important right now.