Matthew Lunnon wrote:
> Ahh, sorry, I have been too aggressive with my cutting, I am running
> 8.2.6 and the function is below.
>
<snip>
> $BODY$
> LANGUAGE 'sql' VOLATILE;
^^^^^^^^^^
I suspect that it's because you're using VOLATILE (so no good
optimizations is done); did you try STABLE? Could you show us the
EXPLAIN ANALYZE of query and function?
--
Euler Taveira de Oliveira
http://www.timbira.com/