Re: BTScanOpaqueData size slows down tests

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: BTScanOpaqueData size slows down tests
Date: 2025-04-02 16:43:11
Message-ID: 202504021643.q6tn6hddwknh@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Apr-02, Peter Geoghegan wrote:

> On Wed, Apr 2, 2025 at 12:31 PM Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> > The mentioned commit (09cb5c0e7d6f) shows that we do partial memcpys, e.g.
> >
> > + memcpy(&so->markPos, &so->currPos,
> > + offsetof(BTScanPosData, items[1]) +
> > + so->currPos.lastItem * sizeof(BTScanPosItem));
> >
> > That would obviously not work if this field weren't last. We still do
> > that, don't we? See btrestrpos().
>
> Yes, we do -- but it's rare. It only happens in the case where we
> restore a mark after leaving the page where the mark was taken. In
> practice, merge joins tend to hardly ever do that (I know this because
> it makes testing annoyingly difficult). In other words, the
> optimization added by commit 08ae5edc5c seems to be very effective in
> practice.

I'm just saying that this is the reason to have the field be last in the
struct.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"La rebeldía es la virtud original del hombre" (Arthur Schopenhauer)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-04-02 16:43:46 Re: Parallel CREATE INDEX for GIN indexes
Previous Message Andres Freund 2025-04-02 16:42:01 Re: Statistics Import and Export