Vectorize pg_visibility.pg_visibility_map_summary
Matthias van de Meent <boekewurm+postgres@gmail.com>
From: Matthias van de Meent <boekewurm+postgres@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Nathan Bossart <nathandbossart@gmail.com>,
Ants Aasma <ants.aasma@cybertec.at>
Date: 2025-12-22T21:28:09Z
Lists: pgsql-hackers
Attachments
- v1-0001-pg_visibility-Use-visibilitymap_count-instead-of-.patch (application/octet-stream)
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. CC-ed to authors of 41c51f0c68, visibilitymap_count was optimized, and this potential user wasn't notified of that. Kind regards, Matthias van de Meent Databricks (https://www.databricks.com)