Re: Timestamp conversion can't use index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Timestamp conversion can't use index
Date: 2001-12-26 15:49:09
Message-ID: 19662.1009381749@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> What has me confused is why constant folding is needed to perform index
> lookups.

You are confused because those aren't related.

The entire notion of an indexscan is predicated on the assumption that
you are comparing all elements of the index to the same comparison
value. Thus for example "x = random()" is not indexable. To use an
indexscan the query planner must be able to determine that the right
hand side will not change over the course of the scan.

Constant-folding requires a stronger assumption: that the result the
function gives when evaluated by the query planner will be the same
result we'd get later (perhaps much later) at execution time.

Since we only have one kind of noncachable function at the moment,
these two restrictions are conflated ... but there should be more than
one kind of noncachable function.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-12-26 16:20:24 Re: [JDBC] Remember to register PostgreSQL for JDJ 2002 awards
Previous Message Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= 2001-12-26 14:51:04 Re: Thoughts on the location of configuration files