Re: New version of money type

From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, llonergan(at)greenplum(dot)com, sfrost(at)snowman(dot)net, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: New version of money type
Date: 2006-09-28 23:32:11
Message-ID: 20060928233211.GF34238@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 28, 2006 at 05:19:47PM -0400, D'Arcy J.M. Cain wrote:
> On Thu, 28 Sep 2006 22:53:34 +0200
> Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> > Every new type needs to have a well-defined use-case before it can be
> > considered for includion.
>
> Well, it is already included. The current proposal is simply to
> improve the existing type. I guess you are arguing a different
> proposal altogether - to remove the existing type.

The existing type is depricated and has been since at least 8.1; so yes,
it's slated for removal.

> > Currently we have:
> > - Is possibly faster than numeric
>
> I suppose I should quantify this but it's hard to get motivated after
> the many man-hours (mine and my staff) I had to spend on code and
> schema optimizations I needed to do just to get closer to the previous
> speed our aps had before we converted from money to numeric. I will
> try to find time to put together a test that appoximates that real
> world example.
>
> > - Takes less space than numeric
>
> Never really considered this a major improvement over numeric given the
> cost of disk these days. I suppose it could be contributing to the
> speed increase.

Less space == more speed

> > - Customisable output (only one currency at a time though)
> > - Fixed number of decimal places
>
> The original code actually handled number of decimal places. It tended
> to cause problems though. These are areas that the existing type, as
> well as the proposed change, could be worked on. I would hesitate to
> work on both together though and going to 64bit will probably add more
> value right now than those things, certainly for existing users of the
> type.
>
> By the way, the current proposal actually removes the currency symbol
> but I have received complaints about that. It should probably go back
> just because it is outside of the scope of the primary change. That
> can be dealt with later.

Perhaps a good compromise would be to call your type 'USD' or something
similar. I can see where there's use for it, but it seems too limited to
consider it a generic money type.

What would be ideal is a money type that stored what currency was used
and let you change precision (within reason).
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-09-28 23:39:15 Re: Patch: Tie stats options to autovacuum in postgresql.conf
Previous Message Henry B. Hotz 2006-09-28 23:05:59 Re: JAVA Support