Re: Does it make sense to break a large query into separate functions?

Поиск
Список
Период
Сортировка
От Gavin Flower
Тема Re: Does it make sense to break a large query into separate functions?
Дата
Msg-id 518AC80E.3090503@archidevsys.co.nz
обсуждение исходный текст
Ответ на Re: Does it make sense to break a large query into separate functions?  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: Does it make sense to break a large query into separate functions?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
On 09/05/13 09:35, Merlin Moncure wrote:
[...]

> More oddness -- when I wrap, say, random() with stable function, I get
> unique value per returned row, but same value across the set when
> wrapped with immutable.
[..]

That part I think I know (but, I'm often wrong!).

By saying it is immutable, you are saying that the values returned for
the same set of parameters is always the same.  The system looks at your
immutable function that wraps random() and 'knows' that once invoked,
the value returned will always be the same, so why would it want to
invoke your immutable function multiple times, as it can just do that
once and reuse the value returned?


Cheers,
Gavin


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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: Does it make sense to break a large query into separate functions?
Следующее
От: Jon Smark
Дата:
Сообщение: Normal errors codes in serializable transactions