Re: Vectorize pg_visibility.pg_visibility_map_summary
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Nathan Bossart <nathandbossart@gmail.com>,
Ants Aasma <ants.aasma@cybertec.at>
Date: 2025-12-22T22:04:05Z
Lists: pgsql-hackers
Hi, On Mon, Dec 22, 2025 at 1:28 PM Matthias van de Meent <boekewurm+postgres@gmail.com> wrote: > > Hi, > > Whilst working on fixing a bug in GiST and SP-GiST's index-only scan > systems, I noticed that pg_visibility is sometimes rather wasteful > with the APIs which it calls into; especially now that there are more > optimized APIs available. > > Here's one small patch that makes it use the visibilitymap_count() API > for pg_visibility_map_summary(), replacing its own bespoke counting > mechanism with the primary implementation that has vectorized > optimizations, thus reducing the overhead of > pg_visibility_map_summary. > It looks like a reasonable idea as it also simplifies the pg_visibility_map_summary() function. I'm going to push it, barring any objections. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com