Re: PostgreSQL index issue - Mailing list pgsql-general

From Albe Laurenz
Subject Re: PostgreSQL index issue
Date
Msg-id D960CB61B694CF459DCFB4B0128514C2082466D4@exadv11.host.magwien.gv.at
Whole thread Raw
In response to PostgreSQL index issue  (mperformer <codevally.mail.list@gmail.com>)
Responses Re: PostgreSQL index issue  (codevally <codevally.mail.list@gmail.com>)
List pgsql-general
mperformer wrote:
> I have a question regarding PostgreSQL 9.1 indexing.
>
> I am having a table and want to create a index for a column and I want
to store the data with time
> zone for that column. The questions are:
>
> 1. Can I create a index for a column which store time stamp with time
zone. If can is there ant
> performance issues?

Yes, you can create an index on a TIMESTAMP WITH TIME ZONE column.
There are no performance problems except the ones that always
come with an index: INSERTs, UPDATEs and DELETEs will be slower
and do more disk I/O and locking.

> 2. Also I can store the time stamp value with zone as a long integer
value. If so what is the
> difference between the above step. Which one is better.

The smaller the indexed column is, the smaller and faster the
index will be. A timestamp uses 8 bytes, same as a bigint, so
that shouldn't matter.

Use the representation that is most useful to your processing.
For timestamps, this is usually the timestamp data type (which
automatically rejects impossible dates and provides date
arithmetic).

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Bartosz Dmytrak
Date:
Subject: Re: PostgreSQL limitations question
Next
From: Craig Ringer
Date:
Subject: Re: PostgreSQL limitations question