Re: Use CompactAttribute more often, when possible

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use CompactAttribute more often, when possible
Date: 2025-10-20 10:03:08
Message-ID: CAApHDvoxgdXqrUAM0vH_UWTyNKXwf1Kv4hss-D_Qu+xjZh3T_Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 20 Oct 2025 at 22:33, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> I have removed those ones that you don’t want in v2 diff.

Looks like it's just the rowtypes.c ones that you have that I didn't
list. get_sql_insert() and FreeTupleDesc() were in my reject list.

The extra ones you've found seem to match a similar pattern to other
ones I did reject. The reason I left out the ones that could access
the CompactAttribute in one part of the function, but also *need* to
access the Form_pg_attribute in another part, was that I wasn't
certain it was going to be a win. One way it could be a net loss is
that now you need to load cachelines for both structs. It looks like
your changes to record_cmp(), record_eq() and record_image_eq() might
be more optimal in cases where the record has many dropped columns, as
that would allow us to skip fetching the Form_pg_attribute memory for
dropped columns. IMO, it doesn't seem like a good thing to optimise
for in exchange for additional overhead when there are no or few
dropped columns.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2025-10-20 10:06:54 Re: Optimize SnapBuildPurgeOlderTxn: use in-place compaction instead of temporary array
Previous Message Peter Eisentraut 2025-10-20 09:50:14 formatting.c cleanup