Re: Explain buffers display units.

Greg Smith <greg@2ndquadrant.com>

From: Greg Smith <greg@2ndquadrant.com>
To: Greg Stark <stark@mit.edu>
Cc: Robert Haas <robertmhaas@gmail.com>, "<pgsql-hackers@postgresql.org>" <pgsql-hackers@postgresql.org>
Date: 2010-02-15T17:55:20Z
Lists: pgsql-hackers
Greg Stark wrote:
> We can always continue tweak the details of the format such as adding
> spaces before the units to make it similar to the pg_size_pretty().
> I'm not sure I like the idea of making it exactly equivalent because
> pg_size_pretty() doesn't print any decimals so it's pretty imprecise
> for smaller values.
>   

That's a reasonable position; I'd be fine with upgrading the 
requirements for a text scraping app to handle either "8 kB" or "1.356 
kB" if it wanted to share some code to consume either type of info, if 
all you did was throw a space in there.  I'd suggest either removing the 
PB units support from your implementation, or adding it to 
pg_size_pretty, just to keep those two routines more like one another in 
terms of what they might produce as output given the same scale of input.

Also, a quick comment in the new code explaining what you just said 
above might be helpful, just to preempt a similar "how is this different 
from pg_size_pretty?" question from popping up again one day.

-- 
Greg Smith  2ndQuadrant US  Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com   www.2ndQuadrant.us