add323da40started updating the visibility map in the same WAL record as pruning and freezing. This included updating the freespace map during replay of a record setting the VM, which we've done sinceab7dbd681.add323da40, however, conditioned doing so on there being > 0 freespace on the page, which differed from the previous state for records updating the VM. The FSM is not WAL-logged and is instead updated heuristically on standbys. In rare cases, this heuristic could lead to pages with 0 freespace having outdated entries in the FSM. If the standby is later promoted and vacuum skips these pages because they are marked all-visible/all-frozen, overly optimistic values would be propagated up the FSM tree, causing slowness when searching for freespace for new tuples. Fix it by always updating the FSM during replay when setting VM bits. Author: Melanie Plageman <melanieplageman@gmail.com> Reported-by: Alexey Makhmutov <a.makhmutov@postgrespro.ru> Discussion: https://postgr.es/m/ead2f110-c736-48f5-99e1-023dc9acbf0b%40postgrespro.ru
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.