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

From: Dhimant Patel <drp4kri(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Query Performance with Indexes on Integer type vs. Date type.
Date: 2011-04-27 15:28:19
Message-ID: BANLkTi=6obZB2vamHxbsUTYdQFrhrAz7_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi All,

I am a new comer on postgres world and now using it for some serious (at
least for me) projects. I have a need where I am running some analytical +
aggregate functions on data where ordering is done on Date type column.

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?

Better yet, is there anyway I can verify impact of ordering on Date type vs.
Integer type, apart from using \timing and explain plan?

Thanks for sharing your insights.
-DP.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2011-04-27 16:11:57 Re: Query Performance with Indexes on Integer type vs. Date type.
Previous Message Kevin Grittner 2011-04-27 12:40:58 Re: reducing random_page_cost from 4 to 2 to force index scan