timestamp(0) vs. timestamp

From: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: timestamp(0) vs. timestamp
Date: 2011-04-27 15:53:36
Message-ID: 80501703-39d6-45a6-a424-2ae0b21eb4a5@r6g2000vbz.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Harold 2011-04-27 15:55:33 Re: PHP and PostgreSQL 9.0, pg_connect fails to connect
Previous Message Joel Stevenson 2011-04-27 15:52:49 Re: Column storage (EXTERNAL/EXTENDED) settings for bytea/text column