Re: Decoupling our alignment assumptions about int64 and double

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2026-02-01T18:20:27Z
Lists: pgsql-hackers
I wrote:
> Here's a v2 responding to your suggestions.  0001 refactors
> att_align_nominal(), and then 0002 is nearly the same as the
> prior patch except for rebasing over that change.

I did some simple benchmarking and convinced myself that v2-0001
is a measurable win performance-wise even as things stand.
This test case spends nearly all its time in ExecEvalScalarArrayOp,
which has one of the loops improved by v2-0001:

\timing on

do $$
declare a int8[]; i int8 := 1; b bool;
begin
  while i < 10000 loop
    a[i] := i;
    i := i+1;
  end loop;
  for j in 1..10 loop
    for k in 1..10000 loop
      b := (k = any(a));
    end loop;
  end loop;
end $$;

I see about 10% improvement in runtime with 0001 compared to HEAD.
So I'm inclined to go ahead and push that patch, and then return
to considering what we're going to do about int8 vs. double
alignment.

			regards, tom lane



Commits

  1. Cope with AIX's alignment woes by using _Pragma("pack").

  2. Make some minor cleanups in typalign-related code.

  3. Refactor att_align_nominal() to improve performance.