Re: how to evaluate a function only once for a query?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: how to evaluate a function only once for a query?
Дата
Msg-id 200206201209.57040.dev@archonet.com
обсуждение исходный текст
Ответ на how to evaluate a function only once for a query?  (Nicolae Mihalache <mache@abcpages.com>)
Список pgsql-general
On Thursday 20 Jun 2002 11:40 am, Nicolae Mihalache wrote:

> However, when I do a query like:
> "select * from mytable where time<timevalue('something')" I see that my
> function is evaluated once for each row in mytable. The problem is that
> it will return each time the same value (because the argument is
> constant)

Try marking the function "iscachable" when you define it - it's designed for
exactly this situation and says that for any fixed argument your function
will return a fixed result.. I don't use pltcl but I believe that works
regardless of the function language. See the manuals for CREATE FUNCTION for
further details.

- Richard Huxton

В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: database size
Следующее
От: Peter Dimov
Дата:
Сообщение: Re: URGENT: Performance tuning