Re: Is heap_page_prune() stats collector accounting wrong? - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Is heap_page_prune() stats collector accounting wrong?
Date
Msg-id CAH2-WzmQmLn4=Lau7S3HkLAU6ZEUWmQceRqyKQq33O58BK4Z3g@mail.gmail.com
Whole thread Raw
In response to Re: Is heap_page_prune() stats collector accounting wrong?  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
On Fri, Nov 12, 2021 at 11:29 AM Peter Geoghegan <pg@bowt.ie> wrote:
> We compensate here precisely because we are not running in VACUUM (it
> has to be an opportunistic prune in practice).

> If we're not running in VACUUM, and have to make a statistics
> collector call, then we don't want to forget about DEAD tuples that
> were pruned-away (i.e. no longer have tuple storage) when they still
> have an LP_DEAD stub item. There is obviously no justification for
> just ignoring LP_DEAD items there, because we don't know when VACUUM
> is going to run next (since we are not VACUUM).

Attached patch clears this up by adding some comments. It also moves
the call to pgstat_update_heap_dead_tuples() from heap_page_prune() to
heap_page_prune_opt(), which feels like a better place for it to me.

-- 
Peter Geoghegan

Attachment

pgsql-hackers by date:

Previous
From: Joshua Brindle
Date:
Subject: Re: [PATCH v2] use has_privs_for_role for predefined roles
Next
From: Tom Lane
Date:
Subject: Re: simplifying foreign key/RI checks