pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Ludwig Lim <lud_nowhere_man@yahoo.com>
Cc: PostgreSQL Mailing List <pgsql-sql@postgresql.org>
Subject: Re: TIME vs. TIMESTAMP data type
Date: Thu, 06 Feb 2003 12:33:48 +0100
Message-ID: <3E42481C.6050705@klaster.net> (raw)
References: <20030206110435.27538.qmail@web80303.mail.yahoo.com>

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






view thread (4+ messages)  latest in thread

Message-ID: <3E42481C.6050705@klaster.net>
Permalink:  ../3E42481C.6050705@klaster.net/
Also on:    postgresql.org/message-id/3E42481C.6050705@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, lud_nowhere_man@yahoo.com
  Subject: Re: TIME vs. TIMESTAMP data type
  In-Reply-To: <3E42481C.6050705@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox