Search Postgresql Archives

Re: PostgreSQL index issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux