Re: Decoupling our alignment assumptions about int64 and double - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Decoupling our alignment assumptions about int64 and double
Date
Msg-id 6bfhumdtwrizt7iuujtgb7u2qdmyplhabg3glcvobw5vf7zst4@rrzhuxlrfojr
Whole thread Raw
In response to Decoupling our alignment assumptions about int64 and double  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Decoupling our alignment assumptions about int64 and double
List pgsql-hackers
Hi,

Thanks for the patch.  Looks like a decent improvement.


On 2026-01-28 20:20:24 -0500, Tom Lane wrote:
> One of the concerns that prevented this from being done long
> ago was not wanting to add overhead to tuple forming/deforming.
> However that concern seems gone now, because we map TYPALIGN_xxx
> values to numeric alignments in populate_compact_attribute()
> which is not so performance-critical.  It might be worth
> worrying about the increased cost of att_align_nominal(),
> but that macro is not that heavily used IMO.

Yea, it shouldn't matter too much these days.  We might want to verify that
the array code isn't overly affected, e.g. array_iter_next() was deemed perf
critical enough by someone to make it an inline function. I don't know if the
compiler is somehow smart enough to move the conditionals outside of a loop
over array_iter_next().

Perhaps we should make att_align_nominal() first determine the numerical
alignment value and then have it use TYPEALIGN()? I think that'd be more
likely to be pulled out of loops by the compile.


Perhaps it's time to reformat att_align_nominal() into an static inline? It's
pretty hard to read.


I don't love the 'l' for TYPALIGN_INT64, but I guess I don't really have a
better suggestion.


It wouldn't hurt to have a short SQL level test for creating a type with int8
& max alignments.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Gilles Darold
Date:
Subject: Re: Pasword expiration warning
Next
From: Tom Lane
Date:
Subject: Re: getting "shell command argument contains a newline or carriage return:" error with pg_dumpall when db name have new line in double quote