From: | "Peter" <peter(at)greatnowhere(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Nested IMMUTABLE functions |
Date: | 2008-06-12 14:50:20 |
Message-ID: | g2rd38$1jko$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | krishtpt | 2008-06-12 14:54:40 | PostgreSQL Syntax questions |
Previous Message | Alvaro Herrera | 2008-06-12 14:30:20 | Re: Heavily fragmented table and index data in 8.0.3 |