Re: Why is index disregarded when querying a timestamp?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Markus Wollny" <Markus(dot)Wollny(at)computec(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is index disregarded when querying a timestamp?
Date: 2002-07-03 15:32:14
Message-ID: 25048.1025710334@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Markus Wollny" <Markus(dot)Wollny(at)computec(dot)de> writes:
> I would like to know why this query here doesn't use the index on
> ct_com_board_message....

> from CT_COM_BOARD_MESSAGE MESSAGE
> where (0=0)
> and (MESSAGE.CREATED >= CURRENT_TIMESTAMP-1)
> LIMIT 500

That's not considered an indexable WHERE clause in current releases
(7.3 will fix this). See past discussions about how to hide the
current_timestamp call in a function marked "isCachable".

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2002-07-03 15:41:32 Re: README file for postgresql server upgrade
Previous Message Bruce Momjian 2002-07-03 15:28:56 Re: (A) native Windows port