Hi guys,
Thanks for the help.
I was able to recreate the problem , on the same DB, with PSQL only. No JDBC.
A plain run of a complicated query : 50ms
A prepare and then execute of the same query: 2500ms.
The plans are different, as discussed above. The fast one is using Mat
Very good point from Danny: generic and custom plans.
One thing that is almost certainly not at play here, and is mentioned: there
are some specific cases where the planner does not optimise for the query in
total to be executed as fast/cheap as possible, but for the first few rows. One
reason