Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Aaron Swartz" <me(at)aaronsw(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly
Date: 2006-01-06 16:42:37
Message-ID: 8818.1136565757@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Aaron Swartz" <me(at)aaronsw(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-01-06 16:45:32 Re: BUG #2152: psql crash reproducible
Previous Message Tom Lane 2006-01-06 16:33:50 Re: BUG #2153: atan2(0, 0) ERROR: input is out of range on Solaris