Re: Boundary value check in lazy_tid_reaped()

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Boundary value check in lazy_tid_reaped()
Date: 2020-08-31 19:21:57
Message-ID: CA+hUKG++PXpa1xqAQJCc0x5Z6L3qjdyTr8B1Rp3Q2cp=NYishA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 30, 2020 at 11:08 PM Masahiko Sawada
<masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:
> So my proposal is to add boundary value check in lazy_tid_reaped()
> before executing bsearch(3). This will help when index vacuum happens
> multiple times or when garbage tuples are concentrated to a narrow
> range.

Makes sense if it's often out of range.

> I thought that we can have a generic function wrapping bsearch(3) that
> does boundary value checks and then does bsearch(3) so that we can use
> it in other similar places as well. But the attached patch doesn't do
> that as I'd like to hear opinions on the proposal first.

I wonder if you would also see a speed-up with a bsearch() replacement
that is inlineable, so it can inline the comparator (instead of
calling it through a function pointer). I wonder if something more
like (lblk << 32 | loff) - (rblk << 32 | roff) would go faster than
the branchy comparator.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Victor Spirin 2020-08-31 19:38:36 Re: Sometimes the output to the stdout in Windows disappears
Previous Message Andres Freund 2020-08-31 18:42:21 Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior