Re: Boundary value check in lazy_tid_reaped()

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Boundary value check in lazy_tid_reaped()
Date: 2021-03-14 23:22:00
Message-ID: CA+hUKGLW_s5KDki8Cg=_LyY3V4JrR2+UkBGv3csaWk6brhP9XQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 9, 2020 at 7:33 AM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> On Tue, Sep 8, 2020 at 1:23 AM Masahiko Sawada
> <masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:
> > > > 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.
> > >
> > > Erm, off course that expression won't work... should be << 16, but
> > > even then it would only work with a bsearch that uses int64_t
> > > comparators, so I take that part back.
> >
> > Yeah, it seems to worth benchmarking the speed-up with an inlining.
> > I'll do some performance tests with/without inlining on top of
> > checking boundary values.
>
> It sounds like Thomas was talking about something like
> itemptr_encode() + itemptr_decode(). In case you didn't know, we
> actually do something like this for the TID tuplesort used for CREATE
> INDEX CONCURRENTLY.

BTW I got around to trying this idea out for a specialised
bsearch_itemptr() using a wide comparator, over here:

https://www.postgresql.org/message-id/CA%2BhUKGKztHEWm676csTFjYzortziWmOcf8HDss2Zr0muZ2xfEg%40mail.gmail.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-03-14 23:33:49 Re: fdatasync performance problem with large number of DB files
Previous Message Avinash Kumar 2021-03-14 23:14:40 Postgres crashes at memcopy() after upgrade to PG 13.