Friday, May 9, 2008

Re: [GENERAL] Using Epoch to save timestamps in 4 bytes?

On Fri, May 9, 2008 at 3:15 AM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
> On Thu, May 8, 2008 at 10:00 PM, Bruce Momjian <bruce@momjian.us> wrote:
>>
>> Our timestamp has a much larger range than a 4-byte time_t, docs say:
>>
>> <entry>4713 BC</entry>
>> <entry>294276 AD</entry>
>
> Which is normally great. Doesn't it have greater precision in the
> modern era or something like that?
>
> If you compile for integer dates do they have the same range?

no. that's actually the integer range. the float range is 4713 BC to
5874897 AD. Of course, at the outer ranges of the scale, the
precision is going to be really lousy.

Anyways, to the OP, a 4 byte time_t is to small a type to be the
timestamp. There are just too many things that need greater
range/precision to make it the default. Also, postgresql does not
store epoch, but it's own custom type with its own bias, etc. There
is nothing wrong with storing int4 epoch in your tables to save a
little space if that suits your application.

merlin

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

No comments: