Re: pgstattuple: fix free space calculation - Mailing list pgsql-hackers

From Frédéric Yhuel
Subject Re: pgstattuple: fix free space calculation
Date
Msg-id c55fc210-b356-4569-9dd2-44a370205f17@dalibo.com
Whole thread Raw
In response to Re: pgstattuple: fix free space calculation  (Rafia Sabih <rafia.pghackers@gmail.com>)
List pgsql-hackers

On 8/23/24 12:02, Rafia Sabih wrote:
> On the other hand, this got me thinking about the purpose of this space 
> information.
> If we want to understand that there's still some space for the tuples in 
> a page, then using PageGetExactFreeSpace is not doing justice in case of 
> heap page, because we will not be able to add any more tuples there if 
> there are already MaxHeapTuplesPerPage tuples there.

We won't be able to add, but we will be able to update a tuple in this 
page. It's hard to test, because I can't fit more than 226 tuples on a 
single page, while MaxHeapTuplesPerPage = 291 on my machine :-)

In any case, IMVHO, pgstattuple shouldn't answer to the question "can I 
add more tuples?". The goal is for educational, introspection or 
debugging purposes, and we want the exact amount of free space.

Best regards,
Frédéric



pgsql-hackers by date:

Previous
From: Rafia Sabih
Date:
Subject: Re: Trim the heap free memory
Next
From: "bucoo"
Date:
Subject: 答复: optimize hashjoin