Andrew McMillan wrote:
>
> Tom Lane wrote:
> >
> > begin;
> > select * from foo where x = functhatreadsbar();
> > update bar ...;
> > select * from foo where x = functhatreadsbar();
> > end;
> >
> > does not give you the desired results.
>
> But why would you be marking the function 'iscachable' if you wanted to see the
> change there?
Because if there is an index on 'x' you would want to use it instead of
performing a full table scan. If table 'foo' has millions of records, and
functhatreadsbar() return one value, an operation that can take milliseconds,
not takes seconds with no benefit.