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

From Thomas Lockhart
Subject Re: Timestamp conversion can't use index
Date
Msg-id 3C296E6B.FC9F7EF7@fourpalms.org
Whole thread Raw
In response to Re: Timestamp conversion can't use index  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Timestamp conversion can't use index  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Timestamp conversion can't use index  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
> > Someone reported to me that they can't get their queries to use indexes.
> > It turns out this is because timestamp() has pg_proc.proiscachable set
> > to false in many cases.  Date() also has this in some cases.
> Please let me add a reference to this email from Tom Lane:

The functions marked as non-cachable are those that are converting from
data types (such as text for which the input may need to be evaluated
for (at least) that transaction.

What kind of queries against constants are they doing that can't use
SQL-standard syntax to avoid a conversion from another data type?

timestamp('stringy time')

may not be good, but I would think that

timestamp 'timey time'

should let the optimizer use indices just fine. It *could* do some more
constant folding if we had a distinction between functions with
indeterminate side effects (e.g. random()) as opposed to those who just
need to be evaluated once per transaction (say, date/time conversion
functions needing the time zone evaluated).
                    - Thomas


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [JDBC] Remember to register PostgreSQL for JDJ 2002 awards
Next
From: Tom Lane
Date:
Subject: Re: Timestamp conversion can't use index