Re: GUC with units, details

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jim Nasby <jnasby(at)pervasive(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: GUC with units, details
Date: 2006-07-27 23:03:00
Message-ID: 200607280103.00652.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-07-27 23:22:13 Do we need multiple forms of the SQL2003 statistics aggregates?
Previous Message Gregory Stark 2006-07-27 22:54:20 [tgl@postgresql.org (Tom Lane)] [COMMITTERS] pgsql: Aggregate functions now support multiple input arguments.