Franck Routier <franck(dot)routier(at)axege(dot)com> writes:
> Right, explain alone takes 3.6 seconds, so the time really seems to go
> query planning...
Well, you've not shown us the query, so it's all going to be
speculation. But maybe you have some extremely expensive function that
the planner is evaluating to fold to a constant, or something like that?
The generated plan isn't terribly complicated, but we can't see what
was required to produce it.
regards, tom lane