Re: GUC with units, details - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: GUC with units, details
Date
Msg-id 200607280103.00652.peter_e@gmx.net
Whole thread Raw
In response to Re: GUC with units, details  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: GUC with units, details  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: GUC with units, details  ("Jim C. Nasby" <jnasby@pervasive.com>)
List pgsql-hackers
Tom Lane wrote:
> +1 on both of those.  I think that pg_settings should actually show
> "pages" as the native unit for shared_buffers et al.  The current
> "8kb" display isn't a valid unit --- consider what happens if a
> program does select setting || unit from pg_settings ...

Physicists know that the proper way to do that calculation is
  setting * unit

not
  setting || unit

I was toying for a moment with putting '1' into the column when the 
quantity is dimensionless.  That would have been a fun debate.

I realize that it's not all that consistent or easy to process now.  
Accepting "page" (or "block"?) as a unit might be a reasonable 
addition.  Then again, I'm not sure why anyone would want to do 
setting || unit in the first place, because setting by itself will give 
you the right quantity to feed back into the system.

> Lastly, shouldn't unit read out as null where it's not applicable?
> It looks like it's null in some of the rows but empty string
> elsewhere. That's just weird.

It's null when units do not apply (for booleans, strings for conceptual 
reasons, for reals for implementation reasons), and it's empty when the 
unit is known to be nothing.  I don't contest that that's weird but I 
think it's the proper way to express the information (short of putting 
in '1' again).

(I'm thinking something like a units type that is occasionally discussed 
would be a good addition, so you can do calculations like setting * 
unit.)

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: [tgl@postgresql.org (Tom Lane)] [COMMITTERS] pgsql: Aggregate functions now support multiple input arguments.
Next
From: Tom Lane
Date:
Subject: Do we need multiple forms of the SQL2003 statistics aggregates?