Re: Query Performance with Indexes on Integer type vs. Date type.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dhimant Patel <drp4kri(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query Performance with Indexes on Integer type vs. Date type.
Date: 2011-04-27 16:11:57
Message-ID: 17017.1303920717@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Dhimant Patel <drp4kri(at)gmail(dot)com> writes:
> From my initial read on documentation I believe internally a date type is
> represented by integer type of data. This makes me wonder would it make any
> good to create additional column of Integer type and update it as data gets
> added and use this integer column for all ordering purposes for my sqls - or
> should I not hasitate using Date type straight into my sql for ordering?

Don't overcomplicate things. Comparison of dates is just about as fast as
comparison of integers, anyway.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Maciek Sakrejda 2011-04-27 16:12:32 Re: Query Performance with Indexes on Integer type vs. Date type.
Previous Message Dhimant Patel 2011-04-27 15:28:19 Query Performance with Indexes on Integer type vs. Date type.