Re: pgstattuple: fix free space calculation

From: Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>
Cc: Andreas Karlsson <andreas(at)proxel(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgstattuple: fix free space calculation
Date: 2024-09-09 13:49:54
Message-ID: b1d09192-7934-40fb-8221-ef2df42efa45@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/7/24 22:45, Tom Lane wrote:
> I wrote:
>> Now alternatively you could argue that a "new" page isn't usable free
>> space yet and so we should count it as zero, just as we don't count
>> dead tuples as usable free space. You need VACUUM to turn either of
>> those things into real free space. But that'd be a bigger definitional
>> change, and I'm not sure we want it. Thoughts?
>
> On the third hand: the code in question is in statapprox_heap, which
> is presumably meant to deliver numbers comparable to pgstat_heap.
> And pgstat_heap takes no special care for "new" pages, it just applies
> PageGetHeapFreeSpace (or PageGetExactFreeSpace after this patch).
> So that leaves me feeling pretty strongly that this whole stanza
> is wrong and we should just do PageGetExactFreeSpace here.
>

+1

v4 patch attached.

Best regards,
Frédéric

Attachment Content-Type Size
v4-0001-pgstattuple-use-PageGetExactFreeSpace.patch text/x-patch 3.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2024-09-09 13:59:34 Re: Add has_large_object_privilege function
Previous Message Frédéric Yhuel 2024-09-09 13:47:49 Re: pgstattuple: fix free space calculation