Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUW0a-00079Q-Dj for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Aug 2016 09:29:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bUW0Y-0000Wo-UU for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Aug 2016 09:29:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUW0Y-0000Wh-F0 for pgsql-hackers@postgresql.org; Tue, 02 Aug 2016 09:29:06 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUW0V-0006gO-H3 for pgsql-hackers@postgresql.org; Tue, 02 Aug 2016 09:29:06 +0000 Received: from msg.df7cb.de (benz.df7cb.de [IPv6:2001:6f8:10ee:e:134::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 3s3W9T5y83z3DyJ; Tue, 2 Aug 2016 11:29:01 +0200 (CEST) Date: Tue, 2 Aug 2016 11:29:01 +0200 From: Christoph Berg To: Bruce Momjian , Peter Eisentraut Cc: Tom Lane , Greg Stark , "David G. Johnston" , thomas.berger@1und1.de, PostgreSQL-development Subject: Re: pg_size_pretty, SHOW, and spaces Message-ID: <20160802092901.xg5ag7emdxoajhds@msg.df7cb.de> Mail-Followup-To: Christoph Berg , Bruce Momjian , Peter Eisentraut , Tom Lane , Greg Stark , "David G. Johnston" , thomas.berger@1und1.de, PostgreSQL-development MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160801162508.GA28246@momjian.us> User-Agent: Mutt/1.6.2-neo (2016-07-23) X-Pg-Spam-Score: -1.7 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Re: Peter Eisentraut 2016-08-01 > > PostgreSQL uses the spaces inconsistently, though. pg_size_pretty uses spaces: > > > > # select pg_size_pretty((2^20)::bigint); > > pg_size_pretty > > ──────────────── > > 1024 kB > > because it's "pretty" :) :) > > SHOW does not: > > > > # show work_mem; > > work_mem > > ────────── > > 1MB > > The original idea might have been to allow that value to be passed back > into the settings system, without having to quote the space. I'm not > sure, but I think changing that might cause some annoyance. That's a good argument for keeping it that way, yes. Re: Bruce Momjian 2016-08-01 <20160801162508.GA28246@momjian.us> > Looking at the Wikipedia article I posted earlier, that also doesn't use > spaces: > > https://en.wikipedia.org/wiki/Binary_prefix That article has plenty of occurrences of "10 MB" "528 MB/s" and the like. > I think the only argument _for_ spaces is the output of pg_size_pretty() > now looks odd, e.g.: > > 10 | 10 bytes | -10 bytes > 1000 | 1000 bytes | -1000 bytes > 1000000 | 977KB | -977KB > 1000000000 | 954MB | -954MB > 1000000000000 | 931GB | -931GB > 1000000000000000 | 909TB | -909TB > ^^^^^ ^^^^^ > > The issue is that we output "10 bytes", not "10bytes", but for units we > use "977KB". That seems inconsistent, but it is the normal policy > people use. I think this is because "977KB" is really "977K bytes", but > we just append the "B" after the "K" for bevity. It's the other way round: https://en.wikipedia.org/wiki/International_System_of_Units#General_rules | The value of a quantity is written as a number followed by a space | (representing a multiplication sign) and a unit symbol; e.g., 2.21 kg [...] I'd opt to omit the space anywhere where the value is supposed to be fed back into the config (SHOW, --parameters), but use the "pretty" format with space everywhere otherwise (documentation, memory counts in explain output, pg_size_pretty() etc.) Christoph -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers