Re: Calling the same function more than once with the same arguments
| От | Clodoaldo Pinto |
|---|---|
| Тема | Re: Calling the same function more than once with the same arguments |
| Дата | |
| Msg-id | a595de7a0604201055t287785f0t4779b50e9082379d@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Calling the same function more than once with the same (Ben <bench@silentmedia.com>) |
| Список | pgsql-general |
2006/4/19, Ben <bench@silentmedia.com>: > Look into the immutable flag on function creation: I have read that section and I'm still not sure about it. This is the caller() function: create or replace function caller(int4) returns some_type as $body$ select array(select distinct a from called($1)) as a , array(select distinct b from called($1)) as b ; $body$ language 'sql' stable strict; Since called() will read from a table that can be modified it is declared as stable and not as immutable. This is what is in section 32.6: " A STABLE function cannot modify the database and is guaranteed to return the same results given the same arguments FOR ALL ROWS WITHIN A SINGLE STATEMENT." Is called() called from within a single statement in caller()? Will the optimizer optimize the multiple calls (there will be about 30) to a single call? Regards, Clodoaldo Pinto
В списке pgsql-general по дате отправления: