Re: code cleanup of timestamp code - Mailing list pgsql-hackers

From Tom Lane
Subject Re: code cleanup of timestamp code
Date
Msg-id 6968.1204055734@sss.pgh.pa.us
Whole thread Raw
In response to Re: code cleanup of timestamp code  (Neil Conway <neilc@samurai.com>)
Responses Re: code cleanup of timestamp code
List pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> On Tue, 2008-02-26 at 00:22 -0800, Warren Turkal wrote:
>> As a result, I have a few questions about the timestamp code. In what
>> instances is the floating point timestamp recommended?

> One circumstance is when there isn't a native int64 type available.

There are other possible reasons to prefer the float implementation;
for example it has wider range than the int64 code.  Most people have
no need to represent dates beyond 6 million AD, of course, but I think
it's at least potentially useful for some scientific applications.

Also, despite the Niagara-centric moans you may have noticed from some
Sun hackers, float arithmetic is faster than int64 on quite a wide
variety of recent hardware.  That may sound counterintuitive but float
units have been a traditional place to fling any surplus of gates at,
while if you don't have 64-bit hardware then int64 isn't really a native
type.  MegaFLOP ratings are marketable, mega-int64-ops not so much.
(Though it's possibly true that the actual arithmetic in datetime.c is
buried under too much logic for it to make a noticeable difference :-()

Anyway I think they both have their place.  int64 is a sensible default,
because it doesn't have the type of non-decimal behavior that tends
to surprise novices (compare today's bug #3991).  But I don't see float
disappearing entirely.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: pg_dump additional options for performance
Next
From: Josh Berkus
Date:
Subject: Re: Including PL/PgSQL by default