Re: PATCH: Attempt to make dbsize a bit more consistent

From: gkokolatos(at)pm(dot)me
To: John Naylor <john(dot)naylor(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PATCH: Attempt to make dbsize a bit more consistent
Date: 2020-09-09 07:36:21
Message-ID: KF1GPv2HZDuSVQwVqGtDDGeQDxoeQu4o9Rri-DTFRuLpXGvJ1KynI0iW2eNgsKh6xy-Q37K6ID8VL2hc4HqkG9D1PQ7G1-9fSWxMqrrW_EM=@pm.me
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, 8 September 2020 16:49, John Naylor <john(dot)naylor(at)2ndquadrant(dot)com> wrote:

> On Thu, Aug 27, 2020 at 9:39 AM gkokolatos(at)pm(dot)me wrote:
>
> > Hi all,
> > this minor patch is attempting to force the use of the tableam api in dbsize where ever it is required.
> > Apparently something similar was introduced for toast relations only. Intuitively it seems that the distinction between a table and a toast table is not needed.
>
> I suspect the reason is found in the comment for table_block_relation_size():
>
> - If a table AM uses the various relation forks as the sole place where data
> - is stored, and if it uses them in the expected manner (e.g. the actual data
> - is in the main fork rather than some other), it can use this implementation
> - of the relation_size callback rather than implementing its own.

Thank you for your answer and interest at the patch.

I agree with the comment above. However I do not see why it is relevant here. When issuing:

SELECT pg_table_size('foo'::regclass);

I should not have to care about the on disk layout of the relation 'foo'.
Without this patch, one will get a correct result only when 'foo' is a heap table.
For custom layouts the result can potentially be wrong.

>
> --
> John Naylor https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message gkokolatos 2020-09-09 07:41:17 Re: PATCH: Attempt to make dbsize a bit more consistent
Previous Message Amit Kapila 2020-09-09 07:11:23 Re: Inconsistency in determining the timestamp of the db statfile.