Re: [PATCH] expand the units that pg_size_pretty supports on output

Поиск
Список
Период
Сортировка
От Isaac Morland
Тема Re: [PATCH] expand the units that pg_size_pretty supports on output
Дата
Msg-id CAMsGm5dWwX7+rZN4hyYcYJpDgSCDCNV0vaFRASyGwXgrq0mXgg@mail.gmail.com
обсуждение исходный текст
Ответ на RE: [PATCH] expand the units that pg_size_pretty supports on output  (<Shinya11.Kato@nttdata.com>)
Ответы Re: [PATCH] expand the units that pg_size_pretty supports on output  (David Christensen <david.christensen@crunchydata.com>)
Список pgsql-hackers
On Tue, 15 Jun 2021 at 05:24, <Shinya11.Kato@nttdata.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.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: [PATCH] expand the units that pg_size_pretty supports on output
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints