Re: [GENERAL] Query becomes slow when written as view

2013-02-15 Thread Jan Strube
is your function stable/immutable, and if so is it decorated as such. No, itŽs volatile. Well, that's your problem. The planner won't push down the IN clause past the volatile function for fear of changing the query's side-effects. I'd question whether it's sane to have a view with volatile

Re: [GENERAL] Query becomes slow when written as view

2013-02-14 Thread Tom Lane
Jan Strube writes: >> is your function stable/immutable, and if so is it decorated as such. > No, it´s volatile. Well, that's your problem. The planner won't push down the IN clause past the volatile function for fear of changing the query's side-effects. I'd question whether it's sane to have

Re: [GENERAL] Query becomes slow when written as view

2013-02-14 Thread Jan Strube
is your function stable/immutable, and if so is it decorated as such. merlin No, it´s volatile. Jan -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Query becomes slow when written as view

2013-02-14 Thread Merlin Moncure
On Thu, Feb 14, 2013 at 7:23 AM, Jan Strube wrote: > Hi, > > I have the following query which runs reasonably fast under PostgreSQL > 9.1.8: > > SELECT > b."ISIN", > CASE > WHEN b."COMMENT" IS NOT NULL THEN b."COMMENT" > WHEN cc."ISIN" IS NOT NULL THEN cc.comment > ELSE get_comment(b."ISIN") > END

[GENERAL] Query becomes slow when written as view

2013-02-14 Thread Jan Strube
Hi, I have the following query which runs reasonably fast under PostgreSQL 9.1.8: SELECT b."ISIN", CASE WHEN b."COMMENT" IS NOT NULL THEN b."COMMENT" WHEN cc."ISIN" IS NOT NULL THEN cc.comment ELSE get_comment(b."ISIN") END AS "COMMENT" FROM dtng."Z_BASE" b LEFT JOIN dtng.cached_comments cc on