From: | Isaac Morland <isaac(dot)morland(at)gmail(dot)com> |
---|---|
To: | Shinya11(dot)Kato(at)nttdata(dot)com |
Cc: | David Christensen <david(dot)christensen(at)crunchydata(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] expand the units that pg_size_pretty supports on output |
Date: | 2021-06-15 13:30:51 |
Message-ID: | CAMsGm5dWwX7+rZN4hyYcYJpDgSCDCNV0vaFRASyGwXgrq0mXgg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 15 Jun 2021 at 05:24, <Shinya11(dot)Kato(at)nttdata(dot)com> wrote:
> >> I don't see the need to extend the unit to YB.
> >> What use case do you have in mind?
> >
> >Practical or no, I saw no reason not to support all defined units. I
> assume we’ll
> >get to a need sooner or later. :)
>
> Thank you for your reply!
> Hmmm, I didn't think YB was necessary, but what do others think?
>
If I’m reading the code correctly, the difference between supporting YB and
not supporting it is whether there is a line for it in the list of prefixes
and their multiples. As such, I don’t see why we’re even discussing whether
or not to include all the standard prefixes. A YB is still an absurd amount
of storage, but that’s not the point; just put all the standard prefixes
and be done with it. If actual code changes were required in the new code
as they are in the old it might be worth discussing.
One question: why is there no “k” in the list of prefixes?
Also: why not have only the prefixes in the array, and use a single fixed
output format "%s %sB" all the time?
It feels like it should be possible to calculate the appropriate idx to use
(while adjusting the number to print as is done now) and then just have one
psprintf call for all cases.
A more significant question is YB vs. YiB. I know there is a long tradition
within computer-related fields of saying that k = 1024, M = 1024^2, etc.,
but we’re not special enough to override the more general principles of SI
(Système International) which provide that k = 1000, M = 1000^2 and so on
universally and provide the alternate prefixes ki, Mi, etc. which use 1024
as the multiple.
So I would suggest either display 2000000 as 2MB or as 1.907MiB.
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2021-06-15 13:31:22 | Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints |
Previous Message | David Rowley | 2021-06-15 13:26:34 | Re: [PATCH] expand the units that pg_size_pretty supports on output |