"elias ghanem" <e.ghanem@acteos.com> wrote:
> I'm not sure this is the right place to ask my question
Yes it is. You gave a lot of good information, but we'd have a
better shot at diagnosing the issue with a bit more. Please read
the following and resubmit with as much of the requested information
as you can. Note that you might need to break out the problem query
from the function to run EXPLAIN ANALYZE (the output of which is one
of the more useful diagnostic tools we have).
http://wiki.postgresql.org/wiki/SlowQueryQuestions
-Kevin