Nested IMMUTABLE functions

Поиск
Список
Период
Сортировка
От Peter
Тема Nested IMMUTABLE functions
Дата
Msg-id g2rd38$1jko$1@news.hub.org
обсуждение исходный текст
Ответы Re: Nested IMMUTABLE functions  (Joris Dobbelsteen <joris@familiedobbelsteen.nl>)
Список pgsql-general
I have two immutable Pl/PG funcs - func A takes a parameter X, looks up
related value Y from a table and passes Y to func B. Now, if I do something
like

select A(field_x) from bigtable

it will, of course call A for every single row since paramater is changing.
However, it also calls func B for every row even though most (actually all)
related values Y are the same!

Is this by design, or flaw in optimizer? I thought immutable funcs with the
same arguments are only called once within a scope of single query, and that
'select A(...)' should have counted as single query, right?

This stuff is killing me... func B is small, all table lookups optimized to
the hilt but still I'm taking major performance hit as it's called
hundreds/thousands of times.

Any ideas?

Thx,
Peter




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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Heavily fragmented table and index data in 8.0.3
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unable to dump database using pg_dump