Re: No, pg_size_pretty(numeric) was not such a hot idea

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: No, pg_size_pretty(numeric) was not such a hot idea
Date: 2012-05-27 13:45:54
Message-ID: CAHGQGwEs-E4_Esse2nzYPuHjMO+9XG_BDA=jpGOBDdYjcfgdvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, May 27, 2012 at 1:33 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
>> On Sat, May 26, 2012 at 9:30 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> The argument for adding pg_size_pretty(numeric) was pretty darn thin in
>>> the first place, IMHO; it does not seem to me that it justified this
>>> loss of usability.
>
>> Ouch! But removing pg_size_pretty(numeric) causes another usability
>> issue, e.g., pg_size_pretty(pg_xlog_location_diff(...)) fails. So how about
>> removing pg_size_pretty(bigint) to resolve those two issues?
>> I guess pg_size_pretty(numeric) is a bit slower than bigint version, but
>> I don't think that such a bit slowdown of pg_size_pretty() becomes
>> a matter practically. No?
>
> AFAICS that argument is based on wishful thinking, not evidence.
>
> I did some simple measurements and determined that at least on my
> development machine, pg_size_pretty(numeric) is about a factor of four
> slower than pg_size_pretty(bigint) --- and that's just counting the
> function itself, not any added coercion-to-numeric processing.  Now
> maybe you could argue that it's never going to be used in a context
> where anyone cares about its performance at all, but I've got doubts
> about that.

OK, let me propose another approach: add pg_size_pretty(int).
If we do this, all usability and performance problems will be solved.
Thought?

Attached patch adds pg_size_pretty(int).

Regards,

--
Fujii Masao

Attachment Content-Type Size
size_pretty_int4_v1.patch application/octet-stream 3.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2012-05-27 14:32:01 Re: pg_upgrade libraries check
Previous Message Pavel Stehule 2012-05-27 13:16:28 Re: VIP: new format for psql - shell - simple using psql in shell