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

From Andreas Karlsson
Subject Re: pgstattuple: fix free space calculation
Date
Msg-id 76134d78-1c98-4815-8031-425a8358da84@proxel.se
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 PM, 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.

I think the new behavior is the more useful one since what if someone 
wants to know the free space since they want to insert two tuples and 
not just one? I do not think the function should assume that the only 
reason someone would want to know the size is because they want to 
insert exactly one new tuple.

I am less certain about what the right behavior on pages where we are 
out of line pointers should be but I am leaning towards that the new 
behvior is better than the old but can see a case for either.

Tested the patch and it works as advertised.

Andreas




pgsql-hackers by date:

Previous
From: "bucoo"
Date:
Subject: 答复: optimize hashjoin
Next
From: Peter Eisentraut
Date:
Subject: Re: pg_combinebackup --clone doesn't work