Re: pgstattuple: fix free space calculation
Frédéric Yhuel <frederic.yhuel@dalibo.com>
From: Frédéric Yhuel <frederic.yhuel@dalibo.com>
To: Rafia Sabih <rafia.pghackers@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-08-23T10:51:15Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Consistently use PageGetExactFreeSpace() in pgstattuple.
- de239d01e7cc 18.0 landed
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