relpages in pg_class

2022-08-19 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/catalog-pg-class.html
Description:

From source code, the relpage is the number of blocks. But, at the document,
it is written as Size of the on-disk representation of this table in pages
(of size BLCKSZ).


Re: relpages in pg_class

2022-08-19 Thread Bruce Momjian
On Fri, Aug 19, 2022 at 04:10:30AM +, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/14/catalog-pg-class.html
> Description:
> 
> From source code, the relpage is the number of blocks. But, at the document,
> it is written as Size of the on-disk representation of this table in pages
> (of size BLCKSZ).

Well, blocks and pages are the same size, so I don't see the problem.

-- 
  Bruce Momjian  https://momjian.us
  EDB  https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson





Re: relpages in pg_class

2022-08-19 Thread Alvaro Herrera
On 2022-Aug-19, Bruce Momjian wrote:

> On Fri, Aug 19, 2022 at 04:10:30AM +, PG Doc comments form wrote:
> > The following documentation comment has been logged on the website:
> > 
> > Page: https://www.postgresql.org/docs/14/catalog-pg-class.html
> > Description:
> > 
> > From source code, the relpage is the number of blocks. But, at the document,
> > it is written as Size of the on-disk representation of this table in pages
> > (of size BLCKSZ).
> 
> Well, blocks and pages are the same size, so I don't see the problem.

If you think about operating system "blocks" rather than Postgres
"blocks", I can see how this can be interpreted differently.  I'm not
sure if this is a good place to make that distinction, though; I mean,
if we do, how many other places should we patch similarly?

-- 
Álvaro Herrera PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Small aircraft do not crash frequently ... usually only once!"
  (ponder, http://thedailywtf.com/)




Re: relpages in pg_class

2022-08-19 Thread Tom Lane
Alvaro Herrera  writes:
> On 2022-Aug-19, Bruce Momjian wrote:
>> Well, blocks and pages are the same size, so I don't see the problem.

> If you think about operating system "blocks" rather than Postgres
> "blocks", I can see how this can be interpreted differently.  I'm not
> sure if this is a good place to make that distinction, though; I mean,
> if we do, how many other places should we patch similarly?

Yeah, we use "blocks" and "pages" interchangeably, which is something
I don't feel a need to change; but evidently the OP didn't realize that.
This is a job for the glossary, perhaps?

regards, tom lane




Re: relpages in pg_class

2022-08-19 Thread Peter Geoghegan
On Fri, Aug 19, 2022 at 9:40 AM Tom Lane  wrote:
> Yeah, we use "blocks" and "pages" interchangeably, which is something
> I don't feel a need to change; but evidently the OP didn't realize that.
> This is a job for the glossary, perhaps?

I think that they're synonyms that can often (but not always) be used
interchangeably. I *think* that this understanding is shared by other
people, though I should check. Here goes:

To me, "block" emphasizes on-disk/relfilenode storage. Something that
exists at a particular physical offset in a particular file (a
BlockNumber + relfilenode). On the other hand, the term "page"
emphasizes the in-memory format, and the indirection provided by the
bufpage.c slotted page format (i.e. line pointer array indirection).

This line pointer indirection is really central to lots of important
things, including (just for example) our "physiological" approach to
WAL logging -- WAL records describe changes in a way that is physical
to a block, logical within a page. Most users don't need to care about
these distinctions, but hackers might find the nuance of it quite
useful. It bleeds into a lot of things, and is quite easy to take for
granted -- which might actually cost you.

--
Peter Geoghegan




Re: relpages in pg_class

2022-08-19 Thread Bruce Momjian
On Fri, Aug 19, 2022 at 11:25:52AM -0700, Peter Geoghegan wrote:
> On Fri, Aug 19, 2022 at 9:40 AM Tom Lane  wrote:
> > Yeah, we use "blocks" and "pages" interchangeably, which is something
> > I don't feel a need to change; but evidently the OP didn't realize that.
> > This is a job for the glossary, perhaps?
> 
> I think that they're synonyms that can often (but not always) be used
> interchangeably. I *think* that this understanding is shared by other
> people, though I should check. Here goes:
> 
> To me, "block" emphasizes on-disk/relfilenode storage. Something that
> exists at a particular physical offset in a particular file (a
> BlockNumber + relfilenode). On the other hand, the term "page"
> emphasizes the in-memory format, and the indirection provided by the
> bufpage.c slotted page format (i.e. line pointer array indirection).

Yes, I have heard the block-disk, page-memory explanation before.

-- 
  Bruce Momjian  https://momjian.us
  EDB  https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson