Abu Mushayeed <abumushayeed(at)yahoo(dot)com> writes:
> The query is as follows and it's explain plan is also attached:
The query itself seems to be a simple join over not too many rows, so
I don't see how it could be taking 24 hours. What I suspect is you're
incurring lots and lots of invocations of those user-written functions
and one of them has suddenly decided to get very slow.
regards, tom lane