Re: pgstattuple: fix free space calculation

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgstattuple: fix free space calculation
Date: 2024-08-23 11:11:38
Message-ID: 76134d78-1c98-4815-8031-425a8358da84@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2024-08-23 11:20:06 Re: Use read streams in pg_visibility
Previous Message bucoo 2024-08-23 11:02:22 答复: optimize hashjoin