Re: Checking = with timestamp field is slow

From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Checking = with timestamp field is slow
Date: 2004-11-05 12:47:54
Message-ID: m3zn1wsbr9.fsf@knuth.knuth.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

After a long battle with technology, antonypaul24(at)gmail(dot)com (Antony Paul), an earthling, wrote:
> Hi all,
> I have a table which have more than 200000 records. I need to get
> the records which matches like this
>
> where today::date = '2004-11-05';
>
> This is the only condition in the query. There is a btree index on the
> column today.
> Is there any way to optimise it.

How about changing the criterion to:

where today between '2004-11-05' and '2004-11-06';

That ought to make use of the index on "today".
--
"cbbrowne","@","ntlug.org"
http://www.ntlug.org/~cbbrowne/sgml.html
"People need to quit pretending they can invent THE interface and walk
away from it, like some Deist fantasy." -- Michael Peck

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Allen Landsidel 2004-11-05 14:39:16 Strange (?) Index behavior?
Previous Message Michael Fuhr 2004-11-05 09:13:06 Re: Checking = with timestamp field is slow