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