Re: Add SQL function to show total block numbers in the relation

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: btkimurayuzk(at)oss(dot)nttdata(dot)com
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add SQL function to show total block numbers in the relation
Date: 2019-11-07 09:01:34
Message-ID: 20191107.180134.299430672697753594.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, Kimura-san.

At Thu, 07 Nov 2019 17:04:51 +0900, btkimurayuzk <btkimurayuzk(at)oss(dot)nttdata(dot)com> wrote in
> > btkimurayuzk <btkimurayuzk(at)oss(dot)nttdata(dot)com> writes:
> >> I propose new simple sql query, which shows total block numbers in the
> >> relation.
> >> ...
> >> Of cource, we can know this value such as
> >> select (pg_relation_size('t') /
> >> current_setting('block_size')::bigint)::int;
> > I don't really see why the existing solution isn't sufficient.
>
> I think it's a little difficult to introduce the block size using two
> values `current block size` and `reference size`
> for beginners who are not familiar with the internal structure of
> Postgres,
>
> This is the reason why the existing solution was insufficient.
>
> What do you think?

Sorry, but I also vote -1 for the new function.

Size in block number is useless for those who doesn't understand the
notion of block, or block size. Those who understands the notion
should come up with the simple formula (except the annoying
casts). Anyone can find the clue to the base values by searching the
document in the Web with the keywords "block size" and "relation size"
or even with "table size". (FWIW, I would even do the same for the new
function if any...) If they need it so frequently, a user-defined
function is easily made up.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message btkimurayuzk 2019-11-07 09:09:00 Re: Resume vacuum and autovacuum from interruption and cancellation
Previous Message Fujii Masao 2019-11-07 08:57:09 Re: pgbench - extend initialization phase control