Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly
Date
Msg-id 8818.1136565757@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2150: PL/Python function delcared STABLE gets run repeatedly  ("Aaron Swartz" <me@aaronsw.com>)
List pgsql-bugs
"Aaron Swartz" <me@aaronsw.com> writes:
> We have the PL/Python function get_foo(n) that returns an array. If this
> function is declared IMMUTABLE, then:
> SELECT * FROM tablenamehere WHERE id = any(get_foo(21));
> returns quickly. If the function is declared STABLE, however, PostgreSQL
> seems to incorrectly run it for every row in the table and it takes forever.

= ANY isn't indexable in 8.1, so there's no obvious reason why either
version would be fast.  You're going to have to provide more detail if
you want help.  For starters, what does EXPLAIN ANALYZE show in each
case?  What's the schema of the table (\d output will do)?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2153: atan2(0, 0) ERROR: input is out of range on Solaris
Next
From: Tom Lane
Date:
Subject: Re: BUG #2152: psql crash reproducible