Re: how to make an SQL UPDATE from record returning function

Поиск
Список
Период
Сортировка
От Rafal Pietrak
Тема Re: how to make an SQL UPDATE from record returning function
Дата
Msg-id 1335342503.12061.12.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: how to make an SQL UPDATE from record returning function  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-general
On Tue, 2012-04-24 at 12:10 +0200, Thomas Kellerer wrote:
> Rafal Pietrak, 24.04.2012 09:02:
> >
> > is not an option, since the function is *very* expensive (multiple join
> > of large tables - inventories, history, etc).
> >
> > Is there a syntax workaround that I could possibly use to get the effect
> > of launching my_function just once?
>
> With 9.1 you could probably achieve this using a writeable CTE.
>
> Although I have to admit I don't really understand what your function is returning.
> Does the function return a result set or scalar values?
>

Basically, it's at shopping cart update.

It ranks updated an item with costommer rating of that item with respect
to other orders and current stock (so that when the cart is only
presented, the values are there, precomputted on update). There is more
then one value to precompute, so the function returns a set of values.
(earlier I only needed to precompute just one value and everything was
so easy then... :).

Could you pls give me an example of how the "writeable CTE"? This does
not ring a bell here.


-R


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

Предыдущее
От: Willy-Bas Loos
Дата:
Сообщение: Re: Bug? Query plans / EXPLAIN using gigabytes of memory
Следующее
От: hari.fuchs@gmail.com
Дата:
Сообщение: Re: how to group by similarity ?