Andriy Tkachuk <ant@imt.com.ua> writes:
> There is EXPLAIN ANALYSE when query is heavy:
> ...
> and there is, when query is light:
> ...
These sure appear to be the same query plan. I am thinking that the
cost differential is not in the plan itself at all, but in some bit of
processing that doesn't show in the plan. In particular, since all the
extra runtime shows up in the top join node (where the SELECT result
list would be evaluated), I am thinking that there's something funny
going on in some user-defined function that's called in the SELECT list.
You have not shown us the actual query yet, AFAIR. Any
potentially-expensive functions in there?
regards, tom lane