Re: TIME vs. TIMESTAMP data type

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: TIME vs. TIMESTAMP data type
Дата
Msg-id 3E42481C.6050705@klaster.net
обсуждение исходный текст
Ответ на TIME vs. TIMESTAMP data type  (Ludwig Lim <lud_nowhere_man@yahoo.com>)
Ответы Re: TIME vs. TIMESTAMP data type  (Ludwig Lim <lud_nowhere_man@yahoo.com>)
Список pgsql-sql
Ludwig Lim wrote:
> Hi:
> 
>     Are there cases when a TIME data type is a better
> choice over the TIMESTAMP data type? 
> 
>     It seems that PostgreSQL (I'm using 7.2.3)
> encourage its users to use TIMESTAMP over TIME data
> type. I said this because of the following:
>    a) More functions for DATE and TIMESTAMP data types
> such as to_date() and to_timestamp(). Howver, function
> to_time() does not exist.
>    b) Same amount of storage for TIMESTAMP and for
> TIME. Time with time zone even need more storage space
> than a timestamp (12 bytes vs. 8 bytes).
>    c) It's harder to TIMESTAMP to TIME and vice versa,
> while its easier to cast TIMESTAMP to DATE and vice
> versa.
> 
> 
> thank you very much,
> 
> ludwig


Probably you are right, but you can cast into timestamp before using these functions.
Do you really need to care amount of storage?
Don't forget about INTERVAL type, which is very useful for time calculations.

Regards,
Tomasz Myrta





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

Предыдущее
От: Ludwig Lim
Дата:
Сообщение: Re: Lock timeout detection in postgres 7.3.1
Следующее
От: Maurício Sessue Otta
Дата:
Сообщение: Trigger para fazer log