Re: Native type for storing fractions (e.g 1/3)? - Mailing list pgsql-general

From Florian G. Pflug
Subject Re: Native type for storing fractions (e.g 1/3)?
Date
Msg-id 45F9B680.6040209@phlo.org
Whole thread Raw
In response to Re: Native type for storing fractions (e.g 1/3)?  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout wrote:
> On Thu, Mar 15, 2007 at 09:11:23PM +0100, Florian G. Pflug wrote:
>> You'd need a type for large integers first - otherwise your
>> ty_fraction will be quite limited. I think numeric could be
>> used for that, though I don't know if numeric guarantees that
>> at least the operators +,-,* and modulo return exact results
>> (Don't loose digits). But even if they do, using some existing
>> library for arbitrary sized integers would probably lead to
>> better performance.
>
> Numeric is an arbitrary sized number library, so using that would be
> smart.
Yeah, but it can do much more than just arbitrary sizes integers -
so I figured a library doing just integers might do them faster then
the numeric support in postgres does, or more space-efficient, or
whatever...

It would only make sense to use a different library if it provides
a substantial advantage in speed or space, of course.

greetings, Florian Pflug



pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: SQL Question - Group By and % results per row
Next
From: "Florian G. Pflug"
Date:
Subject: Re: CREATE TABLESPACE dynamically