Обсуждение: Re: [GENERAL] Function index qeustion

Поиск
Список
Период
Сортировка

Re: [GENERAL] Function index qeustion

От
Tom Lane
Дата:
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