pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: John Naylor <john.naylor@enterprisedb.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Yura Sokolov <y.sokolov@postgrespro.ru>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: [PoC] Improve dead tuple storage for lazy vacuum
Date: Wed, 21 Sep 2022 11:01:26 -0700
Message-ID: <20220921180126.GA453160@nathanxps13> (raw)
In-Reply-To: <CAFBsxsGCW=CfgzatJOQ9iuz5UbrMaqPNpP7UZ-ON+2Pgh=zCwg@mail.gmail.com>
References: <CAFBsxsGW_aMSw0Odpd=T1UGRyfX2CdjdVqCNBMik-wfnGC0vAA@mail.gmail.com>
	<CAD21AoAyxDaNrvWwSVfPerQkP034FG0PjYb=7j51QVTiPAtqgQ@mail.gmail.com>
	<CAFBsxsFm1eNPv-_Z2-Gy0aFMMiqgvNym3ojwK0scbEaBbW4FHw@mail.gmail.com>
	<CAD21AoB9M2Faw7K9CLON41iT6eXoC_YwTcKJ1V4Z33J0o0MySg@mail.gmail.com>
	<CAD21AoA4QZ6uTksTzneO7WGXQ-0jnfv=4mGLfgF7V9tdNgV11Q@mail.gmail.com>
	<CAFBsxsFV=-ER1GYzXkBnS68imeoAdAS69vEvMsrVpBhYFNopHg@mail.gmail.com>
	<CAD21AoD3w76wERs_Lq7_uA6+gTaoOERPji+Yz8Ac6aui4JwvTg@mail.gmail.com>
	<CAFBsxsHbvfdMe7qranpiEwaWPwTY97EgM9mXnCEj9gTo6BY=UA@mail.gmail.com>
	<CAD21AoCCQ7T1XNCKtnNe+qiqsdgMsmZsugDpbYQdBVCAi5=zgg@mail.gmail.com>
	<CAFBsxsGCW=CfgzatJOQ9iuz5UbrMaqPNpP7UZ-ON+2Pgh=zCwg@mail.gmail.com>

On Wed, Sep 21, 2022 at 01:17:21PM +0700, John Naylor wrote:
> In trying to wrap the SIMD code behind layers of abstraction, the latest
> patch (and Nathan's cleanup) threw it away in almost all cases. To explain,
> we need to talk about how vectorized code deals with the "tail" that is too
> small for the register:
> 
> 1. Use a one-by-one algorithm, like we do for the pg_lfind* variants.
> 2. Read some junk into the register and mask off false positives from the
> result.
> 
> There are advantages to both depending on the situation.
> 
> Patch v5 and earlier used #2. Patch v6 used #1, so if a node16 has 15
> elements or less, it will iterate over them one-by-one exactly like a
> node4. Only when full with 16 will the vector path be taken. When another
> entry is added, the elements are copied to the next bigger node, so there's
> a *small* window where it's fast.
> 
> In short, this code needs to be lower level so that we still have full
> control while being portable. I will work on this, and also the related
> code for node dispatch.

Is it possible to use approach #2 here, too?  AFAICT space is allocated for
all of the chunks, so there wouldn't be any danger in searching all them
and discarding any results >= node->count.  Granted, we're depending on the
number of chunks always being a multiple of elements-per-vector in order to
avoid the tail path, but that seems like a reasonably safe assumption that
can be covered with comments.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com





view thread (462+ messages)  latest in thread

Message-ID: <20220921180126.GA453160@nathanxps13>
Permalink:  ../20220921180126.GA453160@nathanxps13/
Also on:    postgresql.org/message-id/20220921180126.GA453160@nathanxps13

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, john.naylor@enterprisedb.com, sawada.mshk@gmail.com, andres@anarazel.de, boekewurm+postgres@gmail.com, y.sokolov@postgrespro.ru
  Subject: Re: [PoC] Improve dead tuple storage for lazy vacuum
  In-Reply-To: <20220921180126.GA453160@nathanxps13>
  References: <CAFBsxsGW_aMSw0Odpd=T1UGRyfX2CdjdVqCNBMik-wfnGC0vAA@mail.gmail.com> <CAD21AoAyxDaNrvWwSVfPerQkP034FG0PjYb=7j51QVTiPAtqgQ@mail.gmail.com> <CAFBsxsFm1eNPv-_Z2-Gy0aFMMiqgvNym3ojwK0scbEaBbW4FHw@mail.gmail.com> <CAD21AoB9M2Faw7K9CLON41iT6eXoC_YwTcKJ1V4Z33J0o0MySg@mail.gmail.com> <CAD21AoA4QZ6uTksTzneO7WGXQ-0jnfv=4mGLfgF7V9tdNgV11Q@mail.gmail.com> <CAFBsxsFV=-ER1GYzXkBnS68imeoAdAS69vEvMsrVpBhYFNopHg@mail.gmail.com> <CAD21AoD3w76wERs_Lq7_uA6+gTaoOERPji+Yz8Ac6aui4JwvTg@mail.gmail.com> <CAFBsxsHbvfdMe7qranpiEwaWPwTY97EgM9mXnCEj9gTo6BY=UA@mail.gmail.com> <CAD21AoCCQ7T1XNCKtnNe+qiqsdgMsmZsugDpbYQdBVCAi5=zgg@mail.gmail.com> <CAFBsxsGCW=CfgzatJOQ9iuz5UbrMaqPNpP7UZ-ON+2Pgh=zCwg@mail.gmail.com> <20220921180126.GA453160@nathanxps13>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox