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 Materialize and Memoize. Thanks Danny