timestamp(0) vs. timestamp - Mailing list pgsql-general

From Erwin Brandstetter
Subject timestamp(0) vs. timestamp
Date
Msg-id 80501703-39d6-45a6-a424-2ae0b21eb4a5@r6g2000vbz.googlegroups.com
Whole thread Raw
Responses Re: timestamp(0) vs. timestamp
List pgsql-general
Hi all!

This may seem unimportant, but I still would like to know.

I have columns for timestamps without fractional digits, so I could
define them as timestamp(0).
However, there is no way fractions could ever enter anyway, because
triggers and / or checks guarantee values without fractional seconds.

Is it advantageous to define the column as timestamp(0) or simply as
timestamp?
Does the query planner or any other part of the RDBMS profit from the
additional information in the definition?
Or do I just create an overhead of useless checks or conversions
(however small)?

In a scenario like that, what would be (however slightly) preferable:
CREATE TABLE x
(
   ...
   log_in timestamp(0) without time zone NOT NULL DEFAULT
(now())::timestamp without time zone
or
   log_in timestamp without time zone NOT NULL DEFAULT
(now())::timestamp(0) without time zone
or
   log_in timestamp(0) without time zone NOT NULL DEFAULT
(now())::timestamp(0) without time zone


TIA
Erwin Brandstetter


pgsql-general by date:

Previous
From: Thomas Harold
Date:
Subject: Re: PHP and PostgreSQL 9.0, pg_connect fails to connect
Next
From: Phoenix Kiula
Date:
Subject: Index not being used for UPDATE?