Re: Using Epoch to save timestamps in 4 bytes?

From: Francisco Reyes <lists(at)stringsutils(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using Epoch to save timestamps in 4 bytes?
Date: 2008-05-11 00:47:11
Message-ID: cone.1210466831.824341.64807.1000@zoraida.natserv.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruce Momjian writes:

>> I am looking at tens of millions of rows, which is why my predecessor may
>> have used integer to store epoch to save space.
>
> Our timestamp has a much larger range than a 4-byte time_t, docs say:
>
> <entry>4713 BC</entry>
> <entry>294276 AD</entry>

Given that all of our dates will fall within what we can store in 4bytes,
what would be the easiest way to use epoch as a timestamp?

Create a couple of functions so our developers can use a date representation
like '20080508 12:40:00' and have the functions tranlate strings to epoch
and back?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-05-11 01:37:29 Re: Using Epoch to save timestamps in 4 bytes?
Previous Message Kevin Reynolds 2008-05-10 18:09:47 ORDER BY FIELD feature