Re: [GENERAL] Function index qeustion - Mailing list pgsql-sql

From Tom Lane
Subject Re: [GENERAL] Function index qeustion
Date
Msg-id 9914.1059176513@sss.pgh.pa.us
Whole thread Raw
List pgsql-sql
Jonathan Bartlett <johnnyb@eskimo.com> writes:
> 1) If you have an index on a cacheable function, does PostgreSQL use the
> index instead of calculating the results?

Not in general --- only for an indexscan lookup.

> 2) How does PostgreSQL know when to recompute the function?

Never.  That's what the iscachable flag means: you are promising that
the function's output for given input never changes.  If you aren't
prepared to make that promise, you cannot index the function.

            regards, tom lane

pgsql-sql by date:

Previous
From: Jamie Lawrence
Date:
Subject: Re: Odd problems with create rule
Next
From: Denis Zaitsev
Date:
Subject: Very strange 'now' behaviour in nested triggers.