Re: Is heap_page_prune() stats collector accounting wrong?

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Is heap_page_prune() stats collector accounting wrong?
Date: 2021-11-12 20:42:24
Message-ID: CAH2-WzmQmLn4=Lau7S3HkLAU6ZEUWmQceRqyKQq33O58BK4Z3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 12, 2021 at 11:29 AM Peter Geoghegan <pg(at)bowt(dot)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 Content-Type Size
v1-0001-Clear-up-ndeleted-pgstats-accounting.patch application/octet-stream 4.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-11-12 20:43:17 Re: simplifying foreign key/RI checks
Previous Message Joshua Brindle 2021-11-12 20:33:02 Re: [PATCH v2] use has_privs_for_role for predefined roles