Re: iscacheable for date/time? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: iscacheable for date/time?
Date
Msg-id 840.1001516278@sss.pgh.pa.us
Whole thread Raw
In response to iscacheable for date/time?  (Thomas Lockhart <lockhart@fourpalms.org>)
List pgsql-hackers
Thomas Lockhart <lockhart@fourpalms.org> writes:
> Can anyone recall why the interval data type would have been
> considered non-cacheable?

I believe I made all functions for all datetime-related types
noncacheable, simply because I wasn't sure which of them had the
"current" behavior.

> For timestamp and timestamptz, I've eliminated the "current" special
> value which afaicr is the only reason timestamp had not been cacheable
> in the past. Are there any functions which should *not* be considered
> cacheable for those types? Apparently the _in() and _out() functions
> should not be?

in() should not be, since its result for the strings "now", "today",
"tomorrow", etc is variable.  But AFAICS there's no reason to mark out()
as noncacheable anymore.

The general rule is: if there are any fixed input values for which the
output might vary over time, then it should be noncachable.

Dunno why to_char is marked noncachable; does it perhaps have
format-string entries that pick up current time somehow?  I might just
have been worried about its response to "current", though.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: PERFORMANCE IMPROVEMENT by mapping WAL FILES
Next
From: Tom Lane
Date:
Subject: Re: iscacheable for date/time?