pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dhimant Patel <drp4kri@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query Performance with Indexes on Integer type vs. Date type.
Date: Wed, 27 Apr 2011 12:11:57 -0400
Message-ID: <17017.1303920717@sss.pgh.pa.us> (raw)
In-Reply-To: <BANLkTi=6obZB2vamHxbsUTYdQFrhrAz7_g@mail.gmail.com>
References: <BANLkTi=6obZB2vamHxbsUTYdQFrhrAz7_g@mail.gmail.com>

Dhimant Patel <drp4kri@gmail.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



view thread (6+ messages)  latest in thread

Message-ID: <17017.1303920717@sss.pgh.pa.us>
Permalink:  ../17017.1303920717@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17017.1303920717@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, drp4kri@gmail.com
  Subject: Re: Query Performance with Indexes on Integer type vs. Date type.
  In-Reply-To: <17017.1303920717@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox