Re: GUC with units, details

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, "Bort, Paul" <pbort(at)tmwsystems(dot)com>
Subject: Re: GUC with units, details
Date: 2006-07-26 07:45:38
Message-ID: 1153899938.2592.695.camel@holly
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2006-07-26 at 08:12 +0200, Peter Eisentraut wrote:
> Neil Conway wrote:
> > On Tue, 2006-07-25 at 19:00 -0400, Tom Lane wrote:
> > > Maybe I'm missing something, but I thought it was fairly common to
> > > use "k" for 1000, "K" for 1024, etc (mnemonic: upper case for the
> > > larger multiplier).
> >
> > Well, that only works for K vs. k: the SI prefix for mega is M
> > (meaning 10^6), not "m". Similarly for "G".
>
> Indeed. The k vs K idea is an excuse for not wanting to side with
> either camp, but it does not scale.
>
> > Why it is "impractical" to use the IEC prefixes?
>
> I'd imagine that one of the first things someone will want to try is
> something like SET work_mem TO '10MB', which will fail or misbehave
> because 10000000 bytes do not divide up into chunks of 1024 bytes. Who
> wants to explain to users that they have to write '10MiB'?
>
> Since about forever, PostgreSQL has used kB, MB, GB to describe memory
> allocation. If we want to change that, we ought to do it across the
> board. But that's a big board.

Neil is right: K, M, G are the correct SI terms, however, I don't see
any value in using that here. Nobody is suggesting we encourage or even
allow people to write max_fsm_pages = 10M rather than 10000000, so we
don't ever need to say that K = 1000, AFAICS. I think we are safe to
assume that

kB = KB = kb = Kb = 1024 bytes

mB = MB = mb = Mb = 1024 * 1024 bytes

gB = GB = gb = Gb = 1024 * 1024 * 1024 bytes

There's no value in forcing the use of specific case and it will be just
confusing for people.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jkzhao 2006-07-26 07:49:37 default lower case of identifier
Previous Message Simon Riggs 2006-07-26 07:36:04 Re: Refactoring the API for amgetmulti