Re: pgstattuple "unexpected zero page" for gist and hash indexes - Mailing list pgsql-hackers

From Nitin Motiani
Subject Re: pgstattuple "unexpected zero page" for gist and hash indexes
Date
Msg-id CAH5HC94-+FTb1nGpfgSWOfq-bRfZ=1b=NbRuDdcRjForiw2LCQ@mail.gmail.com
Whole thread Raw
In response to Re: pgstattuple "unexpected zero page" for gist and hash indexes  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: pgstattuple "unexpected zero page" for gist and hash indexes
List pgsql-hackers
On Mon, Sep 29, 2025 at 9:03 AM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> I observed that pgstat_btree_page() incorporates the count of new
> pages into its free space calculation[1]. Does it make sense to do the
> same for hash and gist as well as we are leaning towards making these
> consistent.
>
> [1]
> if (PageIsNew(page))
> {
> /* fully empty page */
> stat->free_space += BLCKSZ;
> }
>

Thanks for the feedback. Yes, it makes sense to do the same free space
calculation for the other index types unless there is some special
handling in btree implementation of the free space. From the
pgstattuple code, I don't see any special handling so I have made the
change suggested by you. I'm attaching patch v2 with that change.

Thanks

Attachment

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Skipping schema changes in publication
Next
From: Alena Vinter
Date:
Subject: Re: Resetting recovery target parameters in pg_createsubscriber