Re: Why does pg_class.reltuples count only live tuples in indexes (after VACUUM runs)?

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Why does pg_class.reltuples count only live tuples in indexes (after VACUUM runs)?
Date: 2022-04-18 20:12:33
Message-ID: CAH2-Wzm02=sDM=NZYTcUPXQ2s5FxKSyMCOYywCmOdW_oJ6BuUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 18, 2022 at 1:10 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> The places where index AMs refer to num_heap_tuples seem to be using
> it as a ceiling on estimated index tuple counts. Given that we should
> be counting dead index entries, redefining it as you suggest would be
> wrong.

I would argue that it would be correct for the first time -- at least
if we take the behavior within heapam_index_build_range_scan (and
everywhere else) as authoritative. That's a feature, not a bug.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2022-04-18 20:19:31 Re: Postgres perl module namespace
Previous Message Tom Lane 2022-04-18 20:10:44 Re: Why does pg_class.reltuples count only live tuples in indexes (after VACUUM runs)?