From f5024d8d7b04de2f5f4742ab433cc38160354861 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 23 May 2021 12:12:09 -0400 Subject: Re-order pg_attribute columns to eliminate some padding space. Now that attcompression is just a char, there's a lot of wasted padding space after it. Move it into the group of char-wide columns to save a net of 4 bytes per pg_attribute entry. While we're at it, swap the order of attstorage and attalign to make for a more logical grouping of these columns. Also re-order actions in related code to match the new field ordering. This patch also fixes one outright bug: equalTupleDescs() failed to compare attcompression. That could, for example, cause relcache reload to fail to adopt a new value following a change. Michael Paquier and Tom Lane, per a gripe from Andres Freund. Discussion: https://postgr.es/m/20210517204803.iyk5wwvwgtjcmc5w@alap3.anarazel.de --- src/backend/access/spgist/spgutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/access/spgist/spgutils.c') diff --git a/src/backend/access/spgist/spgutils.c b/src/backend/access/spgist/spgutils.c index 8d99c9b7626..9ff280a2526 100644 --- a/src/backend/access/spgist/spgutils.c +++ b/src/backend/access/spgist/spgutils.c @@ -165,8 +165,8 @@ fillTypeDesc(SpGistTypeDesc *desc, Oid type) typtup = (Form_pg_type) GETSTRUCT(tp); desc->attlen = typtup->typlen; desc->attbyval = typtup->typbyval; - desc->attstorage = typtup->typstorage; desc->attalign = typtup->typalign; + desc->attstorage = typtup->typstorage; ReleaseSysCache(tp); } @@ -304,8 +304,8 @@ getSpGistTupleDesc(Relation index, SpGistTypeDesc *keyType) att->attalign = keyType->attalign; att->attstorage = keyType->attstorage; /* We shouldn't need to bother with making these valid: */ - att->attcollation = InvalidOid; att->attcompression = InvalidCompressionMethod; + att->attcollation = InvalidOid; /* In case we changed typlen, we'd better reset following offsets */ for (int i = spgFirstIncludeColumn; i < outTupDesc->natts; i++) TupleDescAttr(outTupDesc, i)->attcacheoff = -1; -- cgit v1.2.3