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)
v1-0001-pg_visibility-Use-visibilitymap_count-instead-of-.patch
Description: Binary data
