Search Postgresql Archives

Nested IMMUTABLE functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux