Re: Using Epoch to save timestamps in 4 bytes?

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Using Epoch to save timestamps in 4 bytes?
Дата
Msg-id b42b73150805090551g636fd5a6r5b4ab48fa1ac7bda@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Using Epoch to save timestamps in 4 bytes?  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Ответы Re: Using Epoch to save timestamps in 4 bytes?
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Is this a bug? (changing sequences in default value)
Следующее
От: Fernando Schapachnik
Дата:
Сообщение: Re: Is this a bug? (changing sequences in default value)