Re: Timestamp conversion can't use index - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Timestamp conversion can't use index
Date
Msg-id 19662.1009381749@sss.pgh.pa.us
Whole thread Raw
In response to Re: Timestamp conversion can't use index  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.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


pgsql-hackers by date:

Previous
From: teg@redhat.com (Trond Eivind Glomsrød)
Date:
Subject: Re: Thoughts on the location of configuration files
Next
From: Thomas Lockhart
Date:
Subject: Re: [JDBC] Remember to register PostgreSQL for JDJ 2002 awards